Re: Intersection of a plane and a line



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
.



Relevant Pages

  • Re: Intersection of a plane and a line
    ... with a plane, and the intersection of a line with a sphere. ... As to the sphere, one method is to use the equations of the line ... means for expressing two cartesian coordinates in terms of the ...
    (comp.soft-sys.matlab)
  • Re: Intersection of a plane and a line
    ... I'm trying to find intersection between a plane and a line. ... sphere (I know where the sphere is located in the space, ... means for expressing two cartesian coordinates in terms of the third one ...
    (comp.soft-sys.matlab)
  • Re: Geometry with locus...
    ... Line L is tangent to this sphere. ... Let P be the intersection point between L and xy-plane. ... The locus of point P is a parabola. ... A cone intersects a plane in a parabola when only one line in the ...
    (sci.math)
  • Re: Differential geometry problem
    ... where [kappas are principal curvatures and si is angle between arc ... the normal plane. ... intersection curve can stand alone in space with tau,kappa properties ... differ only by a constant in the normal plane, ...
    (sci.math)
  • Intersection of a plane and a line
    ... I'm trying to find intersection between a plane and a line. ... i.e. the geometry of it may be quite complexed. ... sphere (I know where the sphere is located in the space, ...
    (comp.soft-sys.matlab)