DirectX Media for Animation Java Reference |
![]() Previous |
![]() Classes |
![]() Index |
![]() Next |
public class Point2Bvr extends Behavior { // Fields public static Point2Bvr mousePosition; public static Point2Bvr origin2; // Methods public NumberBvr getRho(); public NumberBvr getTheta(); public NumberBvr getX(); public NumberBvr getY(); public Point2Bvr transform(Transform2Bvr xf); public static Point2Bvr add(Point2Bvr pt, Vector2Bvr vec); public static Point2Bvr bSpline(int degree, NumberBvr[] knots, Point2Bvr[] control_elements, NumberBvr[] weights); public static Vector2Bvr derivative(Point2Bvr pt); public static NumberBvr distance(Point2Bvr p1, Point2Bvr p2); public static NumberBvr distanceSquared(Point2Bvr p1, Point2Bvr p2); public static Point2Bvr newUninitBvr(); public static Point2Bvr point2Polar(NumberBvr theta, NumberBvr rho); public static Point2Bvr point2Xy(NumberBvr x, NumberBvr y); public static Vector2Bvr sub(Point2Bvr p1, Point2Bvr p2); public static Point2Bvr sub(Point2Bvr pt, Vector2Bvr vec); }
Creates an object that represents a two-dimensional point behavior. At any given time, the value of the behavior is a point, representing a location in a plane or on the screen. Each point has a pair of coordinate values that define the point's location relative to a fixed point called the origin. These coordinate values are given as either Cartesian coordinates (x,y) or polar coordinates (theta,rho) when the point behavior is created.
Because coordinate values are number behaviors (NumberBvr objects), the location of a point behavior may change over time as the number behaviors change. For more information about behaviors, see the Behavior class.
public NumberBvr getRho();Creates a number behavior that represents the distance of the point from the origin.
Return Value:
Returns the NumberBvr object.
See Also: getTheta, point2Polar
public NumberBvr getTheta();Creates a number behavior that represents the counter-clockwise angular displacement, in radians, relative to the positive x-axis, of the point behavior.
Return Value:
Returns the NumberBvr object.
See Also: getRho, point2Polar
public NumberBvr getX();Creates a number behavior that represents the x coordinate of this point behavior.
Return Value:
Returns the NumberBvr object.
public NumberBvr getY();Creates a number behavior that represents the y coordinate of this point behavior.
Return Value:
Returns the NumberBvr object.
public Point2Bvr transform(Transform2Bvr xf);Creates a new two-dimensional point behavior that is the result of applying the given transformation to the original point behavior.
Return Value:
Returns the Point2Bvr object.
Parameter Description xf The Transform2Bvr object. Remarks:
This attribute composes values.
public static Point2Bvr add(Point2Bvr pt, Vector2Bvr vec);Creates a two-dimensional point behavior. The location of the point is calculated by adding the corresponding coordinates of the given point and vector behaviors.
Return Value:
Returns the Point2Bvr object.
Parameter Description pt A Point2Bvr object. vec A Vector2Bvr object. See Also: sub
public static Point2Bvr bSpline(int degree, NumberBvr[] knots, Point2Bvr[] control_elements, NumberBvr[] weights);Creates a Point2Bvr behavior that defines a B-spline curve from which individual point 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 Point2Bvr is the evaluation of the spline curve according to time. By default, the spline parameter advances at the 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 Point2Bvr object.
Parameter Description 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 Point2Bvr 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.
public static Vector2Bvr derivative(Point2Bvr pt);Creates a two-dimensional vector behavior of the instantaneous derivative (rate of change) of the given point behavior. For example, a constant yields a constant derivative of [0 0], and point2Xy(time, 0) (without additional time substitutions) yields a constant derivative of [1 0].
Return Value:
Returns the Vector2Bvr object.
Parameter Description pt A Point2Bvr object.
public static NumberBvr distance(Point2Bvr p1, Point2Bvr p2);Creates a number behavior representing the distance between two point behaviors.
Return Value:
Returns the NumberBvr object.
Parameter Description p1 and p2 The Point2Bvr objects. See Also: distanceSquared
public static NumberBvr distanceSquared(Point2Bvr p1, Point2Bvr p2);Creates a number behavior representing the square of the distance between two point behaviors. This is the same as the distance method except that the distance is squared.
Return Value:
Returns the NumberBvr object.
Parameter Description p1 and p2 The Point2Bvr objects. See Also: distance
public static Point2Bvr newUninitBvr();This method allows you to refer to an Point2Bvr 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 Point2Bvr object.
public static Point2Bvr point2Polar(NumberBvr theta, NumberBvr rho);Creates a two-dimensional point behavior. The location of the point is given in polar coordinates.
Return Value:
Returns the Point2Bvr object.
Parameter Description theta The NumberBvr object specifying the angle, in radians, between the positive x-axis and the ray that goes from the origin to the point. rho The NumberBvr object specifying the distance from the origin to the point. See Also: point2Xy
public static Point2Bvr point2Xy(NumberBvr x, NumberBvr y);Creates a two-dimensional point behavior. The location of the point is given in Cartesian coordinates.
Return Value:
Returns the Point2Bvr object.
Parameter Description x and y The NumberBvr objects, specifying the coordinate values. The x specifies the distance along the x-axis from the origin to the point, and y specifies the distance along the y-axis. See Also: point2Polar
public static Vector2Bvr sub(Point2Bvr p1, Point2Bvr p2);Creates a two-dimensional vector behavior. The coordinate values of the vector are calculated by subtracting the coordinates of p2 from the corresponding coordinates of p1.
Return Value:
Returns the Vector2Bvr object.
Parameter Description p1 and p2 The Point2Bvr objects.
public static Point2Bvr sub(Point2Bvr pt, Vector2Bvr vec);Creates a two-dimensional point behavior. The location of the point is calculated by subtracting the coordinates of the given vector behavior from the corresponding coordinates of the given point behavior.
Return Value:
Returns the Point2Bvr object.
Parameter Description pt A Point2Bvr object. vec A Vector2Bvr object. See Also: add
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.