#transform 3D coordinates into 2D coordinates to make a 3D viewer
11 messages · Page 1 of 1 (latest)
Hello, i try to make a 3d viewer in lua but for each solution i found, it doesn't work but i don't know if it's cause i'm bad in programming or in math.
to solve this problem i used a lot of manner but today i tried something very different and i know that it's not the best way to solve this problem but i want to know if it might work for you.
here the situation :
a : the cam angle angle whish can change
E : distance with the screen
P : the point whish we know the coordinates
P' : the point perpendicular to the line passing through P
We have also C at the cam's coordinates but we neglect it for the moment
to solve this problem i see the (P'O) line as a linear function and the (PP') line as the reverse of the first function but this one is an affine function.
the first function is determinate by :
f(x) = (sin(a) / cos(a)) × x
and the second one by :
g(x) = -(cos(a) / sin(a)) × x + (cos(a) / sin(a)) × P.z + P.x
then, to find P' z coordinate i used f(x) = g(x)
whish makes :
P'.z = ((cos(a) / sin(a)) × P.z + P.x) ((cos(a) × sin(a)) / sin(a)² + cos(a)²)
i used g(P'.z) to find P'.x :
P'.x = -(cos(a)/sin(a)) (P'.z - P.z) + P.x
then searched [PP'] and [CP'] :
[PP'] = √((P'.z - P.z)² + (P'.x - P.x)²)
[CP'] = √(P'.z+P'.x)
Finally i used thales to find the side PP' of the reduced triangle :
x = CE × PP' / CP'
i know that 0 is a prohibited value for the angle
I've done this using Excel to render 3D images in a 2D chart such as you're doing on paper... I started with some equations I found online... is it not looking correct for you?
Found what I used... dunno if this helps
i want to do without internet i know that we have a lot of solution but when i try mine i see that they don't work and i don't know if it's because i'm not good to write calculation in lua or if it's my calculation whish is bad
*correction: used to plot 3D coordinates (OX, OY, OZ) as a 2D chart (Xr, Xy)
It's a complicated math... hat's off to you to try to solve it from scratch, that's way more involved than I care to assist, sorry!
ok np thank you anyway
Good luck.... found the source video I used too: https://www.youtube.com/watch?v=ou_vAxbTCmo
In this video I would like talk about how you can graph XYZ data in 3D using Microsoft Excel, specifically line, spline or scatter charts. This video will be covering one third party application that makes this task very simple and how you can accomplish this yourself using user defined formulas.
Application: Cel Tools
Application URL: http://w...
ok thanks for the help !