The perp dot product is a product between two vectors in two-dimensions, and is obtained by taking the dot product of one vector with the perpendicular of the other. The perpendicular is simply a vector at right angles to the vector it is based on with the same magnitude. It is obtained by rotating through 90° or π/2 radians, or by multiplying by the complex number

*i*in the complex plane.

This can be illustrated with a simple vector class (although I would not use a class myself for performance reasons):

class Vec2D { var fX:Number; var fY:Number;

function Vec2D(_x:Number, _y:Number) {fX = _x; fY = _y;}

` function Perp():Vec2D {`

` return Vec2D(-fY, fX);`

}

}

The perp dot product is then the dot product of one vector with this perp vector. That is, as member functions

function Dot(v2:Vec2D):Number {

` return fX * v2.fX + fY * v2.fY;`

}

function PerpDot(v2:Vec2D):Number {

` return Perp().Dot(v2);`

}

` // version with the operations inlined`

function PerpDot(v2:Vec2D):Number {`return -fY * v2.fX + fX * v2.fY;`

}

*v*

_{1}

*v*

_{2}sin

*θ*,

*v*

_{1}and

*v*

_{2}are the vector lengths and

*θ*is the angle between the vectors, and is the area of the parallelogram with the vectors as two sides, and so twice the area of the triangle formed by the two vectors.

It is closely related to the dot product which has value

*v*

_{1}

*v*

_{2}cos

*θ*. Together they form a complex number which if normalised can be used as the rotation between the vector directions. And as already noted they can be passed to atan2 to accurately get the signed angle between the vectors.

The perp dot product is the two-dimensional equivalent of the cross product in three dimensions, although in many ways it is more useful as it more immediately relates to the dot product and rotations. It is something everyone doing two-dimensional geometry should be aware of.

## No comments:

## Post a Comment