    Contents  Index  Topic Contents
    Previous Topic: UntilNotifier Interface
    Next Topic: Vector3Bvr Class

> ## Vector2Bvr Class

>     public class Vector2Bvr extends Behavior {

>         // Methods
>         public Vector2Bvr div(NumberBvr scalar);
>         public NumberBvr  getPolarCoordAngle();
>         public NumberBvr  getPolarCoordLength();
>         public NumberBvr  getX();
>         public NumberBvr  getY();
>         public NumberBvr  length();
>         public NumberBvr  lengthSquared();
>         public Vector2Bvr mul(NumberBvr scalar);
>         public Vector2Bvr normalize();
>         public Vector2Bvr transform(Transform2Bvr xf);

>         public static Vector2Bvr newUninitBvr();
>     }

> Creates an object that represents a two-dimensional vector behavior. At any given time, the value of the behavior is a direction and length (magnitude), specified as a pair of coordinate values given as either Cartesian coordinates (x, y) or polar coordinates (XYangle, length). 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 number behaviors (NumberBvr objects), the direction and length of the vector behavior may change over time as the number behaviors change. For more information about behaviors, see the Behavior class.

> - Vector2Bvr Methods
> - Relevant Methods from the Statics Class
> - Relevant Fields from the Statics Class

> ### Vector2Bvr Methods

> div

> getPolarCoordAngle

> getPolarCoordLength

> getX

> getY

> length

> lengthSquared

> mul

> normalize

> transform

> newUninitBvr

> ####

> div

> Vector2Bvr Class

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

> public Vector2Bvr div(
> NumberBvr scalar
> );

> ##### Parameters

> scalar
>   A NumberBvr object. This parameter can also be of type double.

> ##### Return Values

> Returns the Vector2Bvr object.

> ##### See Also

> mul

> ####

> getPolarCoordAngle

> Vector2Bvr Class

> Creates a number behavior that represents the counter-clockwise angular displacement, in radians, relative to the positive x-axis, of the vector behavior. The range is [-Pi, +Pi].

> public NumberBvr getPolarCoordAngle( );

> ##### Return Values

> Returns the NumberBvr object.

> ##### See Also

> getPolarCoordLength, vector2Polar

> ####

> getPolarCoordLength

> Vector2Bvr Class

> Creates a number behavior that is the length of the vector.

> public NumberBvr getPolarCoordLength( );

> ##### Return Values

> Returns the NumberBvr object.

> ##### See Also

> getPolarCoordAngle, vector2Polar

> ####

> getX

> Vector2Bvr Class

> Creates a number behavior that represents the x coordinate of this vector behavior.

> public NumberBvr getX( );

> ##### Return Values

> Returns the NumberBvr object.

> ##### See Also

> getY, vector2

> ####

> getY

> Vector2Bvr Class

> Creates a number behavior that represents the y coordinate of this vector behavior.

> public NumberBvr getY( );

> ##### Return Values

> Returns the NumberBvr object.

> ##### See Also

> getX, vector2

> ####

> length

> Vector2Bvr Class

> Creates a number behavior that represents the length of a vector behavior.

> public NumberBvr length( );

> ##### Return Values

> Returns the NumberBvr object.

> ##### See Also

> lengthSquared

> ####

> lengthSquared

> Vector2Bvr Class

> Creates a number behavior that represents the length of a vector behavior squared.

> public NumberBvr lengthSquared( );

> ##### Return Values

> Returns the NumberBvr object.

> ##### Remarks

> It is slightly more efficient to calculate lengthSquared than length.

> ##### See Also

> length

> ####

> mul

> Vector2Bvr Class

> Creates a new two-dimensional vector behavior that points in the same direction as the original vector but has a length that has been multiplied by scalar.

> public Vector2Bvr mul(
> NumberBvr scalar
> );

> ##### Parameters

> scalar
>   A NumberBvr object. This parameter can also be of type double.

> ##### Return Values

> Returns the Vector2Bvr object.

> ##### See Also

> div

> ####

> normalize

> Vector2Bvr Class

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

> public Vector2Bvr normalize( );

> ##### Return Values

> Returns the Vector2Bvr object.

> ####

> transform

> Vector2Bvr Class

> Creates a new two-dimensional vector behavior that is the result of applying the given transformation to the original vector. The translation elements of the transformation are ignored; translation does not apply to vectors.

> public Vector2Bvr transform(
> Transform2Bvr xf
> );

> ##### Parameters

> xf
>   A Transform2Bvr object.

> ##### Return Values

> Returns the Vector2Bvr object.

> ##### Remarks

> This attribute composes values.

> ####

> newUninitBvr

> Vector2Bvr Class

> This method allows you to refer to an Vector2Bvr behavior before that behavior has been defined. With this method you can create the behavior and use it in the definition of other behaviors, but not actually define its contents until some later point. (This is accomplished with the init method, which is available on all behaviors.) The system generates a run-time error if you initialize a non-uninitialized behavior, initialize an uninitialized behavior that has already been initialized, or run an initialized behavior that has not yet been initialized.

> public static Vector2Bvr newUninitBvr( );

> ##### Return Values

> Returns the Vector2Bvr object.

> ### Relevant Methods from the Statics Class

> The following methods are defined in the Statics class and are most relevant to objects of type Vector2Bvr.

> public static Vector2Bvr add(Vector2Bvr v1, Vector2Bvr v2);

> public static Vector2Bvr bSpline(int degree, NumberBvr[] knots, Vector2Bvr[] control_elements, NumberBvr[] weights, NumberBvr evaluation);

> public static Vector2Bvr derivative(Vector2Bvr vec);

> public static NumberBvr dot(Vector2Bvr v1, Vector2Bvr v2);

> public static Vector2Bvr integral(Vector2Bvr vec);

> public static Vector2Bvr neg(Vector2Bvr v1);

> public static Vector2Bvr sub(Vector2Bvr v1, Vector2Bvr v2);

> public static Vector2Bvr vector2(NumberBvr x, NumberBvr y);

> public static Vector2Bvr vector2Polar(NumberBvr XYangle, NumberBvr length);

> public static Vector2Bvr vector2PolarDegrees(double XYangle, double length);

> ### Relevant Fields from the Statics Class

> The following fields are defined in the Statics class and are most relevant to objects of type Vector2Bvr.

> public final static Vector2Bvr xVector2;

> public final static Vector2Bvr yVector2;

> public final static Vector2Bvr zeroVector2;

> © 1998 Microsoft Corporation. All rights reserved. Terms of Use.

> Top of Page