10

I'm trying to create a version of Alberti's window, a figure that represents the projection of a three-dimensional figure onto a two-dimensional plane.

Here are my steps:

1) Create the three-dimensional figure:

myDodecahedronFigure = 
 Graphics3D[{EdgeForm[Blue], 
   PolyhedronData["Dodecahedron", "Faces", "Polygon"]}]

2) Extract the vertices and create a line from each to the center of projection (at {10,0,0}):

myVertices = N@PolyhedronData["Dodecahedron", "Vertices"];

myProjectionLines = (Line[{{10, 0, 0}, #}] & /@ myVertices);

3) Put them together with the plane of projection (at x = 6):

Show[myDodecahedronFigure,
 Graphics3D[{Red, myProjectionLines, 
   PointSize[0.01], Point[myVertices],
   Opacity[0.5], Yellow, 
   Polygon[{{6, -2, -2}, {6, -2, 2}, {6, 2, 2}, 
            {6, 2, -2}, {6, -2, -2}}]}],
 ImageSize -> 600
 ]

enter image description here

I would like to render the projections of the (red) points and the (blue) edges onto the projection plane.

Problems

I have two component problems:

a) I want to include only the points and edges that are visible from the center of projection. (I don't want to hand-select such points.)

b) I want a natural and simple way to render lines and points on the projection plane. (Alas Projection merely projects a vector onto another vector, so that doesn't seem of much help.)

David G. Stork
  • 41,180
  • 3
  • 34
  • 96

1 Answers1

10

We can get the lines connected to vertices visible from vp using the approach from this answer by aardvark2012 and the intersections of those lines with the plane using RegionIntersection:

vp = {10, 0, 0};
poly = Polygon[{{6, -2, -2}, {6, -2, 2}, {6, 2, 2}, {6, 2, -2}}];

rd = RegionDifference[ConvexHullMesh[Prepend[myVertices, vp]], ConvexHullMesh[myVertices]];

lines2 = Select[myProjectionLines, MemberQ[Intersection[MeshCoordinates[rd], myVertices], #[[1,2]]]&];

pointsonpoly = RegionIntersection[poly, #]& /@ lines2;

Graphics3D[{PointSize[0.01], Red, Point[myVertices], Green, pointsonpoly,
Cyan,PointSize[0.02],Point@@@lines2, Purple, lines2, Opacity[0.5], Yellow, poly,
myDodecahedronFigure[[1]]}, ImageSize -> 600]

enter image description here

kglr
  • 394,356
  • 18
  • 477
  • 896