|
|||||||||
| Home >> All >> org >> pqt >> autorib >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.pqt.autorib.util
Class Point4D

java.lang.Objectorg.pqt.autorib.util.Point4D
- All Implemented Interfaces:
- java.lang.Cloneable
- public class Point4D
- extends java.lang.Object
- implements java.lang.Cloneable
- extends java.lang.Object
a class to handle 3d points or vectors (in fact Vector might be a better name for the class)
- Version:
- $Header: /home/CVSRepository/autoribnew/org/pqt/autorib/util/Point4D.java,v 1.4 2003/12/02 17:11:14 remote Exp $
| Field Summary | |
float[] |
value
the value of the point stored in an array |
| Constructor Summary | |
Point4D()
initialize the point to {0,0,0} |
|
Point4D(float x,
float y,
float z,
float w)
initialize the point to the given values |
|
Point4D(java.util.Vector v)
initialize a point from a Vector |
|
Point4D(java.util.Vector v,
int index)
initialize a point from a Vector, starting at the given index |
|
| Method Summary | |
Point4D |
add(Point4D b)
return the value of the present Point + b (the value of the present point is left unchanged) |
static Point4D |
add(Point4D a,
Point4D b)
return a + b |
java.lang.Object |
clone()
This method may be called to create a new copy of the Object. |
static Point4D[] |
convertVector(java.util.Vector vector)
A utility method to convert a vector of Float data to an array of point4D |
Point4D |
cross(Point4D a)
return the cross product of this point/vector with another |
static Point4D |
cross(Point4D x,
Point4D y)
return the cross product of two points, treated as vectors |
float |
dot(Point4D a)
return the dot product of this point (as a vector) with another |
static float |
dot(Point4D a,
Point4D b)
return the dot product of two points (treating them as vectors) |
boolean |
equals(Point4D a)
return true if each component of a equals the equivalent component in the present Point |
static boolean |
Equals(Point4D a,
Point4D b)
returns true of each component of a equals the equivalent component in b |
static boolean |
fuzzyEquals(Point4D a,
Point4D b,
double gap)
return true if the difference between each component in a and its equivalent in b is less than the value gap |
void |
homogenize()
|
void |
initPoint(java.util.Vector v,
int index)
initialize a point from a Vector, starting at the given index |
float |
length()
return the length of this point (treated as a vector) |
static float |
length(Point4D a)
return the length of a point, treated as a vector |
float |
lengthSquared()
return the length squared of this point (treated as a vector) |
static float |
lengthSquared(Point4D a)
return the length (magnitude) of a point squared |
Point4D |
mult(float f)
return a point consisting of each component of the present Point multiplied by f (the Point's value is left unchanged |
static Point4D |
mult(Point4D a,
float f)
return a point consisting of each component of a multiplied by f |
Point4D |
normalize()
normalize this point |
static Point4D |
normalize(Point4D a)
normalize a given point (vector) |
float |
percentageDifference(Point point)
Return the percentage difference between two points, that is take which ever is larger of the differences of the components and express it as a percentage of the larger of whichever component is bigger |
Point4D |
subtract(Point4D b)
return the value of the present Point - b (the value of the present point is left unchanged) |
static Point4D |
subtract(Point4D a,
Point4D b)
return a - b |
Point |
toPoint()
return this Point4D as a Point |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
value
public float[] value
- the value of the point stored in an array
| Constructor Detail |
Point4D
public Point4D()
- initialize the point to {0,0,0}
Point4D
public Point4D(float x,
float y,
float z,
float w)
- initialize the point to the given values
Point4D
public Point4D(java.util.Vector v) throws java.lang.Exception
- initialize a point from a Vector
Point4D
public Point4D(java.util.Vector v, int index) throws java.lang.Exception
- initialize a point from a Vector, starting at the given index
| Method Detail |
initPoint
public void initPoint(java.util.Vector v, int index) throws java.lang.Exception
- initialize a point from a Vector, starting at the given index
add
public static Point4D add(Point4D a, Point4D b)
- return a + b
add
public Point4D add(Point4D b)
- return the value of the present Point + b (the value of the present
point is left unchanged)
subtract
public static Point4D subtract(Point4D a, Point4D b)
- return a - b
subtract
public Point4D subtract(Point4D b)
- return the value of the present Point - b (the value of the present
point is left unchanged)
mult
public static Point4D mult(Point4D a, float f)
- return a point consisting of each component of a multiplied by f
mult
public Point4D mult(float f)
- return a point consisting of each component of the present Point
multiplied by f (the Point's value is left unchanged
Equals
public static boolean Equals(Point4D a, Point4D b)
- returns true of each component of a equals the equivalent component in b
equals
public boolean equals(Point4D a)
- return true if each component of a equals the equivalent component in the
present Point
fuzzyEquals
public static boolean fuzzyEquals(Point4D a, Point4D b, double gap)
- return true if the difference between each component in a and its
equivalent in b is less than the value gap
percentageDifference
public float percentageDifference(Point point)
- Return the percentage difference between two points, that is take which
ever is larger of the differences of the components and express it as a
percentage of the larger of whichever component is bigger
clone
public java.lang.Object clone()
- Description copied from class:
java.lang.Object - This method may be called to create a new copy of the
Object. The typical behavior is as follows:
o == o.clone()is falseo.getClass() == o.clone().getClass()is trueo.equals(o)is true
However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>
Object.equals(Object)55 .If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.
Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.
All array types implement Cloneable, and override this method as follows (it should never fail):
public Object clone() { try { super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(e.getMessage()); } }
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
dot
public static float dot(Point4D a, Point4D b)
- return the dot product of two points (treating them as vectors)
dot
public float dot(Point4D a)
- return the dot product of this point (as a vector) with another
cross
public static Point4D cross(Point4D x, Point4D y)
- return the cross product of two points, treated as vectors
length
public static float length(Point4D a)
- return the length of a point, treated as a vector
lengthSquared
public static float lengthSquared(Point4D a)
- return the length (magnitude) of a point squared
length
public float length()
- return the length of this point (treated as a vector)
lengthSquared
public float lengthSquared()
- return the length squared of this point (treated as a vector)
normalize
public static Point4D normalize(Point4D a)
- normalize a given point (vector)
normalize
public Point4D normalize()
- normalize this point
cross
public Point4D cross(Point4D a)
- return the cross product of this point/vector with another
homogenize
public void homogenize()
toPoint
public Point toPoint()
- return this Point4D as a Point
convertVector
public static Point4D[] convertVector(java.util.Vector vector)
- A utility method to convert a vector of Float data to an array of point4D
|
|||||||||
| Home >> All >> org >> pqt >> autorib >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.pqt.autorib.util.Point4D