Point in a Plane

Started by
1 comment, last by mmrpg 24 years, 1 month ago
I was wondering if there is a scaled down formula for finding a vector in a plane. If I know for instance that my plane is defined by 3 vectors V1=(0,0,0) V2=(4,0,0) V3=(0,4,4) And I know part of the information for the point i want to test P1=(2,A,2) How can I get the value of A that will make the vector be in the same plane as (V1,V2,V3) -
Advertisement
Theory : 2 not parallel vectors define a plane (in general 3 vector does not define a plane)
3 not aligned points define a plane

I suppose you mean : I've 3 points (P1,P2 and P3) and I want find the plane

How to compute the plane

plane : ax + by + cz + d = 0

where (a,b,c) is the normal of the plane defined as

normal = (a,b,c) = v1 x v2 (cross product)
v1 = P3 - P1
v2 = P2 - P1
d = - normal * P1 (dot product)

note that if normal = 0 -> v1 and v2 are parallel
-> P1,P2 and P3 are aligned and they does not define any plane!

If you have a point P = (x,y,z) and you want to find the distance from P to the plane...

dist (P,plane) = (normal * P + d)/lenght(normal)
lenght(normal) = sqrt (a*a+b*b+c*c)

if (dist==0) then A is on the plane

If you know some info about the point you can solve the equation

i.e. P = (2,y,2)
-> y = -(a*2+c*2+d)/b
-> P lies on the plane




Edited by - Andrea on 3/11/00 12:03:05 PM

Edited by - Andrea on 3/11/00 12:04:46 PM
IpSeDiXiT
heres how my code looks:

Dim normal As D3DVECTOR
normal = VCross(MapStruct(tempx,tempZ).points(0),
MapStruct(tempx, tempZ).points(1))

Dim d As Single
d = VDot(normal, MapStruct(tempx, tempZ).points(0))

ReqY = (normal.X * CNT + normal.z * CNT + d) / normal.Y

in that code first i produce the normal with VCross
then I get the dot product
then I try to find the Y value of a given x,z, value which is CNT variable.

I put this in and i get division by zero errors. Is this what you mean by the above code ? or am I doing something wrong.

This topic is closed to new replies.

Advertisement