Loading...
Logo
Processing Forum

convert 4D to 3D

in General Discussion  •  Other  •  4 months ago  


Hello,

I am doing some crazy math stuff and just wanted to ask when I have a 4D-point (or point cloud), how I can convert it into 3D? It's like a projection from 4D space into 3D space. We talking Euklid here not Einstein of course.

Thanks!

Greetings, Chrisir    

Replies(6)

Re: convert 4D to 3D

4 months ago
converting 4d to 3d is the same as converting 3d to 2d, only one dimension louder.

simplest 3d to 2d case is using orthogonal projection and just ignoring z, you can do the same with 4d to 3d, just drop the last coord.

perspective transforms are the same, reduce the first three dimensions proportional to 1 / the fourth.

i did this a while ago, only i went with 5d...
http://www.flickr.com/photos/31962137@N00/3515741356/in/photostream/


Re: convert 4D to 3D

4 months ago

just to drop a coordinate doesn't seem to be very exact

What is then the proper projection?

Such as

Copy code
  1. Vec3D.x=Vec4D.x;
  2. Vec3D.y=Vec4D.y;
  3. Vec3D.z=Vec4D.z * Vec4D.q;

?

Thank you!

     
is q the name of your 4th coordinate?

what do you use for 3d perspective transform?

i don't have the above code available at the moment, but generally
( https://en.wikipedia.org/wiki/Transformation_matrix#Perspective_projection)
x' = x / z
y' = y / z.
(assuming the origin as the center of projection, and z = 1 as the image plane, which is almost definitely not the case)

expanding this to 4d is, trivially:
x' = x / q
y' = y / q
z' = z / q

Re: convert 4D to 3D

4 months ago


hello,

Thank you!


is q the name of your 4th coordinate?
Yes, I just chose q as the name for the 4th dimension.
Is there a name used regularly / mostly?


what do you use for 3d perspective transform?
I am not sure if I understand the question. For 3D I just use
  • box or shape or line or point
which are all 3D in processing. I don't do a perspective transform. Processing does it for me.

But you helped me a lot with that formula.

Thank you!

Greetings, Chrisir    

Re: convert 4D to 3D

4 months ago
i found the code, but it's a bit messy and might not help much

applet - http://www.koogy.clara.co.uk/processing/five_d/
code - http://www.koogy.clara.co.uk/processing/five_d/FiveD.pde

i used
x' = x * DEPTH / (DEPTH - w)
rather than x' = x / z mentioned above as it's a bit friendlier, lets you play with camera distance.

(i used w, x, y, z for coords in 4d and v, w, x, y, z in 5d and reduced everything to y (across) and z (up) before plotting (i used P2D) which is a bit odd, but they are only names)