public class ViewPoint3D extends java.lang.Object implements java.io.Serializable
panLeftRight(double) - rotates around the scene horizontally
from the perspective of the viewer;moveUpDown(double) - rotates around the scene vertically from
the perspective of the viewer;roll(double) - maintains the same viewing location but rolls
by the specified angle (like tilting a camera);setRho(double) - sets the distance of the view location from
the center of the 3D scene (zoom in and out).| Constructor and Description |
|---|
ViewPoint3D(double theta,
double phi,
double rho,
double orientation)
Creates a new viewing point.
|
ViewPoint3D(Point3D p,
double orientation)
Creates a new instance using the specified point and orientation.
|
| Modifier and Type | Method and Description |
|---|---|
double |
calcRollAngle()
Returns the roll angle (orientation) for the view point.
|
static ViewPoint3D |
createAboveLeftViewPoint(double rho)
Creates and returns a view point for looking at a chart from the
front and above and to the left.
|
static ViewPoint3D |
createAboveRightViewPoint(double rho)
Creates and returns a view point for looking at a chart from the
front and above and to the right.
|
static ViewPoint3D |
createAboveViewPoint(double rho)
Creates and returns a view point for looking at a chart from the
front and above.
|
boolean |
equals(java.lang.Object obj)
Tests this view point for equality with an arbitrary object.
|
Point3D |
getHorizontalRotationAxis()
Returns a vector at right angles to the viewing direction and the "up"
vector (this axis can be used to rotate forward and backwards).
|
double |
getPhi()
Returns the angle of the viewing point down from the z-axis.
|
Point3D |
getPoint()
Returns the location of the view point.
|
double |
getRho()
Returns the distance of the viewing point from the origin.
|
double |
getTheta()
Returns the angle of rotation from the x-axis about the z-axis,
in radians.
|
Point3D |
getVerticalRotationAxis()
Returns the vector that points "up" in relation to the orientation of
the view point.
|
double |
getX()
Returns the x-coordinate of the viewing point.
|
double |
getY()
Returns the y-coordinate of the viewing point.
|
double |
getZ()
Returns the z-coordinate of the viewing point.
|
void |
moveUpDown(double delta)
Moves the viewing point up or down on the viewing sphere.
|
float |
optimalDistance(java.awt.geom.Dimension2D target,
Dimension3D dim3D,
double projDist)
Calculate the distance that would render a box of the given dimensions
within a screen area of the specified size.
|
void |
panLeftRight(double delta)
Moves the viewing point left or right around the 3D scene.
|
void |
roll(double delta)
Rolls the view while leaving the location of the view point unchanged.
|
void |
setRho(double rho)
Sets the distance of the viewing point from the origin.
|
java.lang.String |
toString()
Returns a string representation of this instance, primarily for
debugging purposes.
|
Point3D |
worldToEye(Point3D p)
Converts a point in world coordinates to a point in eye coordinates.
|
java.awt.geom.Point2D |
worldToScreen(Point3D p,
double d)
Calculates and returns the screen coordinates for the specified point
in (world) 3D space.
|
public ViewPoint3D(double theta, double phi, double rho, double orientation)
theta - the rotation of the viewing point from the x-axis around
the z-axis (in radians)phi - the rotation of the viewing point up and down (from the
XZ plane, in radians)rho - the distance of the viewing point from the origin.orientation - the angle of rotation.public ViewPoint3D(Point3D p, double orientation)
p - the viewing point.orientation - the orientation.public static ViewPoint3D createAboveViewPoint(double rho)
rho - the distance.public static ViewPoint3D createAboveLeftViewPoint(double rho)
rho - the distance.public static ViewPoint3D createAboveRightViewPoint(double rho)
rho - the distance.public final double getTheta()
panLeftRight(double) and moveUpDown(double)
methods - there is no setter method, you cannot update it directly.public final double getPhi()
panLeftRight(double) and moveUpDown(double) methods
- there is no setter method, you cannot update it directly.public final double getRho()
setRho(double)public void setRho(double rho)
rho - the new distance.public final double getX()
public final double getY()
public final double getZ()
public final Point3D getPoint()
Point3D is created each time this method is called.null).public double calcRollAngle()
public void panLeftRight(double delta)
delta - the angle (in radians).public void moveUpDown(double delta)
delta - the angle delta (in radians).public void roll(double delta)
delta - the angle (in radians).public Point3D worldToEye(Point3D p)
p - the point (null not permitted).public java.awt.geom.Point2D worldToScreen(Point3D p, double d)
p - the point.d - the projection distance.public float optimalDistance(java.awt.geom.Dimension2D target, Dimension3D dim3D, double projDist)
target - the target dimension (null not permitted).dim3D - the dimensions of the 3D content (null not
permitted).projDist - the projection distance.public Point3D getVerticalRotationAxis()
null).public Point3D getHorizontalRotationAxis()
null).public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the object (null permitted).