Plane from 3 Points

Jul 6, 2012 at 12:52pm
I've got two classes:

class vector3d{
double x;
double y;
double z;
};

class plane{
double d;
//defined with normal Vector;
vector3d normal;
};

But I've got no Idea how i can make a plane out of 3 Ponits

According to a few tutorials, I'd have to transform them to the Parameter-Form
But I thought, that would be to complicated and I thought It should work faster.


Does anyone have an Idea?
Jul 6, 2012 at 1:13pm
You've got 3 points: A,B,C
make u = B - A
v = C - A


The normal of the plane is n_j = u x v = \epsilon_{jkl} u_{k} v_{l}
To compute d, just take a point that you know it is in the plane and solve
n_{j} P_{j} = d
Last edited on Jul 6, 2012 at 1:14pm
Jul 6, 2012 at 1:17pm
Sorry, but I don't get it.

What Values and Data types are u_j, C_j,...

could you explain it a bit more understandable I'm not really god at Geometry.
Last edited on Jul 6, 2012 at 1:22pm
Jul 6, 2012 at 1:38pm
You can define an infinite plane (i.e. a piece of paper of infinite size) with two pieces of information.

1) A point anywhere on the plane.

2) The direction of a line at right angles to the axes of the plane.

For example, take a big flat piece of cardboard. Lay it on the ground. Pretend it's infinite in size. This is your plane. If you tell anyone else the location of any point on that plane, and a direction that is at right angles to the two axes of that plane (i.e. in this case you can say "straight up" or "straight down"), you have given them a complete description of the plane.

So, now imagine that you lift up that cardboard sheet, one cm. Still flat - you've just lifted the whole thing one cm. Now, the direction you tell is still "straight up" or "straight down", but whatever point you used before have changed its location 1 cm, so if you tell this new information to someone, they can completely recreate this plane - they have a complete description of it.

Think a bit more about all the ways you could hold this sheet up, or even do it with an actual sheet of paper, and convince yourself that those two pieces of information (a point anywhere on the plane, and the direction that is at right angles to both axes of the plane) are all you need to completely define the plane.

When you're happy with that, come back, and we'll put that on a mathematical footing that you can use. The idea is that you will be able to nominate any point in the universe, and mathematically decide if that point is or is not on the plane.
Last edited on Jul 6, 2012 at 1:49pm
Jul 6, 2012 at 2:17pm

Thanks, I think I understand it now completely after I read this.

But I still I don't get this part of your Code above:

The normal of the plane is n_j = u x v = \epsilon_{jkl} u_{k} v_{l}
To compute d, just take a point that you know it is in the plane and solve
n_{j} P_{j} = d


I don't know about the Variables, I mean what type are they, or what do they represent.
I know this sounds stupid, but could you please explain this part a bit easier?






Jul 6, 2012 at 2:21pm
That's not me. If you want that explained, you'll have to wait for ne555 to come back.
Jul 6, 2012 at 2:26pm
sorry I din't notice :)
Jul 6, 2012 at 3:01pm
So, you've got a point (with an x, a y and a z coordinate). You've got a vector, which you can think of as a line extending from that first point we just defined, going to another point (with an x, a y and a z coordinate) in space somewhere (which is not on the plane).

This defines your plane. The vector can be thought of as three numbers - the difference between the points.

Let's say your point is zero, zero, zero, and the line goes straight up from there to zero, zero, one. The vector is thus described by (0,0,1) - each value is just the difference between the starting location and the ending location. It doesn't matter how long the line is.

Let's say your point is seven, four, twelve, and the line goes from there to eight, one, fifteen. The vector is thus described by (1, -3, 3).

Now pick any other point in the universe (we'll call this the candidate point, because it's a candidate for being on the plane). Calculate a new vector; the difference in position between this new point, and our original first point above. So now we have two vectors.

There is an operation we can do to these two vectors, and if the answer is zero, then the candidate point is on the plane. The operation is called the dot product1.

Given our two vectors, (x1, y1, z1) and (x2, y2, z2), the dot product is simply x1*x2 + y1*y2 + z1*z2

And that's it. You can now define a plane, and then decide if any other point in the universe is on that plane or not.

If you're doing this in a programme, you have to accept that due to the limitations of precision, you'll have to decide on a tolerance (i.e. decide that any answer really close to zero is "on the plane", and then come up with a sensible value for "really close").

I have done this off the top of my head without checking it, so I can't guarantee it at the moment :)


I can do something similar with a plane defined by three points rather than one point and a vector, if that's more useful to you.

-------------------------------------------

1. In 3D space, the dot product can be thought of as a measure of how much any two vectors are pointing in the same direction. If the dot product of two vectors is zero, they are at right angles to each other. When thought in terms of a plane, this means that if our first vector is at right angles to the plane, and the second vector is at right angles to the first vector, then the second vector must by lying on the plane - so the point it is pointing to is on the plane.


Last edited on Jul 6, 2012 at 3:29pm
Jul 6, 2012 at 4:16pm
I'll try again.

You've got 3 points: A,B,C
They can be represented as vectors that start in the origin.

Now try to calculate 'a direction that is at right angles to the two axes of that plane'
But first we need the 'two axes of that plane'.
That's easy. You could think that the 3 points are the vertex of a triangle, take two sides of that triangle as the axes.
So the axes are
u = B-A
v = C-A
(again, vectors)

To compute one perpendicular to the others use cross product http://en.wikipedia.org/wiki/Cross_product#Matrix_notation


Well, you've got the "direction" of the plane, but you don't know where it is. The idea is to "lift" a plane in that direction until coincides with the one that you want.
Then you store that distance.

Or looking it in another way. With the direction you represent infinite planes, according to how much you "lift" it.
All the points in the space are in one of those planes.
¿Which one? To know that, you simply need to know how much distance you travel in that direction. You need to do a projection http://en.wikipedia.org/wiki/Vector_projection


I used summation convention, repeated sub-indexes means to sum over that index.
It doesn't matter
1
2
normal = cross_product( b-a, c-a )
distance = dot_product( normal, P ) //P is a point in the plane, like a, b or c 

Also note that there is no need to use unit vectors.
Jul 6, 2012 at 4:30pm
Thanks to both off, it helped a lot,I think I really got it know.

nice weekend!
Jul 6, 2012 at 6:09pm
closed account (o1vk4iN6)
Also note that there is no need to use unit vectors.


There is...

 
normal = normalize( cross_product( b-a, c-a ) )


As (b - a) and (c - a) are not unit vectors the result needs to be normalized.
Jul 6, 2012 at 9:49pm
¿What for? you only care about the direction.
Testing if a point is in the plane (or to which side it is) it's just a comparison, equivalent to sign()

Also, even if (b-a) and (c-a) were unit vectors, the cross product may not.
Jul 6, 2012 at 10:49pm
closed account (o1vk4iN6)
There are more situations than just testing which side a point is on, which require the plane to be normalized. I also don't see why you would call it normal and not normalize it. Why not name it direction instead ? What would the angle of reflection be using this plane ? What would the distance from this plane to a point be ? etc...

Also yes, my mistake, should normalize regardless if the input are unit vectors or not.
Last edited on Jul 6, 2012 at 11:09pm
Jul 6, 2012 at 11:34pm
I call it `normal' because it's perpendicular to the other two.

¿which is the `traditional' way?
dot( normal, (P-P_0) ) \approx 0
dot( normal, P ) - distance \approx 0

Both work irregardless of the magnitude.

What would the angle of reflection be using this plane ?
What would the distance from this plane to a point be ?
Good.
I may want a `weighted' distance, or just comparison.
Topic archived. No new replies allowed.