Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

mmrpg

Point in a Plane

This topic is 6826 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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) -

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!