2

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)?

Michael E2
  • 235,386
  • 17
  • 334
  • 747
  • 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. – David G. Stork Dec 18 '18 at 02:54
  • @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. – Felix Garner Dec 18 '18 at 02:58
  • 1
    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. – halirutan Dec 18 '18 at 04:44
  • 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.. – Michael E2 Dec 18 '18 at 14:34

1 Answers1

1

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}  *)
Michael E2
  • 235,386
  • 17
  • 334
  • 747