## DAVector2 Class

Creates a Vector2 object. At any given time, the value of the object is a direction and length (magnitude), specified as a pair of coordinate values given as either Cartesian coordinates (x, y) or polar coordinates (XYangle, YZangle). The direction of the vector is parallel to the ray that starts at the origin and passes through the point specified by the vector's coordinates, and the length is the distance between the origin and the point.

Because coordinate values are animated numbers (DANumber objects), the direction and length of the Vector2 object can change over time as the values of the animated numbers change.

This class inherits from the DABehavior Class.

- DAVector2 Functions
- DAVector2 Properties
- Relevant Functions from the DAStatics Class
- Relevant Properties from the DAStatics Class

### DAVector2 Functions

DivAnim

Div

MulAnim

Mul

Normalize

Transform

####

DivAnim

DAVector2 Class

Creates a new two-dimensional DAVector2 object that points in the same direction as the original vector but has a length that has been divided by scalar.

vector2Obj.DivAnim(
scalar
)

##### Parameters

scalar
  A DANumber object used as the divider. This must be an animated number.

##### Return Values

Returns the DAVector2 object.

##### See Also

MulAnim

####

Div

Same as DivAnim except that scalar is a non-animated number (a double).

vector2Obj.Div(
scalar
)

####

MulAnim

Creates a DAVector2 object that points in the same direction as the original vector but has a length that has been multiplied by scalar.

vector2Obj.MulAnim(
scalar
)

##### Parameters

scalar
  A DANumber object used as the multiplier. This must be an animated number.

##### Return Values

Returns the DAVector2 object.

##### See Also

DivAnim

####

Mul

Same as MulAnim except that scalar is a non-animated number (a double).

vector2Obj.Mul(
scalar
)

####

Normalize

Creates a normalized, two-dimensional DAVector2 object. The normalized vector has the same direction as the original vector, but the length is 1.

vector2Obj.Normalize

##### Return Values

Returns the DAVector2 object.

####

Transform

Creates a DAVector2 object that is the result of applying the given transformation to the original vector. The translation elements of the transformation are ignored because translation does not apply to vectors.

vector2Obj.Transform(
xf
)

##### Parameters

xf
  A DATransform2 object.

##### Return Values

Returns the DAVector2 object.

##### Remarks

This function composes values. The resulting transformation is the new value applied to the old value.

### DAVector2 Properties

Length

LengthSquared

PolarCoordAngle

PolarCoordLength

X

Y

####

Length

A read-only property with a DANumber value that represents the length of a DAVector2 object.

vector2Obj.Length

##### See Also

LengthSquared

####

LengthSquared

A read-only property with a DANumber value that represents the length of a DAVector2 object squared.

vector2Obj.LengthSquared

##### See Also

Length

####

PolarCoordAngle

A read-only property with a DANumber value that represents the counter-clockwise angular displacement, in radians, relative to the positive x-axis, of the DAVector2 object. The range is [-Pi, +Pi].

vector2Obj.PolarCoordAngle

####

PolarCoordLength

A read-only property with a DANumber value that represents the length (or magnitude) of the vector.

vector2Obj.PolarCoordLength

####

X

A read-only property with a DANumber value that represents the X-coordinate of the DAVector2 object.

vector2Obj.X

##### See Also

Y, Vector2Anim

####

Y

A read-only property with a DANumber value that represents the Y-coordinate of the DAVector2 object.

vector2Obj.Y

##### See Also

X, Vector2Anim

### Relevant Functions from the DAStatics Class

The following functions are defined in the DAStatics class and are most relevant to objects of type DAVector2.

lib.AddVector2(v1, v2)

lib.DerivativeVector2(vec)

lib.DotVector2(v1, v2)

lib.IntegralVector2(vec)

lib.NegVector2(v1)

lib.SubVector2(v1, v2)

lib.Vector2Anim(x, y)

lib.Vector2(x, y)

lib.Vector2BSpline(degree, knots, control_elements, weights, evaluation)

lib.Vector2PolarAnim(XYangle, length)

lib.Vector2Polar(XYangle, length)

lib.Vector2PolarDegrees(XYangle, length)

### Relevant Properties from the DAStatics Class

The following properties are defined in the DAStatics class and are most relevant to objects of type DAVector2.

lib.XVector2

lib.YVector2

lib.ZeroVector2

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.