public class Rotate3D extends java.lang.Object implements java.io.Serializable
Point3D instances). This file is derived from code published in
"Computer Graphics for Java Programmers (Second Edition)" by Leen Ammeraal
and Kang Zhang.
| Constructor and Description |
|---|
Rotate3D(Point3D a,
Point3D b,
double angle)
Creates a new instance that will rotate points about the axis passing
through points a and b, by the specified angle.
|
| Modifier and Type | Method and Description |
|---|---|
Point3D |
applyRotation(double x,
double y,
double z)
Creates an returns a new point that is the rotation of the point
(x, y, z) about the axis that was specified via the
constructor. |
double[] |
applyRotation(double x,
double y,
double z,
double[] result)
Returns the coordinates of a point that is the rotation of the point
(x, y, z) about the axis that was specified via the
constructor. |
Point3D |
applyRotation(Point3D p)
Creates and returns a new point that is the rotation of
p
about the axis that was specified via the constructor. |
double |
getAngle()
Returns the angle of rotation, in radians.
|
void |
setAngle(double angle)
Sets the angle of rotation (in radians) and (internally) updates the
values of the transformation matrix ready for the next call(s) to
the
applyRotation methods. |
public Rotate3D(Point3D a, Point3D b, double angle)
a - the first point defining the axis of rotation
(null not permitted).b - the second point defining the axis of rotation
(null not permitted).angle - the rotation angle (in radians).public double getAngle()
public void setAngle(double angle)
applyRotation methods.angle - the angle (in radians).public Point3D applyRotation(Point3D p)
p
about the axis that was specified via the constructor.p - the point (null not permitted).public Point3D applyRotation(double x, double y, double z)
(x, y, z) about the axis that was specified via the
constructor.x - the x-coordinate of the point to transform.y - the y-coordinate of the point to transform.z - the z-coordinate of the point to transform.null).public double[] applyRotation(double x, double y, double z, double[] result)
(x, y, z) about the axis that was specified via the
constructor.x - the x-coordinate of the point to transform.y - the y-coordinate of the point to transform.z - the z-coordinate of the point to transform.result - an array to carry the result (null permitted).result array if
one was supplied, otherwise in a newly allocated array).