Consider the following lists:
coor = {{2.99535, 1.14412, 1.41421}, {2.55834, 2.28825, 0.707107}, {2.28825, 0.707107, 2.55834}, {1.14412, 1.41421, 2.99535}, {1.41421, 2.99535, 1.14412}, {3.43237, 0, 0.707107}, {0.707107, 2.55834, 2.28825}, {3.43237, 0, -0.707107}, {2.55834, 2.28825, -0.707107}, {2.28825, -0.707107, 2.55834}, {2.99535, 1.14412, -1.41421}, {1.14412, -1.41421, 2.99535}, {0, 0.707107, 3.43237}, {0.707107, 3.43237, 0}, {2.99535, -1.14412, 1.41421}, {0, -0.707107, 3.43237}, {-0.707107, 3.43237, 0}, {2.55834, -2.28825, 0.707107}, {-0.707107, 2.55834, 2.28825}, {2.99535, -1.14412, -1.41421}, {1.41421, 2.99535, -1.14412}, {-1.41421, 2.99535, 1.14412}, {2.55834, -2.28825, -0.707107}, {0.707107, 2.55834, -2.28825}, {2.28825, 0.707107, -2.55834}, {0.707107, -2.55834, 2.28825}, {-1.14412, 1.41421, 2.99535}, {1.14412, 1.41421, -2.99535}, {1.41421, -2.99535, 1.14412}, {-2.28825, 0.707107, 2.55834},{-1.14412, -1.41421, 2.99535}, {-1.41421, 2.99535, -1.14412}, {2.28825, -0.707107, -2.55834}, {-2.28825, -0.707107, 2.55834}, {-0.707107, 2.55834, -2.28825}, {1.14412, -1.41421, -2.99535}, {-2.55834, 2.28825, 0.707107}, {1.41421, -2.99535, -1.14412}, {-0.707107, -2.55834, 2.28825}, {-2.99535, 1.14412, 1.41421}, {0.707107, -2.55834, -2.28825}, {-1.41421, -2.99535, 1.14412}, {0, 0.707107, -3.43237}, {0.707107, -3.43237, 0}, {-2.55834, 2.28825, -0.707107}, {0, -0.707107, -3.43237}, {-0.707107, -3.43237, 0}, {-2.99535, 1.14412, -1.41421}, {-2.99535, -1.14412, 1.41421}, {-1.14412, 1.41421, -2.99535}, {-2.55834, -2.28825, 0.707107}, {-2.28825, 0.707107, -2.55834}, {-3.43237, 0, 0.707107}, {-0.707107, -2.55834, -2.28825}, {-3.43237, 0, -0.707107}, {-1.41421, -2.99535, -1.14412}, {-1.14412, -1.41421, -2.99535}, {-2.28825, -0.707107, -2.55834}, {-2.55834, -2.28825, -0.707107}, {-2.99535, -1.14412, -1.41421}};
edges = {{{2.55834, 2.28825, 0.707107}, {2.99535, 1.14412, 1.41421}}, {{2.28825, 0.707107, 2.55834}, {2.99535, 1.14412, 1.41421}}, {{2.99535, 1.14412, 1.41421}, {3.43237, 0, 0.707107}}, {{1.41421, 2.99535, 1.14412}, {2.55834, 2.28825, 0.707107}}, {{2.55834, 2.28825, -0.707107}, {2.55834, 2.28825, 0.707107}}, {{1.14412, 1.41421, 2.99535}, {2.28825, 0.707107,2.55834}}, {{2.28825, -0.707107, 2.55834}, {2.28825, 0.707107, 2.55834}}, {{0.707107, 2.55834, 2.28825}, {1.14412, 1.41421, 2.99535}}, {{0, 0.707107, 3.43237}, {1.14412, 1.41421, 2.99535}}, {{0.707107, 2.55834, 2.28825}, {1.41421, 2.99535, 1.14412}}, {{0.707107, 3.43237, 0}, {1.41421, 2.99535, 1.14412}}, {{3.43237, 0, -0.707107}, {3.43237, 0, 0.707107}}, {{2.99535, -1.14412, 1.41421}, {3.43237, 0, 0.707107}}, {{-0.707107, 2.55834, 2.28825}, {0.707107, 2.55834, 2.28825}}, {{2.99535, 1.14412, -1.41421}, {3.43237, 0, -0.707107}}, {{2.99535, -1.14412, -1.41421}, {3.43237, 0, -0.707107}}, {{2.55834, 2.28825, -0.707107}, {2.99535, 1.14412, -1.41421}}, {{1.41421, 2.99535, -1.14412}, {2.55834, 2.28825, -0.707107}}, {{1.14412, -1.41421, 2.99535}, {2.28825, -0.707107, 2.55834}}, {{2.28825, -0.707107, 2.55834}, {2.99535, -1.14412, 1.41421}}, {{2.28825, 0.707107, -2.55834}, {2.99535, 1.14412, -1.41421}}, {{0, -0.707107, 3.43237}, {1.14412, -1.41421, 2.99535}}, {{0.707107, -2.55834, 2.28825}, {1.14412, -1.41421, 2.99535}}, {{0, -0.707107, 3.43237}, {0, 0.707107, 3.43237}}, {{-1.14412, 1.41421, 2.99535}, {0, 0.707107, 3.43237}}, {{-0.707107, 3.43237, 0}, {0.707107, 3.43237, 0}}, {{0.707107, 3.43237, 0}, {1.41421, 2.99535, -1.14412}}, {{2.55834, -2.28825, 0.707107}, {2.99535, -1.14412, 1.41421}}, {{-1.14412, -1.41421, 2.99535}, {0, -0.707107, 3.43237}}, {{-1.41421, 2.99535, 1.14412}, {-0.707107, 3.43237, 0}}, {{-1.41421, 2.99535, -1.14412}, {-0.707107, 3.43237, 0}}, {{2.55834, -2.28825, 0.707107}, {2.55834, -2.28825, -0.707107}}, {{1.41421, -2.99535, 1.14412}, {2.55834, -2.28825, 0.707107}}, {{-1.41421, 2.99535, 1.14412}, {-0.707107, 2.55834, 2.28825}}, {{-1.14412, 1.41421, 2.99535}, {-0.707107, 2.55834, 2.28825}}, {{2.55834, -2.28825, -0.707107}, {2.99535, -1.14412, -1.41421}}, {{2.28825, -0.707107, -2.55834}, {2.99535, -1.14412, -1.41421}}, {{0.707107, 2.55834, -2.28825}, {1.41421, 2.99535, -1.14412}}, {{-2.55834, 2.28825, 0.707107}, {-1.41421, 2.99535, 1.14412}}, {{1.41421, -2.99535, -1.14412}, {2.55834, -2.28825, -0.707107}}, {{0.707107, 2.55834, -2.28825}, {1.14412, 1.41421, -2.99535}}, {{-0.707107, 2.55834, -2.28825}, {0.707107, 2.55834, -2.28825}}, {{1.14412, 1.41421, -2.99535}, {2.28825, 0.707107, -2.55834}}, {{2.28825, -0.707107, -2.55834}, {2.28825, 0.707107, -2.55834}}, {{0.707107, -2.55834, 2.28825}, {1.41421, -2.99535, 1.14412}}, {{-0.707107, -2.55834, 2.28825}, {0.707107, -2.55834, 2.28825}}, {{-2.28825, 0.707107, 2.55834}, {-1.14412, 1.41421, 2.99535}}, {{0, 0.707107, -3.43237}, {1.14412, 1.41421, -2.99535}}, {{0.707107, -3.43237, 0}, {1.41421, -2.99535, 1.14412}}, {{-2.28825, -0.707107, 2.55834}, {-2.28825, 0.707107, 2.55834}}, {{-2.99535, 1.14412, 1.41421}, {-2.28825, 0.707107, 2.55834}}, {{-2.28825, -0.707107, 2.55834}, {-1.14412, -1.41421, 2.99535}}, {{-1.14412, -1.41421, 2.99535}, {-0.707107, -2.55834, 2.28825}}, {{-1.41421, 2.99535, -1.14412}, {-0.707107, 2.55834, -2.28825}}, {{-2.55834, 2.28825, -0.707107}, {-1.41421, 2.99535, -1.14412}}, {{1.14412, -1.41421, -2.99535}, {2.28825, -0.707107, -2.55834}}, {{-2.99535, -1.14412, 1.41421}, {-2.28825, -0.707107, 2.55834}}, {{-1.14412, 1.41421, -2.99535}, {-0.707107, 2.55834, -2.28825}}, {{0.707107, -2.55834, -2.28825}, {1.14412, -1.41421, -2.99535}}, {{0, -0.707107, -3.43237}, {1.14412, -1.41421, -2.99535}}, {{-2.99535, 1.14412, 1.41421}, {-2.55834, 2.28825, 0.707107}}, {{-2.55834, 2.28825, 0.707107}, {-2.55834, 2.28825, -0.707107}}, {{0.707107, -2.55834, -2.28825}, {1.41421, -2.99535, -1.14412}}, {{0.707107, -3.43237, 0}, {1.41421, -2.99535, -1.14412}}, {{-1.41421, -2.99535, 1.14412}, {-0.707107, -2.55834, 2.28825}}, {{-3.43237, 0, 0.707107}, {-2.99535, 1.14412, 1.41421}}, {{-0.707107, -2.55834, -2.28825}, {0.707107, -2.55834, -2.28825}}, {{-1.41421, -2.99535, 1.14412}, {-0.707107, -3.43237, 0}}, {{-2.55834, -2.28825, 0.707107}, {-1.41421, -2.99535, 1.14412}}, {{0, -0.707107, -3.43237}, {0, 0.707107, -3.43237}}, {{-1.14412, 1.41421, -2.99535}, {0, 0.707107, -3.43237}}, {{-0.707107, -3.43237, 0}, {0.707107, -3.43237, 0}}, {{-2.99535, 1.14412, -1.41421}, {-2.55834, 2.28825, -0.707107}}, {{-1.14412, -1.41421, -2.99535}, {0, -0.707107, -3.43237}}, {{-1.41421, -2.99535, -1.14412}, {-0.707107, -3.43237, 0}}, {{-2.99535, 1.14412, -1.41421}, {-2.28825, 0.707107, -2.55834}}, {{-3.43237, 0, -0.707107}, {-2.99535, 1.14412, -1.41421}}, {{-2.99535, -1.14412, 1.41421}, {-2.55834, -2.28825, 0.707107}}, {{-3.43237, 0, 0.707107}, {-2.99535, -1.14412, 1.41421}}, {{-2.28825, 0.707107, -2.55834}, {-1.14412, 1.41421, -2.99535}}, {{-2.55834, -2.28825, -0.707107}, {-2.55834, -2.28825, 0.707107}}, {{-2.28825, -0.707107, -2.55834}, {-2.28825, 0.707107, -2.55834}}, {{-3.43237, 0, -0.707107}, {-3.43237, 0, 0.707107}}, {{-1.41421, -2.99535, -1.14412}, {-0.707107, -2.55834, -2.28825}}, {{-1.14412, -1.41421, -2.99535}, {-0.707107, -2.55834, -2.28825}}, {{-3.43237, 0, -0.707107}, {-2.99535, -1.14412, -1.41421}}, {{-2.55834, -2.28825, -0.707107}, {-1.41421, -2.99535, -1.14412}}, {{-2.28825, -0.707107, -2.55834}, {-1.14412, -1.41421, -2.99535}}, {{-2.99535, -1.14412, -1.41421}, {-2.28825, -0.707107, -2.55834}}, {{-2.99535, -1.14412, -1.41421}, {-2.55834, -2.28825, -0.707107}}};
where coor
is the list of vertices of a polytope and edges
is the list of its edges. I would like to generate a Graphics3D whose back edges are dashed, and those front are solid. I have previously tried this solution, but it doesn't work as I only use lines and vertices, and no surface (this solution gives me only solid edges).
My second approach was to separate the space into two regions and to classify the edges as if they were in front of or behind a plane. The edges that cross this plane are cut to give a dashed edge and a solid edge. Here is the code and the result obtained for the given lists:
pointOfView = {1.2728823621935175, -2.3966390529217407, 2.021358885014492};
frontList = {};
backList = {};
sorter[edge_, region_, plan_] :=
Module[{pt1Member = RegionMember[region, edge[[1]]],
pt2Member = RegionMember[region, edge[[2]]], midpoint},
If[pt1Member != pt2Member,
midpoint = RegionIntersection[plan, Line[{edge[[1]], edge[[2]]}]][[1]],Indeterminate
];
Which[
pt1Member == pt2Member == False, AppendTo[frontList, edge],
pt1Member == pt2Member == True, AppendTo[backList, edge],
pt1Member == True && pt2Member == False, AppendTo[backList, {edge[[1]], midpoint}] && AppendTo[frontList, {edge[[2]], midpoint}],
pt1Member == False && pt2Member == True, AppendTo[frontList, {edge[[1]], midpoint}] && AppendTo[backList, {edge[[2]], midpoint}]
];
];
splitEdges[list_, ptOfView_] :=
Module[{backRegion = HalfSpace[ptOfView, {0, 0, 0}], midplan},
midplan = RegionBoundary[backRegion];
Do[sorter[list[[i]], backRegion, midplan], {i, Length@list}];
];
splitEdges[edges, pointOfView];
Graphics3D[{Point[coor], {Dashed, Line[backList]}, {Thickness[0.003],
Line[frontList]}}, ViewPoint -> pointOfView, Boxed -> False]
The result is almost perfect, but I had not thought to edges behind the plan, but not behind the polytope (see the edge designated by the red arrow).
So I appeal to your lights. Would anyone have an idea of how I could succeed in making these graphics without surfaces? I cannot use PolyhedronData
because I have to stay general and my inputs are lists of vertices and edges.