|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.mines.jtk.sgl.View
edu.mines.jtk.sgl.OrbitView
public class OrbitView
A view of a world, as if in orbit around that world. By default, the view camera is aimed towards the world, from a point outside the world's sphere. The camera's up axis is always aligned with lines of constant longitude. An orbit view is designed to draw on a single view canvas.
All views maintain a world-to-view transform. In an orbit view, that world-to-view transform is comprised of a world-to-unit-sphere transform and a unit-sphere-to-view transform.
The world-to-unit-sphere transform centers and normalizes the world. A world drawn by an orbit view has a world sphere that, by default, is the bounding sphere of the world when first viewed. The world-to-unit- sphere transform first translates the world sphere's center to the origin, and then scales the world sphere to have unit radius. The purpose of this first transform is to make other orbit view parameters independent of world coordinates. To modify the world-to-unit-sphere transform, set the world sphere.
The second unit-sphere-to-view transform applies a translate, scale, and rotate to the unit sphere, and then applies a final translate down the z-axis to push the transformed sphere into the view frustum. The orbit view applies the first translate, scale, and rotate in that order, so that the scale and rotate occurs about the center of the view.
The rotate part of the unit-sphere-to-view transform is comprised of two rotations, because an orbit view camera has both azimuth and elevation angles. Imagine a line from the center of the unit sphere to the camera. The point where that line intersects the sphere has a latitude and longitude. The azimuth angle is the longitude, positive for degrees East, negative for degrees West. The elevation angle is the latitude, positive for degrees North, negative for degrees South.
An orbit view supports both perspective and orthographic projections. For perspective projections, the field of view is computed by assuming that the distance from the eye to the default screen is approximately equal to the size of that screen.
| Nested Class Summary | |
|---|---|
static class |
OrbitView.Projection
Perspective or orthographic projection. |
| Constructor Summary | |
|---|---|
OrbitView()
Constructs an orbit view of no world. |
|
OrbitView(World world)
Constructs an orbit view of the specified world. |
|
| Method Summary | |
|---|---|
protected void |
draw(ViewCanvas canvas)
Draws this view on the specified canvas. |
double |
getAzimuth()
Gets the azimuth for this view. |
double |
getElevation()
Gets the elevation for this view. |
OrbitView.Projection |
getProjection()
Gets the projection for this view. |
double |
getScale()
Gets the scale factor for this view. |
Vector3 |
getTranslate()
Gets the translate vector for this view. |
Matrix44 |
getUnitSphereToView()
Gets the unit-sphere-to-view transform for this view. |
BoundingSphere |
getWorldSphere()
Gets the world sphere used to parameterize this view. |
Matrix44 |
getWorldToUnitSphere()
Gets the world-to-unit-sphere transform for this view. |
void |
reset()
Resets this view to its state when constructed. |
void |
setAzimuth(double azimuth)
Sets the azimuth for this view. |
void |
setAzimuthAndElevation(double azimuth,
double elevation)
Sets the azimuth and elevation for this view. |
void |
setElevation(double elevation)
Sets the elevation for this view. |
void |
setProjection(OrbitView.Projection projection)
Sets the projection for this view. |
void |
setScale(double scale)
Sets the scale factor for this view. |
void |
setTranslate(Vector3 translate)
Sets the translate vector for this view. |
void |
setWorldSphere(BoundingSphere worldSphere)
Sets the world sphere used to parameterize this view. |
protected void |
updateTransforms(ViewCanvas canvas)
Updates transforms for a canvas on which this view draws. |
| Methods inherited from class edu.mines.jtk.sgl.View |
|---|
countCanvases, getAxesOrientation, getAxesScale, getCanvases, getWorld, getWorldToView, repaint, setAxesOrientation, setAxesScale, setAxesScale, setWorld, setWorldToView, updateTransforms |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OrbitView()
public OrbitView(World world)
world - the world.| Method Detail |
|---|
public void reset()
public void setWorldSphere(BoundingSphere worldSphere)
worldSphere - the world sphere; null, if none.public BoundingSphere getWorldSphere()
public void setProjection(OrbitView.Projection projection)
projection - the projection.public OrbitView.Projection getProjection()
public void setAzimuth(double azimuth)
azimuth - the azimuth.public double getAzimuth()
public void setElevation(double elevation)
elevation - the elevation.public double getElevation()
public void setAzimuthAndElevation(double azimuth,
double elevation)
azimuth - the azimuth.elevation - the elevation.public void setScale(double scale)
scale - the scale factor.public double getScale()
public void setTranslate(Vector3 translate)
translate - the translate vector.public Vector3 getTranslate()
public Matrix44 getWorldToUnitSphere()
public Matrix44 getUnitSphereToView()
protected void updateTransforms(ViewCanvas canvas)
updateTransforms in class Viewcanvas - the view canvas.protected void draw(ViewCanvas canvas)
draw in class Viewcanvas - the canvas.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||