[ODE] Maths Stuff

Julien Chicoineau julien.chicoineau at enib.fr
Fri Apr 25 03:43:02 2003


Ander Taylor wrote:

>
> Hi All,
>
> I want to, given a vector and a plane that intersect, get the length 
> of the segments on either side of the plane.
>
> I need help : )
>
> Cheers,
>
> Ander
>
>
>
>
> _________________________________________________________________
> MSN Instant Messenger now available on Australian mobile phones. Go 
> to  http://ninemsn.com.au/mobilecentral/hotmail_messenger.asp
>
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode
>
Hi Ander,
well in fact, I guess that if you can know that a plane intersects a 
vector, you can know the lengths of its segments on either side of the 
plane... :-) let's do it :

you said that the vector and the plane are given, so i assume you know 
at least the vector's start point's (V2) and the vector's end point's 
(V1) coordinates, and the normal vector (N) of the plane.
as N is also a vector, you know its start point's (N2) and its end 
point's (N1) coordinates, and as it is a normal vector, i assume its 
length is 1!!!

N.B. : the vector's coordinates and the normal's coordinates must be 
expressed in the same coordinates system (i.e. either in the plane's 
coordinates system or in the world's coordinates system, but only one)

get v'1 = V1.N and v'2 = V2.N (these are the length for V1 and V2 along N)
--->(strictly, v'1 = ( V1 - N2 ) . ( N1 - N2 ) and v'2 = ( V2 - N2 ) . ( 
N1 - N2 ) in any coordinates system)

now get alpha = v'1 / (v'1 - v'2) and let's test it :
  if alpha > 1, then : there are no intersection between the vector and 
the plane
  if alpha = 1, then : the vector is in touch with the plane (common 
point is V2)
  if 0 < alpha < 1, then : the vector intersects with the plane, and { 
alpha * || V1 - V2 || } and { ( 1 - alpha ) * || V1 - V2 || } are the 
both lengths you looking for.
  if alpha = 0, then : the vector is in touch with the plane (common 
point is V1)
  if alpha < 0, then : there are no intersection between the vector and 
the plane

hope that will help you, and that i did not forgive any conditions... ;-)
Julien.