next up previous contents
Next: The Class Up: Clientlib API Previous: The Class   Contents

The Class

Position represents a coordinate location. It contains the following fields:

public double x, y, z;

where x, y, z are the (x, y, z) coordinate values (default unit=centimeters, unless changed by the Serial Port API described in Section 2.2). More specifically, it has the same unit as the distance unit that the Cricket device is configured to use. In addition, the Position class implements the following methods:

public boolean equals(Object o)

Returns true if object o is a Position with the same (x, y, z) coordinate.

public double dist(Position o)
public double dist(double ox, double oy, double oz)

These methods compute and return the distance between position o or the specified coordinates (ox, oy, oz) and the position represented by this object.

public boolean invalid()

Returns true if this position is invalid. (Typically an invalid listener position value is also indicated by the POSERR bit in the callback mask.)

public static Position weightSum(double w1, Position p1, 
                                 double w2, Position p2)

Returns a Position that is a weighted sum of two positions: w1 * p1 + w2 * p2.

Michel Goraczko 2004-12-02