1. 3d math
- Posted by Molasses <molasses at ALPHALINK.COM.AU>
Jul 17, 1999
-
Last edited Jul 18, 1999
Hi,
Does someone know how to calculate if a point exists on a 3d line?
e.g..
I have 2 points that make a line : {x1, y1, z1} and {x2, y2, z2}
and I want to see if the point {x3, y3, z3} exists on that line.
Thanks,
-molasses
2. Re: 3d math
In a message dated 7/17/99 5:02:41 AM Central Daylight Time,
molasses at ALPHALINK.COM.AU writes:
<< Hi,
Does someone know how to calculate if a point exists on a 3d line?
e.g..
I have 2 points that make a line : {x1, y1, z1} and {x2, y2, z2}
and I want to see if the point {x3, y3, z3} exists on that line. >>
Using calculus, you can find the change in one as another element changes,
to see if the point falls on that slope. For example, say the given points
are A and B, and the point in consideration is C:
A = { 10, 4, 7}
B = { 6, 6, 3}
C = { 8, 5, 5}.
Make the first step be to find the change in y over the change in x for the
end points:
(y1 - y2/x1 - x2)
(4-6/10-6) = -1/2
Now, find the slope like above, but use only one of the endpoints and point
C.
(4-5)/10-8) = -1/2.
Since the slopes are equal, then so far this point does lies in the line.
Repeat the process above using change in z over change in x. If the slopes
are equal again, then the point lies in the line. Here is the function that
I just tested, so it works. A return of 1 means it's one the line, 0 means
false:
function CheckPoint(sequence pt1, sequence pt2, sequence point)
atom dydx, dzdx, answer
answer = ( pt1[2] - pt2[2] ) / ( pt1[1] - pt2[1] )
dydx = ( pt1[2] - point[2] ) / ( pt1[1] - point[1] )
if answer != dydx then
return 0
else
answer = ( pt1[3] - pt2[3] ) / ( pt1[1] - pt2[1])
dzdx = ( pt1[3] - point[3] ) / ( pt1[1] - point[1] )
if answer != dzdx then
return 0
else
return 1
end if
end if
end function
Derek Brown
3. 3d math
I'm hoping someone here can help, as 3d math has always confused me.
Given an origin point {0,0,0}, an unknown destination point {x,y,z}, a
known distance d, and 2 out of 3 angles xy, yz, xz known and validated,
how can the destination point {x,y,z} be determined?
In 2D math, this is very simple:
x = d * sin(rad(xy))
y = d * cos(rad(xy))
where xy is in degrees, rad(v)= (2 * PI * v) / 360, and 0 degrees is
defined as {0,y}.
I just don't know how to apply this to three dimensions to get a
consistently accurate solution.
TIA,
Michael J. Sabal
4. Re: 3d math
Michael J. Sabal wrote:
>
>
> I'm hoping someone here can help, as 3d math has always confused me.
>
> Given an origin point {0,0,0}, an unknown destination point {x,y,z}, a
> known distance d, and 2 out of 3 angles xy, yz, xz known and validated,
> how can the destination point {x,y,z} be determined?
>
> In 2D math, this is very simple:
> x = d * sin(rad(xy))
> y = d * cos(rad(xy))
>
> where xy is in degrees, rad(v)= (2 * PI * v) / 360, and 0 degrees is
> defined as {0,y}.
>
> I just don't know how to apply this to three dimensions to get a
> consistently accurate solution.
>
> TIA,
> Michael J. Sabal
>
x = r*cos(phi)*cos(theta)
y = r*sin(phi)*cos(theta)
z = r*sin(theta)
phi counts from +x axsis over +y axis and so on from 0 to 2*pi.
theta counts from x/y plane perpendicular to +z axis from 0 to +pi/2,
to -z axis from 0 to -pi/2.
Have a nice day, Rolf
-----------------------------------------------------
| Dr.Rolf Schröder | E B |
| DESY MST-1 | C |
| Notkestraße 85 | D |
| D-22603 Hamburg | A |
| Earth |--------------------------------|
| Solar System | Phone : +49-40-8998-2628 |
| Milky Way | Fax : +49-40-8994-2628 |
| Local Group | mailto:Rolf.Schroeder at DESY.de |
| Known Universe | http://desyntwww.desy.de/~rolf |
-----------------------------------------------------
5. Re: 3d math
Thank you! That's exactly what I need.
>>> guest at RapidEuphoria.com 05/26/2004 10:04:21 AM >>>
x = r*cos(phi)*cos(theta)
y = r*sin(phi)*cos(theta)
z = r*sin(theta)
phi counts from +x axsis over +y axis and so on from 0 to 2*pi.
theta counts from x/y plane perpendicular to +z axis from 0 to +pi/2,
to -z axis from 0 to -pi/2.
Have a nice day, Rolf
6. Re: 3d math
--0-1754781795-1085581232=:17279
Dear Michael
If I understand you correctly, the problem you are having seems to be
one of convention rather than of math. The 2 known angles each
determine a position in the plane defined by their respective axes
e.g. the xy angle defines a point in the x,y plane which gives you the
x and y positions of your "destination point". As you rightly point
out, 2 such angles are enough to define your "destination point".
To make this all consistent, you need to define the "hand" of your
cartesian reference frame and of the rotations around its respective
axes. A "right-handed" reference frame could be defined as follows ...
... drawn on a sheet of paper with x and y in the conventional
orientations (x increases from left to right, y increases from the
bottom of the page to the top) it will have z increasing into the page
(by this convention, the corresponding "left-handed" reference frame
has z increasing out of the page).
Once you have defined the hand of your reference frame, the rotations
are defined around each axis with respect to the axial direction e.g.
looking in the direction of increasing z, a positive angle of rotation
in the xy plane corresponds to a counter-clockwise rotation around z.
The convention you choose is arbitrary if your 3D system is standalone
and self-contained and if your calculations are not going to be
compared with other 3D systems that may have their own conventions
(such as e.g. GPS data). If you choose and maintain such a convention
for your 3D system, you should get consistent answers for your
calculations.
I hope I understood your problem correctly and that this is helpful.
Best
Gordon
"Michael J. Sabal" <guest at RapidEuphoria.com> wrote:
I'm hoping someone here can help, as 3d math has always confused me.
Given an origin point {0,0,0}, an unknown destination point {x,y,z}, a
known distance d, and 2 out of 3 angles xy, yz, xz known and validated,
how can the destination point {x,y,z} be determined?
In 2D math, this is very simple:
x = d * sin(rad(xy))
y = d * cos(rad(xy))
where xy is in degrees, rad(v)= (2 * PI * v) / 360, and 0 degrees is
defined as {0,y}.
I just don't know how to apply this to three dimensions to get a
consistently accurate solution.
TIA,
Michael J. Sabal
:::::::::: Gordon Webster ::::::::::
--0-1754781795-1085581232=:17279
Content-Type: text/html; charset=us-ascii
<DIV>Dear Michael</DIV>
<DIV> </DIV>
<DIV>If I understand you correctly, the problem you are having seems
to be one of convention rather than of math. The 2 known angles each
determine a position in the plane defined by their respective axes
e.g. the xy angle defines a point in the x,y plane which gives you the
x and y positions of your "destination point". As you rightly point
out, 2 such angles are enough to define your "destination point".</DIV>
<DIV> </DIV>
<DIV>To make this all consistent, you need to define the "hand" of
your cartesian reference frame and of the rotations around its
respective axes. A "right-handed" reference frame could be defined as
follows ...</DIV>
<DIV> </DIV>
<DIV>... drawn on a sheet of paper with x and y in the conventional
orientations (x increases from left to right, y increases from the
bottom of the page to the top) it will have z increasing into the page
(by this convention, the corresponding "left-handed" reference
frame has z increasing out of the page).</DIV>
<DIV> </DIV>
<DIV>Once you have defined the hand of your reference frame, the
rotations are defined around each axis with respect to the axial
direction e.g. looking in the direction of increasing z, a positive
angle of rotation in the xy plane corresponds to a counter-clockwise
rotation around z. </DIV>
<DIV> </DIV>
<DIV>The convention you choose is arbitrary if your 3D system is
standalone and self-contained and if your calculations are not going
to be compared with other 3D systems that may have their own
conventions (such as e.g. GPS data). If you choose and maintain such a
convention for your 3D system, you should get consistent answers for
your calculations.</DIV>
<DIV> </DIV>
<DIV>I hope I understood your problem correctly and that this is
helpful.</DIV>
<DIV> </DIV>
<DIV>Best</DIV>
<DIV> </DIV>
<DIV>Gordon</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR><B><I>"Michael J. Sabal"
<guest at RapidEuphoria.com></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="BORDER-LEFT: #1010ff 2px solid;
MARGIN-LEFT: 5px; PADDING-LEFT: 5px">============ The Euphoria Mailing
List ============ <BR><BR><BR>posted by: Michael J. Sabal <M_SABAL
yahoo.com at><BR><BR>I'm hoping someone here can help, as 3d math has
always confused me.<BR><BR>Given an origin point {0,0,0}, an unknown
destination point {x,y,z}, a<BR>known distance d, and 2 out of 3
angles xy, yz, xz known and validated,<BR>how can the destination
point {x,y,z} be determined?<BR><BR>In 2D math, this is very
simple:<BR>x = d * sin(rad(xy))<BR>y = d * cos(rad(xy))<BR><BR>where
xy is in degrees, rad(v)= (2 * PI * v) / 360, and 0 degrees is
<BR>defined as {0,y}.<BR><BR>I just don't know how to apply this to
three dimensions to get a<BR>consistently accurate
solution.<BR><BR>TIA,<BR>Michael J.
Sabal<BR><BR>--^----------------------------------------------------------------<BR>This
email was sent to: gwalias-bb at yahoo.com<BR><BR>EASY UNSUBSCRIBE click
here:
http://topica.com/u/?b1dd66.b7HXOn.Z3dhbGlh<BR>Or send an email to:
EUforum-unsubscribe at topica.com<BR><BR>For Topica's complete suite of
email marketing solutions
visit:<BR>http://www.topica.com/?p=TEXFOOTER<BR>--^----------------------------------------------------------------<BR></BLOCKQUOTE><BR><BR>::::::::::
Gordon Webster ::::::::::
--0-1754781795-1085581232=:17279--