DirectX Media for Animation Java Reference Previous
Previous
Classes
Classes
Index
Index
Next
Next

Vector3Bvr Class

Methods , Fields

public class Vector3Bvr extends Behavior {
    // Fields
    public static Vector3Bvr xVector3;
    public static Vector3Bvr yVector3;
    public static Vector3Bvr zVector3;
    public static Vector3Bvr zeroVector3;

    // Methods
    public Vector3Bvr div(NumberBvr scalar);
    public NumberBvr  getPhi();
    public NumberBvr  getRho();
    public NumberBvr  getTheta();
    public NumberBvr  getX();
    public NumberBvr  getY();
    public NumberBvr  getZ();
    public NumberBvr  length();
    public NumberBvr  lengthSquared();
    public Vector3Bvr mul(NumberBvr scalar);
    public Vector3Bvr normalize();
    public Vector3Bvr transform(Transform3Bvr xf);

    public static Vector3Bvr add(Vector3Bvr v1, Vector3Bvr v2);
    public static Vector3Bvr bSpline(int degree, NumberBvr[] knots, Vector3Bvr[] control_elements, NumberBvr[] weights);
    public static Vector3Bvr cross(Vector3Bvr v1, Vector3Bvr v2);
    public static Vector3Bvr derivative(Vector3Bvr vec);
    public static NumberBvr  dot(Vector3Bvr v1, Vector3Bvr v2);
    public static Vector3Bvr integral(Vector3Bvr vec);
    public static Vector3Bvr neg(Vector3Bvr v1);
    public static Vector3Bvr newUninitBvr();
    public static Vector3Bvr sub(Vector3Bvr v1, Vector3Bvr v2);
    public static Vector3Bvr vector3Spherical(NumberBvr theta, NumberBvr phi, NumberBvr rho);
    public static Vector3Bvr vector3Xyz(NumberBvr x, NumberBvr y, NumberBvr z);
 
}

Creates an object that represents a three-dimensional vector behavior. At any given time, the value of the behavior is a direction and length (magnitude), specified as a triplet of coordinate values given as either Cartesian coordinates (x, y, z) or spherical coordinates (theta, phi, rho). 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.


Methods


div

public Vector3Bvr div(NumberBvr scalar);

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

Return Value:

Returns the Vector3Bvr object.

ParameterDescription
scalar A NumberBvr object.

See Also: mul


getPhi

public NumberBvr  getPhi();

Creates a number behavior that represents the phi coordinate of the given vector's spherical coordinates. The value of phi is the elevation angle, in radians, up from the XZ-plane and towards positive y.

Return Value:

Returns the NumberBvr object.

See Also: getTheta, getRho, vector3Spherical


getRho

public NumberBvr  getRho();

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

Return Value:

Returns the NumberBvr object.

See Also: getTheta, getPhi, vector3Spherical


getTheta

public NumberBvr  getTheta();

Creates a number behavior that represents the theta coordinate of the given vector's spherical coordinates. The value theta is the counter-clockwise angle, in radians, of the point about the y-axis, starting at positive z.

Return Value:

Returns the NumberBvr object.

See Also: getPhi, getRho, vector3Spherical


getX

public NumberBvr  getX();

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

Return Value:

Returns the NumberBvr object.

See Also: getY, getZ, vector3Xyz


getY

public NumberBvr  getY();

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

Return Value:

Returns the NumberBvr object.

See Also: getX, getZ, vector3Xyz


getZ

public NumberBvr  getZ();

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

Return Value:

Returns the NumberBvr object.

See Also: getX, getY, vector3Xyz


length

public NumberBvr  length();

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

Return Value:

Returns the NumberBvr object.

See Also: lengthSquared


lengthSquared

public NumberBvr  lengthSquared();

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

Return Value:

Returns the NumberBvr object.

See Also: length


mul

public Vector3Bvr mul(NumberBvr scalar);

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

Return Value:

Returns the Vector3Bvr object.

ParameterDescription
scalar A NumberBvr object.

See Also: div


normalize

public Vector3Bvr normalize();

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

Return Value:

Returns the Vector3Bvr object.


transform

public Vector3Bvr transform(Transform3Bvr xf);

Creates a new three-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.

Return Value:

Returns the Vector3Bvr object.

ParameterDescription
xf A Transform3Bvr object.

Remarks:

This attribute composes values.


add

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

Creates a three-dimensional vector behavior. The direction and length of the vector are calculated by adding the corresponding coordinates of the given vectors.

Return Value:

Returns the Vector3Bvr object.

ParameterDescription
v1 and v2 The Vector3Bvr objects.

See Also: sub


bSpline

public static Vector3Bvr bSpline(int degree, NumberBvr[] knots, Vector3Bvr[] control_elements, NumberBvr[] weights);

Creates a Vector3Bvr object that defines a B-spline curve from which individual vector behaviors, representing positions on the curve, can be evaluated. The shape of the curve depends on the mathematical degree of curve and whether weights are provided.

A B-spline with weights is rational, and without weights is non-rational (polynomial). The non-rational variety assumes that #points = numKnots - degree + 1. The knots represent known positions along the curve, and the control points define the direction and shape of the curve as it passes from one knot to the next.

Given a degree of curve d and a number of knots k, a position on the curve can be evaluated for any value in the range knotd to knotk-d+1. For example, for a degree 2 curve, the valid range is from the second knot to the next to the last knot, inclusive.

The returned Vector3Bvr behavior is the evaluation of the spline curve according to time. By default, the spline parameter advances at a rate of one unit per second. To control the evaluation of the curve, use the substituteTime method. Times outside the valid range are clamped to the values at the endpoints of the spline.

Return Value:

Returns the Vector3Bvr object.

ParameterDescription
degree A number representing the mathematical degree of the B-spline to evaluate. Must be 1, 2, or 3.
knots An array of NumberBvr objects representing the knots used to calculate the B-spline.
control_elements An array of Vector3Bvr objects representing the control elements used to calculate the B-spline.
weights An array of NumberBvr objects representing the weights used to calculate the rational B-spline. There must be the same number of weights as control elements. For non-rational B-splines, the value of weights is null.


cross

public static Vector3Bvr cross(Vector3Bvr v1, Vector3Bvr v2);

Creates a vector behavior that represents the "cross product" of the given vectors. The new vector has a length that is equal to the product of the lengths of the original vectors and the sine of the angle between them. The new vector has a direction that is perpendicular to the plane formed by the original vectors and that obeys the right-hand rule.

Return Value:

Returns the Vector3Bvr object.

ParameterDescription
v1 and v2 The Vector3Bvr objects.


derivative

public static Vector3Bvr derivative(Vector3Bvr vec);

Creates a new, three-dimensional vector behavior that is the instantaneous derivative (rate of change) of the given vector behavior. For example, a constant vector behavior yields a constant derivative of [0 0 0], and vector3Xyz(time, 0) (without any additional time substitutions) yields a constant derivative vector of [1 0 0].

Return Value:

Returns the Vector3Bvr object.

ParameterDescription
vec A Vector3Bvr object.


dot

public static NumberBvr  dot(Vector3Bvr v1, Vector3Bvr v2);

Creates a number behavior that represent the "dot product" of the given vectors. The dot product is the product of the lengths of the vectors and the cosine of the angle between them.

Return Value:

Returns the NumberBvr object.

ParameterDescription
v1 and v2 Vector3Bvr objects.


integral

public static Vector3Bvr integral(Vector3Bvr vec);

Creates an three-dimensional vector that represents the sum of the all values of vec from the given start time to the present.

Return Value:

Returns the Vector3Bvr object.

ParameterDescription
a The Vector3Bvr object.


neg

public static Vector3Bvr neg(Vector3Bvr v1);

Creates a new three-dimensional vector behavior that has the same length as the original vector, but points in the opposite direction.

Return Value:

Returns the Vector3Bvr object.

ParameterDescription
v1 A Vector3Bvr object that is the original vector.


newUninitBvr

public static Vector3Bvr newUninitBvr();

This method allows you to refer to an Vector3Bvr 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.

Return Value:

Returns the Vector3Bvr object.


sub

public static Vector3Bvr sub(Vector3Bvr v1, Vector3Bvr v2);

Creates a three-dimensional vector behavior. The direction and length of the vector are calculated by subtracting the coordinates of v2 from the corresponding coordinates of v1.

Return Value:

Returns the Vector3Bvr object.

ParameterDescription
v1 and v2 Vector3Bvr objects.

See Also: add


vector3Spherical

public static Vector3Bvr vector3Spherical(NumberBvr theta, NumberBvr phi, NumberBvr rho);

Creates a three-dimensional vector behavior, having a direction and length as specified by the given spherical coordinates.

Return Value:

Returns the Vector3Bvr object.

ParameterDescription
theta A NumberBvr object of the counter-clockwise azimuthal angle, in radians, of the point about the positive y-axis. The angle begins at the positive z-ray, so that [0 0 1] has a theta of 0, and [1 0 0] has a theta of pi/2.
phi A NumberBvr object of the counter-clockwise elevation angle, in radians, of the point above the XZ-plane. A phi of pi/2 means the point is straight up (on the positive y-ray), and a phi of -pi/2 is straight down (on the negative y-ray).
rho A NumberBvr object specifying the length of the vector.

Remarks:

The following table correlates Cartesian coordinates with polar coordinates:
Cartesian Theta Phi Rho
Coordinates
[0 0 0] X X 0
[d 0 0] pi/2 0 d
[-d 0 0] -pi/2 0 d X = Don't Care
[0 d 0] X pi/2 d
[0 -d 0] X -pi/2 d
[0 0 d] 0 0 d
[0 0 -d] pi 0 d

See Also: vector3Xyz


vector3Xyz

public static Vector3Bvr vector3Xyz(NumberBvr x, NumberBvr y, NumberBvr z);

Creates a three-dimensional vector behavior, having a direction and length as specified by the given Cartesian coordinates.

Return Value:

Returns the Vector3Bvr object.

ParameterDescription
x, y, and z The NumberBvr objects specifying the coordinate values. The x specifies a distance along the x-axis from the origin to a point, y specifies a distance along the y-axis, and z a distance along the z-axis.

See Also: vector3Spherical


Fields

xVector3
A three-dimensional vector behavior (Vector3Bvr object) that represents the unit vector on the x-axis. The vector's length is always 1, the direction is always the same as the positive x-axis.
yVector3
A three-dimensional vector behavior (Vector3Bvr object) that represents the unit vector on the y-axis. The vector's length is always 1, the direction is always the same as the positive y-axis.
zVector3
A three-dimensional vector behavior (Vector3Bvr object) that represents the unit vector on the z-axis. The vector's length is always 1, the direction is always the same as the positive z-axis.
zeroVector3
A three-dimensional vector behavior (Vector3Bvr object) that represents the null vector. The vector's length is always 0, the direction is undefined.


Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.