2
$\begingroup$

My minimal working example is

Graphics3D[Polygon[{{0, 0, 2}, {0, 3, 4}, {0, -1, 2}}]]

How can I plot the polygon I have listed above on a 2-dimensional plane (in a manner that preserves angles and distances)?

More generally, how can I project 2-dimensional polytopes embedded in n-dimensional Euclidean spaces onto a 2-dimensional plane while preserving their structures (all angles and distances)?

$\endgroup$
5
  • $\begingroup$ It is mathematically impossible to "preserve angles and distances" when projecting a three-dimensional figure onto a two-dimensional plane. Just think of the 8 vertexes of a cube, for instance. $\endgroup$ Commented Dec 18, 2018 at 2:54
  • $\begingroup$ @David G. Stork, when I stated "n-dimensional figures with 2-dimensional geometries", I essentially meant 2-dimensional polytopes embedded in n-dimensional spaces, with n some integer greater than 2. I have also clarified my original question to avoid confusion. $\endgroup$ Commented Dec 18, 2018 at 2:58
  • 1
    $\begingroup$ Your polygon lies in a 2d plane within the 3d space. What you probably want is to project your points along the normal of the plane that is spanned by the polygon. As David pointed out, this does not work in general but in your case this should do the trick. $\endgroup$
    – halirutan
    Commented Dec 18, 2018 at 4:44
  • $\begingroup$ MeshCellNormals might help. $\endgroup$
    – Michael E2
    Commented Dec 18, 2018 at 14:26
  • $\begingroup$ Also proj = NullSpace[N@listofnormals] will give you the projection matrix. Note it's important that the input be (approximate) Real numbers. If they're integers or other exact numeric quantities, then the rows of proj won't be orthonormal in general.. $\endgroup$
    – Michael E2
    Commented Dec 18, 2018 at 14:34

1 Answer 1

1
$\begingroup$

Here's an example of the process for a triangle embedded in 4D projected to 2D:

vv = {{0, 0, 2, 1}, {1, 3, 4, 1}, {0, -1, 2, 2}};
polyspan = Transpose[Transpose@Most[#] - Last[#] &@vv];
ns = NullSpace[polyspan];
proj = NullSpace[N@ns]
v2 = vv.Transpose@proj
(*
{{0.301572,  0.713143, 0.603143, 0.191571},                     (* proj. matrix *)
 {0.119657, -0.477775, 0.239314, 0.836745}}

{{1.39786, 1.31537}, {5.04515, 0.480333}, {0.876285, 2.62989}}  (* proj. vertices *)
*)

Check angles:

VectorAngle @@@ Subsets[Subtract @@@ Subsets[N@v2, {2}], {2}]
(*  {2.17359, 2.89059, 0.717003}  *)

VectorAngle @@@ Subsets[Subtract @@@ Subsets[N@vv, {2}], {2}]
(*  {2.17359, 2.89059, 0.717003}  *)

Check distances:

EuclideanDistance @@@ Subsets[Subtract @@@ Subsets[N@v2, {2}], {2}]
(*  {4.69042, 8.3666, 3.74166}  *)

EuclideanDistance @@@ Subsets[Subtract @@@ Subsets[N@vv, {2}], {2}]
(*  {4.69042, 8.3666, 3.74166}  *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.