Function Repository Resource:

ShortestTourArt3D

Source Notebook

Display a 3D model using a continuous line

Contributed by: Enrique Zeleny

ResourceFunction["ShortestTourArt3D"][model3D]

takes the points from model3D, finds the shortest path between these points and plots a continuous line for this path.

ResourceFunction["ShortestTourArt3D"][model3D,n]

only takes n points from model3D to plot the line that connects the points.

Details and Options

FindShortestTour is effectively used to find the shortest path.

Examples

Basic Examples (3) 

Show shortest path lines connecting vertices in 3D graphics:

In[1]:=
ResourceFunction["ShortestTourArt3D"][
 ExampleData[{"Geometry3D", "Horse"}]]
Out[1]=

Show only 3000 points with the original 3D model:

In[2]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/ef1b7a97-f55e-44ba-86cc-167c0d20f6e9"]
Out[2]=
In[3]:=
Show[ExampleData[{"Geometry3D", "Beethoven"}], %]
Out[3]=

Generate an animation:

In[4]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/4695370d-f1b3-4105-9c03-0748bd435638"]
Out[4]=

Scope (1) 

ShortestTourArt3D works for other types of 3D graphics that contain a GraphicsComplex:

In[5]:=
ResourceFunction["ShortestTourArt3D"][
 ContourPlot3D[
  x^4 + y^4 + z^4 - (x^2 + y^2 + z^2)^2 + 3 (x^2 + y^2 + z^2) == 3, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]]
Out[5]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 17 April 2019

License Information