icy.type.point

## Class Point3D

• java.lang.Object
• icy.type.point.Point3D
• All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
Point3D.Double, Point3D.Float, Point3D.Integer

public abstract class Point3D
extends java.lang.Object
implements java.lang.Cloneable
Point3D class.
Incomplete implementation (work in progress...)
Author:
Stephane
• ### Constructor Summary

Constructors
Constructor and Description
Point3D()
• ### Method Summary

Methods
Modifier and Type Method and Description
double angle(double x, double y, double z)
Computes the angle (in degrees) between the vector represented by this point and the specified vector.
double angle(Point3D vector)
Computes the angle (in degrees) between the vector represented by this point and the vector represented by the specified point.
double angle(Point3D p1, Point3D p2)
Computes the angle (in degrees) between the three points with this point as a vertex.
java.lang.Object clone()
Creates a new object of the same class as this object.
Point3D crossProduct(double x, double y, double z)
Computes cross product of the vector represented by this instance and the specified vector.
Point3D crossProduct(Point3D vector)
Computes cross product of the vector represented by this instance and the specified vector.
double distance(double x1, double y1, double z1)
Computes the distance between this point and point (x1, y1, z1).
double distance(Point3D point)
Computes the distance between this point and the specified point.
double dotProduct(double x, double y, double z)
Computes dot (scalar) product of the vector represented by this instance and the specified vector.
double dotProduct(Point3D vector)
Computes dot (scalar) product of the vector represented by this instance and the specified vector.
boolean equals(java.lang.Object obj)
static double getDistance(Point3D pt1, Point3D pt2, double factorX, double factorY, double factorZ)
Returns distance between 2 Point2D using specified scale factor for x/y/z dimension.
static double getTotalDistance(java.util.List<Point3D> points, double factorX, double factorY, double factorZ, boolean connectLastPoint)
Returns total distance of the specified list of points.
abstract double getX()
Returns the X coordinate of this Point3D in double precision.
abstract double getY()
Returns the Y coordinate of this Point3D in double precision.
abstract double getZ()
Returns the Z coordinate of this Point3D in double precision.
int hashCode()
double length()
Computes length of the vector represented by this Point3D.
double magnitude()
Same as length()
Point3D midpoint(double x, double y, double z)
Returns a point which lies in the middle between this point and the specified coordinates.
Point3D midpoint(Point3D point)
Returns a point which lies in the middle between this point and the specified point.
double norm2()
Computes norm2 (square length) of the vector represented by this Point3D.
Point3D normalize()
Normalizes the relative magnitude vector represented by this instance.
void setLocation(double x, double y, double z)
Sets the location of this Point3D to the specified double coordinates.
void setLocation(Point3D p)
Sets the location of this Point3D to the same coordinates as the specified Point3D object.
abstract void setX(double x)
Sets the X coordinate of this Point3D in double precision.
abstract void setY(double y)
Sets the Y coordinate of this Point3D in double precision.
abstract void setZ(double z)
Sets the Z coordinate of this Point3D in double precision.
abstract java.awt.geom.Point2D toPoint2D()
Convert to 2D point
java.lang.String toString()
Returns a string representation of this Point3D.
void translate(double x, double y, double z)
Translate this Point3D by the specified double coordinates.
void translate(Point3D p)
Translate this Point3D by the specified Point3D coordinates.
• ### Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait
• ### Constructor Detail

• #### Point3D

public Point3D()
• ### Method Detail

• #### getDistance

public static double getDistance(Point3D pt1,
Point3D pt2,
double factorX,
double factorY,
double factorZ)
Returns distance between 2 Point2D using specified scale factor for x/y/z dimension.
• #### getTotalDistance

public static double getTotalDistance(java.util.List<Point3D> points,
double factorX,
double factorY,
double factorZ,
boolean connectLastPoint)
Returns total distance of the specified list of points.
• #### getX

public abstract double getX()
Returns the X coordinate of this Point3D in double precision.
Returns:
the X coordinate of this Point3D.
• #### getY

public abstract double getY()
Returns the Y coordinate of this Point3D in double precision.
Returns:
the Y coordinate of this Point3D.
• #### getZ

public abstract double getZ()
Returns the Z coordinate of this Point3D in double precision.
Returns:
the Z coordinate of this Point3D.
• #### setX

public abstract void setX(double x)
Sets the X coordinate of this Point3D in double precision.
• #### setY

public abstract void setY(double y)
Sets the Y coordinate of this Point3D in double precision.
• #### setZ

public abstract void setZ(double z)
Sets the Z coordinate of this Point3D in double precision.
• #### setLocation

public void setLocation(double x,
double y,
double z)
Sets the location of this Point3D to the specified double coordinates.
Parameters:
x - the new X coordinate of this Point3D
y - the new Y coordinate of this Point3D
z - the new Z coordinate of this Point3D
• #### setLocation

public void setLocation(Point3D p)
Sets the location of this Point3D to the same coordinates as the specified Point3D object.
Parameters:
p - the specified Point3D to which to set this Point3D
• #### translate

public void translate(double x,
double y,
double z)
Translate this Point3D by the specified double coordinates.
Parameters:
x - the X translation value
y - the Y translation value
z - the Z translation value
• #### translate

public void translate(Point3D p)
Translate this Point3D by the specified Point3D coordinates.
Parameters:
p - the specified Point3D used to translate this Point3D
• #### toPoint2D

public abstract java.awt.geom.Point2D toPoint2D()
Convert to 2D point
• #### distance

public double distance(double x1,
double y1,
double z1)
Computes the distance between this point and point (x1, y1, z1).
Parameters:
x1 - the x coordinate of other point
y1 - the y coordinate of other point
z1 - the z coordinate of other point
Returns:
the distance between this point and point (x1, y1, z1).
• #### distance

public double distance(Point3D point)
Computes the distance between this point and the specified point.
Parameters:
point - the other point
Returns:
the distance between this point and the specified point.
Throws:
java.lang.NullPointerException - if the specified point is null
• #### normalize

public Point3D normalize()
Normalizes the relative magnitude vector represented by this instance. Returns a vector with the same direction and magnitude equal to 1. If this is a zero vector, a zero vector is returned.
Returns:
the normalized vector represented by a Point3D instance
• #### midpoint

public Point3D midpoint(double x,
double y,
double z)
Returns a point which lies in the middle between this point and the specified coordinates.
Parameters:
x - the X coordinate of the second end point
y - the Y coordinate of the second end point
z - the Z coordinate of the second end point
Returns:
the point in the middle
• #### midpoint

public Point3D midpoint(Point3D point)
Returns a point which lies in the middle between this point and the specified point.
Parameters:
point - the other end point
Returns:
the point in the middle
Throws:
java.lang.NullPointerException - if the specified point is null
• #### angle

public double angle(double x,
double y,
double z)
Computes the angle (in degrees) between the vector represented by this point and the specified vector.
Parameters:
x - the X magnitude of the other vector
y - the Y magnitude of the other vector
z - the Z magnitude of the other vector
Returns:
the angle between the two vectors measured in degrees
• #### angle

public double angle(Point3D vector)
Computes the angle (in degrees) between the vector represented by this point and the vector represented by the specified point.
Parameters:
vector - the other vector
Returns:
the angle between the two vectors measured in degrees, NaN if any of the two vectors is a zero vector
Throws:
java.lang.NullPointerException - if the specified vector is null
• #### angle

public double angle(Point3D p1,
Point3D p2)
Computes the angle (in degrees) between the three points with this point as a vertex.
Parameters:
p1 - one point
p2 - other point
Returns:
angle between the vectors (this, p1) and (this, p2) measured in degrees, NaN if the three points are not different from one another
Throws:
java.lang.NullPointerException - if the p1 or p2 is null
• #### norm2

public double norm2()
Computes norm2 (square length) of the vector represented by this Point3D.
Returns:
norm2 length of the vector
• #### length

public double length()
Computes length of the vector represented by this Point3D.
Returns:
length of the vector
• #### dotProduct

public double dotProduct(double x,
double y,
double z)
Computes dot (scalar) product of the vector represented by this instance and the specified vector.
Parameters:
x - the X magnitude of the other vector
y - the Y magnitude of the other vector
z - the Z magnitude of the other vector
Returns:
the dot product of the two vectors
• #### dotProduct

public double dotProduct(Point3D vector)
Computes dot (scalar) product of the vector represented by this instance and the specified vector.
Parameters:
vector - the other vector
Returns:
the dot product of the two vectors
Throws:
java.lang.NullPointerException - if the specified vector is null
• #### crossProduct

public Point3D crossProduct(double x,
double y,
double z)
Computes cross product of the vector represented by this instance and the specified vector.
Parameters:
x - the X magnitude of the other vector
y - the Y magnitude of the other vector
z - the Z magnitude of the other vector
Returns:
the cross product of the two vectors
• #### crossProduct

public Point3D crossProduct(Point3D vector)
Computes cross product of the vector represented by this instance and the specified vector.
Parameters:
vector - the other vector
Returns:
the cross product of the two vectors
Throws:
java.lang.NullPointerException - if the specified vector is null
• #### equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
• #### clone

public java.lang.Object clone()
Creates a new object of the same class as this object.
Overrides:
clone in class java.lang.Object
Returns:
a clone of this instance.
Throws:
java.lang.OutOfMemoryError - if there is not enough memory.
Cloneable
• #### hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this Point3D object.
• #### toString

public java.lang.String toString()
Returns a string representation of this Point3D. This method is intended to be used only for informational purposes.
Overrides:
toString in class java.lang.Object