|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.geom.Point
public class Point
Point represents an homogeneous cartesian point in 3 dimensional space.
Point are immutable.
| Field Summary | |
|---|---|
static Point |
UNIT_X
Value of UNIT_X is (1,0,0) |
static Point |
UNIT_Y
Value of UNIT_Y is (0,1,0) |
static Point |
UNIT_Z
Value of UNIT_Z is (0,0,1) |
static Point |
ZERO
Value of ZERO is (0,0,0) |
| Constructor Summary | |
|---|---|
Point(double x,
double y,
double z)
Constructs a new Point from three parameters. |
|
Point(double x,
double y,
double z,
double w)
Constructs a new Point from four parameters. |
|
| Method Summary | |
|---|---|
Point |
add(Point p)
Calculates the sum of these two Points. |
static Point[] |
composeExtrema(Point[] points)
Calculate the extrema of a given array of Points. |
Point |
cross(Point that)
Determines the cross product of these two Points. |
double |
distanceTo(Point p)
Calculates the unsigned distance between this Point and p. |
double |
distanceToSquared(Point p)
Calculates the squared unsigned distance between this Point and p. |
double |
dot(Point p)
Performs a dot product of the x, y and z coorinates of this and p. |
double |
dot4(Point p)
Performs a dot product of all four components of this and p. |
boolean |
equals(Object o)
Compares this Point to o for equality. |
static Point |
fromOriginAndDirection(double scale,
Point direction,
Point origin)
Scales a Point along a vector. |
long |
getSizeInBytes()
Obtains the amount of memory this Point consumes. |
double |
getW()
Returns the w element of this Point. |
double |
getX()
Returns the x element of this Point. |
double |
getY()
Returns the y element of this Point. |
double |
getZ()
Returns the y element of this Point. |
int |
hashCode()
Generates an integer that is always the same for identical objects, but usually different for different objects. |
double |
length()
Calculates the distance between this Point and the origin. |
static Point |
midPoint(Point p1,
Point p2)
Determines the midpoint of two Points. |
Point |
multiply(double s)
Multiplies this Point by a scalar quantity. |
Point |
normalize()
|
Point |
scale(double sx,
double sy,
double sz)
|
double |
selfDot()
Performs a dot product of the x, y and z coorinates of this with itself. |
Point |
subtract(Point p)
Calculates the difference between these two Points. |
String |
toString()
Generates a string representation of this object. |
double |
w()
Returns the w element of this Point. |
double |
x()
Returns the x element of this Point. |
double |
y()
Returns the y element of this Point. |
double |
z()
Returns the z element of this Point. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Point UNIT_X
UNIT_X is (1,0,0)
public static final Point UNIT_Y
UNIT_Y is (0,1,0)
public static final Point UNIT_Z
UNIT_Z is (0,0,1)
public static final Point ZERO
ZERO is (0,0,0)
| Constructor Detail |
|---|
public Point(double x,
double y,
double z)
Point from three parameters. The w field is set to 1.
x - the x position of the Pointy - the y position of the Pointz - the z position of the Point
public Point(double x,
double y,
double z,
double w)
Point from four parameters.
x - the x position of the Pointy - the y position of the Pointz - the z position of the Pointw - the w position of the Point| Method Detail |
|---|
public final Point add(Point p)
Points. The resulting Point has x value equivalent to
this.x + p.x, the results for y,z and w are calculated in the same way.
p - the Point to be added to this Point
Point resulting from the algebraic operation this + p
IllegalArgumentException - if p is nullpublic static Point[] composeExtrema(Point[] points)
Points. The resulting array is always of length 2, with
the first element containing the minimum extremum, and the second containing the maximum. The minimum extremum is
composed by taking the smallest x, y and z values from all the Points in the array. These values are
not necessarily taken from the same Point. The maximum extrema is composed in the same fashion.
points - any array of Points
IllegalArgumentException - if points is nullpublic Point cross(Point that)
Points. This is post multiplied by that.
that - the second Point
Points
IllegalArgumentException - if that is nullpublic final double distanceTo(Point p)
Point and p.
p - the Point to find the distance from
Points
IllegalArgumentException - if p is nullpublic final double distanceToSquared(Point p)
Point and p. This method is
useful when actual distances are not required, but some measure is needed for comparison purposes. It avoids the
square root required for computing actual distance.
p - the Point to find the square distance from
Points
IllegalArgumentException - if p is nullpublic final double dot(Point p)
this and p.
p - the Point to perform a dot product with
this and p
IllegalArgumentException - if p is nullpublic final double dot4(Point p)
this and p.
p - the Point to perform a dot product with
this and p
IllegalArgumentException - if p is nullpublic boolean equals(Object o)
Point to o for equality.
This method makes comparisons on private fields; overriding implementations should include a call to
super.equals().
equals in class Objecto - the Object to be compared to for equality.
public static Point fromOriginAndDirection(double scale,
Point direction,
Point origin)
Point along a vector. The resulting Point is affected by both the scale factor
and the size of the vector direction. For example, a vector (2,2,2) and a vector (1,1,1) would produce a
different result, if all other variables remain constant. For this reason, programmers may wish to normalize
direction before calling this function.
scale - the factor to be scaled bydirection - the direction of scalingorigin - the original Point
origin scaled by scale in the direction specified
IllegalArgumentException - if direction or origin is nullpublic final long getSizeInBytes()
Point consumes.
getSizeInBytes in interface CacheablePoint in bytes.public double getW()
w() in that subclasses may override
it.
Pointw()public double getX()
x() in that subclasses may override
it.
Pointx()public double getY()
y() in that subclasses may override
it.
Pointy()public double getZ()
y() in that subclasses may override
it.
Pointz()public int hashCode()
Object.
This method makes comparisons on private fields; overriding implementations should include a call to
super.hashCode().
hashCode in class ObjectPoint.public final double length()
Point and the origin.
Point and ZEROZERO
public static Point midPoint(Point p1,
Point p2)
Points.
p1 - the first Pointp2 - the second Point
Points
IllegalArgumentException - if either p1 or p2 is nullpublic final Point multiply(double s)
Point by a scalar quantity. This method simply returns a new Point
whose values each equal the old Point's corresponding value multiplied by this scalar.
s - the scalar to be multiplied by
Point resulting from the scalar multiplication of this and spublic final Point normalize()
public final Point scale(double sx,
double sy,
double sz)
public final double selfDot()
this with itself. This method is equivalent
to this.dot(this).
A useful characteristic of this method is that the resulting value is the square of this Point's
distance from ZERO. Finding the square of the distance from the origin in this manner is preferred
over finding the square by first finding the length and then squaring it because this is faster and less prone to
loss of precision.
Point dotted with itselfZEROpublic final Point subtract(Point p)
Points. The resulting Point is equivalent
to this.x - p.x, the results for y, z and w are calculated in the same way.
p - the Point to subtract from this Point
Point resulting from the algebraic operationthis - p
IllegalArgumentException - if p is nullpublic final String toString()
Point.
toString in class ObjectPointpublic final double w()
Point.
Pointpublic final double x()
Point.
Pointpublic final double y()
Point.
Pointpublic final double z()
Point.
Point
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||