Re: Intersection of a plane and a line
- From: John D'Errico <woodchips@xxxxxxxxxxxxxxxx>
- Date: Tue, 16 May 2006 01:58:03 GMT
In article <ellieandrogerxyzzy-1505061833310001@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
ellieandrogerxyzzy@xxxxxxxxxxxxxxxxxxxxxx (Roger Stafford) wrote:
In article <ef352a3.-1@xxxxxxxxxxxxxxxx>, Danny <the_dan168@xxxxxxxxxxx>
wrote:
Hi,--------------------------
I'm trying to find intersection between a plane and a line. The
equation of the line is known, but the plane is imported from a CAD
file, i.e. the geometry of it may be quite complexed.
For example, I have a line somewhere in the space (I know the
equation of the line), and the line may be travelling towards a
sphere (I know where the sphere is located in the space, but don't
know the geometry of it), and I need to know where the line and the
surface of the sphere first intersects. This can be done analytically
if I know the geometry of the object, but since the geometry of the
target object will be unknown (different for each scenario), I'm
thinking I'll probably need a numerical approach for this?
You are posing two different problems here, the intersection of a line
with a plane, and the intersection of a line with a sphere. The one
intersection is in general a single point but the other can have two
points.
For the first, any line in three dimensions takes two equations to
specify it, while a plane requires one equation. Finding the point of
intersection simply means finding the simultaneous solution to all three
equations. For that you will find either Cramer's rule or matlab's
backslash operator, '\', very useful.
Actually, there is a simpler solution. Define a plane
by a point (P0) on the plane, and the normal vector
(N) to the plane. Thus a point X is on the plane
P if
dot(X-P0,N) == 0
This applies in any number of dimensions of course,
as P0 and N are vectors.
A line in any number of dimensions can be defined
parametrically by two points, represented by the
vectors Q1, Q2.
Q(t) = Q1 + t*(Q2-Q1)
Any point on the line can be represented using some
value of t. Of course, this too works in any number
of dimensions.
So we can solve for the value of our parameter t,
such that Q(t) lies in the plane P. Expanding the
dot product,
dot(Q1 + t*(Q2-Q1) - P0, N) == 0
we find the scalar parameter t as
t = dot(P0-Q1,N)/dot(Q2-Q1,N)
Given t, its now trivial to find the intersection
point.
Of course, this requires that the vectors Q2-Q1 and
N are not orthogonal. But if they are orthogonal,
then no unique solution existed in the first place.
HTH,
John D'Errico
--
The best material model of a cat is another, or preferably the same, cat.
A. Rosenblueth, Philosophy of Science, 1945
Those who can't laugh at themselves leave the job to others.
Anonymous
.
- References:
- Intersection of a plane and a line
- From: Danny
- Re: Intersection of a plane and a line
- From: Roger Stafford
- Intersection of a plane and a line
- Prev by Date: Re: Intersection of a plane and a line
- Next by Date: How to select wanted elements from a cell?
- Previous by thread: Re: Intersection of a plane and a line
- Next by thread: Re: Intersection of a plane and a line
- Index(es):
Relevant Pages
|