Wolfram Research

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

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/821b9c37-5c98-431e-a6de-039cb13bee6d"]
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/cf55d430-3a0a-4cee-b742-8af846518572"]
Out[4]=

Scope

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

Resource History

License Information