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.
For relevant methods and fields from the Statics class, see the following topics.
Vector2Bvr Methods
div 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. getPolarCoordAngle Creates a number behavior that represents the counter-clockwise angular displacement, in radians, relative to the positive x-axis, of the vector behavior. getPolarCoordLength Creates a number behavior that is the length of the vector. getX Creates a number behavior that represents the x-coordinate of this vector behavior. getY Creates a number behavior that represents the y-coordinate of this vector behavior. length Creates a number behavior that represents the length of a vector behavior. lengthSquared Creates a number behavior that represents the length of a vector behavior squared. mul 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. normalize Creates a normalized, two-dimensional vector behavior. transform Creates a new two-dimensional vector behavior that is the result of applying the given transformation to the original vector. newUninitBvr Enables you to refer to a Vector2Bvr behavior before that behavior has been defined.
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.
Syntax
public Vector2Bvr div( NumberBvr scalar );
Parameters
- scalar
- NumberBvr object. This parameter can also be of type double.
Return Value
Returns the Vector2Bvr object.
See Also
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].
Syntax
public NumberBvr getPolarCoordAngle( );
Return Value
Returns the NumberBvr object.
See Also
Creates a number behavior that is the length of the vector.
Syntax
public NumberBvr getPolarCoordLength( );
Return Value
Returns the NumberBvr object.
See Also
Creates a number behavior that represents the x-coordinate of this vector behavior.
Syntax
public NumberBvr getX( );
Return Value
Returns the NumberBvr object.
See Also
Creates a number behavior that represents the y-coordinate of this vector behavior.
Syntax
public NumberBvr getY( );
Return Value
Returns the NumberBvr object.
See Also
Creates a number behavior that represents the length of a vector behavior.
Syntax
public NumberBvr length( );
Return Value
Returns the NumberBvr object.
See Also
Creates a number behavior that represents the length of a vector behavior squared.
Syntax
public NumberBvr lengthSquared( );
Return Value
Returns the NumberBvr object.
Remarks
It is slightly more efficient to calculate lengthSquared than length.
See Also
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.
Syntax
public Vector2Bvr mul( NumberBvr scalar );
Parameters
- scalar
- NumberBvr object. This parameter can also be of type double.
Return Value
Returns the Vector2Bvr object.
See Also
Creates a normalized, two-dimensional vector behavior. The normalized vector has the same direction as the original vector, but the length is 1.
Syntax
public Vector2Bvr normalize( );
Return Value
Returns the Vector2Bvr object.
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.
Syntax
public Vector2Bvr transform( Transform2Bvr xf );
Parameters
- xf
- Transform2Bvr object.
Return Value
Returns the Vector2Bvr object.
Remarks
This attribute composes values.
Enables you to refer to a 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.
Syntax
public static Vector2Bvr newUninitBvr( );
Return Value
Returns the Vector2Bvr object.
Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.