tags:

views:

496

answers:

4

I have a 3D Plane defined by two 3D Vectors:

  • P = a Point which lies on the Plane
  • N = The Plane's surface Normal

And I want to calculate any vector that lies on the plane.

+3  A: 

Take any vector, v, not parallel to N, its vector cross product with N ( w1 = v x N ) is a vector that is parallel to the plane.

You can also take w2 = v - N (v.N)/(N.N) which is the projection of v into plane.

A point in the plane can then be given by x = P + a w, In fact all points in the plane can be expressed as x = P + a w2 + b ( w2 x N ) So long as the v from which w2 is "suitable".. cant remember the exact conditions and too lazy to work it out ;)

If you want to determine if a point lies in the plane rather than find a point in the plane, you can use

x.N = P.N

for all x in the plane.

Michael Anderson
This is very close to what I want. But not quite, see what I'm looking for would give me a Vector the lies on the same plane every time. I don't care what direction the Vector is going on the plane, just that ever Vector that is generated DOES lie on the same plane. As it stands, the plane that the resulting Vector lies on is dependent on the value of V (the non-parallel Vector for the cross-product) Unless of course I've misunderstood you.
Adam
Come to think of it. I don't think this is correct at all. The resulting vector is entirely dependent on V and has nothing to do with the plane implicitly.
Adam
Yes You need second vector to generate plane. Now You have only line that belongs to that plane.
Maciek Sawicki
To get all points in the plane you need two independent vectors, parallel to the plane.The first can be w1 = v x N for nearly any v.w1 is parallel to the plane as it is perpendicular to the normal N, due to properties of the cross product.The second vector is w2 = w1 x N which is perp. to N due to properties of the cross product. It is also perp. to w1 and therefore linearly independent to w1.Since we have two vectors par. to the plane x = P + a w1 + b w2 gives all points in the plane as we vary a and b.There's some subtle issues about choosing v that I have left out for brevity.
Michael Anderson
Similarly to my above comment you could also take w1 and w2 to bew1 = i - N (i.N)/(N.N)andw2 = j - N (i.N)/(N.N)Where i and j are the unit vectors in the x and y directions.BOth w1 and w2 are both to the plane sincew1.N = i.N - N.N (i.N)/(N.N) = 0andw2.N = j.N - N.N (j.N)/(N.N)=0(If one of these vectors turns out to be zero you can then replace it with k.N - N.N (k.N)/(N.N) )Then the plane is given by x = P + a w1 + b w2 and varying a nd b will give you all points in the plane.
Michael Anderson
Brilliant! I will try this out later today, thanks for all your help :D I had an idea on how to find a vector a bit more algorithmically, tell me what you think: 1) Pick a random point (PT), check if it's on the plane (P), if so, fine, done. 2) If not, test which side of the plane it is on, drop a ray (R) toward the plane using P's normal (N) for direction 3) Intersect R with P resulting in point (PT'), a point which exists on P and there ya go! From PT' I can generate a Vector which lies on P, and I'm golden.
Adam
That is essentially what the second version does, replace i and j with random vectors. All it avoids is adding and subtracting P a couple of times - which results in slightly neater maths.
Michael Anderson
Just coded it up and it works perfectly, thanks a million!
Adam
+1  A: 

If N = (xn, yn, zn) and P = (xp, yp, zp), then the plane's equation is given by:

(x-xp, y-yp, z-zp) * (xn, yn, zn) = 0

where (x, y, z) is any point of the plane and * denotes the inner product.

3lectrologos
+1  A: 

And I want to calculate any vector that lies on the plane.

If I understand correctly You need to check if point belongs to the plane?

http://en.wikipedia.org/wiki/Plane_%28geometry%29

You mast check if this equation: nx(x − x0) + ny(y − y0) + nz(z − z0) = 0 is true for your point.

where: [nx,ny,nz] is normal vector,[x0,y0,z0] is given point, [x,y,z] is point you are checking.

//edit Now I'm understand Your question. You need two linearly independent vectors that are the planes base. Sow You need to fallow Michael Anderson answerer but you must add second vector and use combination of that vectors. More: http://en.wikipedia.org/wiki/Basis_%28linear_algebra%29

Maciek Sawicki
I don't want to check if a point is on a plane, I want to simply generate any point which does exist on the plane.
Adam
It will be "a lot" of them ;)
Maciek Sawicki
True, but I can't just begin plugging in values and testing.
Adam
A: 

I think this question should belong to http://mathoverflow.net/.

Julio