Home Products Download Order Contacts

comp.graphics.algorithms

Subject: Re: line intersecting point in 3d



jaso wrote:
> Hi,
> I've read about the basics of vectors, but I still don't know
> how to find out if a line intersects a point in 3d space.

Lines don't really "intersect" points. They go through them. But
this will so rarely be the case for random inputs that you can
probably get away with always answering "no" without even looking at
the input. The few cases where it should have said "yes" are unlikely
to be noticed.

> If I have a ray starting at origin O, and travelling
> with vector V, how do I know if it hits point P?

> That is:

> Ray = O + Vt

Not quite. The ray is the set of all points formed by O + V*t.

> Point = P

So you want to know whether P is in that set. So see if you
can form P like that:

P = O + V*t

Elementary algebray transforms that to

(P - O) = V*t

Those are 3 equations (since these are 3-vectors) for a single unknown
(t). Which, if you paid attention in algebra class, will tell you
that odds are this equation will not hold: the system of equations is
over-determined. So you'll have to add some tolerance, making one or
both objects thicker so they get a non-negligeable chance of hitting
each other. I.e. you'll have to change the question to be about the
intersection between a line and a sphere, or a cylinder and a point.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Reply


View All Messages in comp.graphics.algorithms

path:
line intersecting point in 3d =>

Replies:
Re: line intersecting point in 3d

Copyright 2006 WatermarkFactory.com. All Rights Reserved.