plane vectors from two points

Started by
0 comments, last by haegarr 16 years, 6 months ago
If I subtract two points to acquire a direction vector for use in a plane I get strange results when projecting, like (2,3.0) - (-5,7,8). I figured out that by only using the second point or direction as such that the plane projection would work, for example direction - 0,0,0(origin) which isn't really subtracting anything. It makes some sense but I don't understand fully.... and would like. I have ended up doing the projection then displacing it to the location I require it... I hope this made sense. Thanks in advance. -M@
Advertisement
I'm not sure whether I understand your problem, so please be patient with my answer.

Projecting a direction vector onto a plane just yields in another direction vector. Since direction vectors have no start or end but a direction and length only, you could not expect it to occur at any _position_.

The correspondence is as follows: The difference of 2 position vectors yields in a direction vector (as you've stated correctly). Projecting the both points onto a plane and computing the difference of the projected points yields in the same direction vector as projecting the original difference vector onto that plane.

Projecting a point V onto a plane P
P := { O n }
where O denotes any point on the plane (e.g. its "origin") and n the plane's normal (orthogonal and of unit length), one would do
VP := V - n * ( n . ( V - O ) )
what actually computes the shortest difference vector from the plane to V and subtracts that from V. That means
a position = a position - a direction * a scalar
where
a scalar = a direction . a direction
so all is okay.

EDIT:
If, on the other hand, you are computing a difference vector d first and want to project that, you have to go a slightly other way:
dP := d - n * ( n . d )
what means
a direction = a direction - a direction
what is also okay.

The difference of these two ways if looking at the formulas (e.g. assuming you are using a vector implementation that doesn't distinguish between positions and directions) is in the right term of the dot-product. Perhaps that is the pitfall you're trapped in?

This topic is closed to new replies.

Advertisement