javax.vecmath
Class Point4d

java.lang.Object
  extended by javax.vecmath.Tuple4d
      extended by javax.vecmath.Point4d
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Point4d
extends Tuple4d
implements java.io.Serializable

A 4 element vector represented by double precision floating point x,y,z,w coordinates.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.vecmath.Tuple4d
w, x, y, z
 
Constructor Summary
Point4d()
          Constructs and initializes a Point4d to (0,0,0,0).
Point4d(double[] p)
          Constructs and initializes a Point4d from the coordinates contained in the array.
Point4d(double x, double y, double z, double w)
          Constructs and initializes a Point4d from the specified xyzw coordinates.
Point4d(Point4d p1)
          Constructs and initializes a Point4d from the specified Point4d.
Point4d(Point4f p1)
          Constructs and initializes a Point4d from the specified Point4f.
Point4d(Tuple3d t1)
          Constructs and initializes a Point4d from the specified Tuple3d.
Point4d(Tuple4d t1)
          Constructs and initializes a Point4d from the specified Tuple4d.
Point4d(Tuple4f t1)
          Constructs and initializes a Point4d from the specified Tuple4f.
 
Method Summary
 double distance(Point4d p1)
          Returns the distance between this point and point p1.
 double distanceL1(Point4d p1)
          Computes the L-1 (Manhattan) distance between this point and point p1.
 double distanceLinf(Point4d p1)
          Computes the L-infinite distance between this point and point p1.
 double distanceSquared(Point4d p1)
          Returns the square of the distance between this point and point p1.
 void project(Point4d p1)
          Multiplies each of the x,y,z components of the Point4d parameter by 1/w, places the projected values into this point, and places a 1 as the w parameter of this point.
 void set(Tuple3d t1)
          Sets the x,y,z components of this point to the corresponding components of tuple t1.
 
Methods inherited from class javax.vecmath.Tuple4d
absolute, absolute, add, add, clamp, clamp, clamp, clamp, clampMax, clampMax, clampMax, clampMax, clampMin, clampMin, clampMin, clampMin, clone, epsilonEquals, equals, equals, get, get, hashCode, interpolate, interpolate, interpolate, interpolate, negate, negate, scale, scale, scaleAdd, scaleAdd, scaleAdd, set, set, set, set, sub, sub, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Point4d

public Point4d(double x,
               double y,
               double z,
               double w)
Constructs and initializes a Point4d from the specified xyzw coordinates.

Parameters:
x - the x coordinate
y - the y coordinate
z - the z coordinate
w - the w coordinate

Point4d

public Point4d(double[] p)
Constructs and initializes a Point4d from the coordinates contained in the array.

Parameters:
p - the array of length 4 containing xyzw in order

Point4d

public Point4d(Point4d p1)
Constructs and initializes a Point4d from the specified Point4d.

Parameters:
p1 - the Point4d containing the initialization x y z w data

Point4d

public Point4d(Point4f p1)
Constructs and initializes a Point4d from the specified Point4f.

Parameters:
p1 - the Point4f containing the initialization x y z w data

Point4d

public Point4d(Tuple4f t1)
Constructs and initializes a Point4d from the specified Tuple4f.

Parameters:
t1 - the Tuple4f containing the initialization x y z w data

Point4d

public Point4d(Tuple4d t1)
Constructs and initializes a Point4d from the specified Tuple4d.

Parameters:
t1 - the Tuple4d containing the initialization x y z w data

Point4d

public Point4d(Tuple3d t1)
Constructs and initializes a Point4d from the specified Tuple3d. The x,y,z components of this point are set to the corresponding components of tuple t1. The w component of this point is set to 1.

Parameters:
t1 - the tuple to be copied
Since:
vecmath 1.2

Point4d

public Point4d()
Constructs and initializes a Point4d to (0,0,0,0).

Method Detail

set

public final void set(Tuple3d t1)
Sets the x,y,z components of this point to the corresponding components of tuple t1. The w component of this point is set to 1.

Parameters:
t1 - the tuple to be copied
Since:
vecmath 1.2

distanceSquared

public final double distanceSquared(Point4d p1)
Returns the square of the distance between this point and point p1.

Parameters:
p1 - the first point
Returns:
the square of distance between this point and point p1

distance

public final double distance(Point4d p1)
Returns the distance between this point and point p1.

Parameters:
p1 - the first point
Returns:
the distance between these this point and point p1.

distanceL1

public final double distanceL1(Point4d p1)
Computes the L-1 (Manhattan) distance between this point and point p1. The L-1 distance is equal to: abs(x1-x2) + abs(y1-y2) + abs(z1-z2) + abs(w1-w2).

Parameters:
p1 - the other point
Returns:
the L-1 distance

distanceLinf

public final double distanceLinf(Point4d p1)
Computes the L-infinite distance between this point and point p1. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2), abs(w1-w2)].

Parameters:
p1 - the other point
Returns:
the L-infinite distance

project

public final void project(Point4d p1)
Multiplies each of the x,y,z components of the Point4d parameter by 1/w, places the projected values into this point, and places a 1 as the w parameter of this point.

Parameters:
p1 - the source Point4d, which is not modified


Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.