public class ViewUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ViewUtil.ViewState |
Constructor and Description |
---|
ViewUtil() |
Modifier and Type | Method and Description |
---|---|
static double |
computeElevationAboveSurface(DrawContext dc,
Position position) |
static Angle |
computeHeading(Matrix headingPitchZoomTransform) |
static double |
computeHorizonDistance(Globe globe,
double elevation) |
static ViewUtil.ViewState |
computeModelCoordinates(Globe globe,
Matrix modelTransform,
Vec4 centerPoint,
Vec4 eyePoint) |
static Matrix |
computeModelViewMatrix(Globe globe,
Vec4 eyePoint,
Vec4 centerPoint,
Vec4 up) |
static double |
computePerspectiveNearDistance(Angle fieldOfView,
double distanceToObject)
Computes the maximum near clip distance for a perspective projection that avoids clipping an object at a given
distance from the eye point.
|
static double |
computePerspectiveNearDistance(double farDistance,
double farResolution,
int depthBits)
Computes the near clip distance that corresponds to a specified far clip distance and a resolution at the far
clip distance.
|
static Angle |
computePitch(Matrix transform) |
static double |
computePixelSizeAtDistance(double distance,
Angle fieldOfView,
java.awt.Rectangle viewport) |
static Position |
computePosition(Globe globe,
Matrix transform) |
static Matrix |
computePositionTransform(Globe globe,
Position center) |
static Line |
computeRayFromScreenPoint(View view,
double x,
double y,
Matrix modelview,
Matrix projection,
java.awt.Rectangle viewport) |
static Angle |
computeRoll(Matrix transform) |
static Matrix |
computeTransformMatrix(Globe globe,
Position position,
Angle heading,
Angle pitch,
Angle roll) |
static Angle |
computeVerticalFieldOfView(Angle horizontalFieldOfView,
java.awt.Rectangle viewport)
Computes a View's vertical field-of-view given a View's horizontal field-of-view and the viewport window
dimensions.
|
static ViewUtil.ViewState |
computeViewState(Globe globe,
Vec4 eyePoint,
Vec4 centerPoint,
Vec4 up) |
static PositionAnimator |
createEyePositionAnimator(View view,
long timeToMove,
Position begin,
Position end) |
static AngleAnimator |
createHeadingAnimator(View view,
Angle begin,
Angle end)
Create an animator to animate heading.
|
static CompoundAnimator |
createHeadingPitchRollAnimator(View view,
Angle beginHeading,
Angle endHeading,
Angle beginPitch,
Angle endPitch,
Angle beginRoll,
Angle endRoll)
Create an animator to animate heading, pitch, and roll.
|
static AngleAnimator |
createPitchAnimator(View view,
Angle begin,
Angle end)
Create an animator to animate pitch.
|
static AngleAnimator |
createRollAnimator(View view,
Angle begin,
Angle end)
Create an animator to animate roll.
|
static Vec4 |
getUpVector(Globe globe,
Vec4 lookAtPoint) |
static Position |
normalizedEyePosition(Position unnormalizedPosition) |
static Angle |
normalizedHeading(Angle unnormalizedHeading) |
static Angle |
normalizedPitch(Angle unnormalizedPitch) |
static Angle |
normalizedRoll(Angle unnormalizedRoll) |
static Vec4 |
project(Vec4 modelPoint,
Matrix modelview,
Matrix projection,
java.awt.Rectangle viewport)
Transforms a point in model coordinates to a point in screen coordinates.
|
static java.awt.Point |
subtract(java.awt.Point a,
java.awt.Point b) |
static Vec4 |
unProject(Vec4 windowPoint,
Matrix modelview,
Matrix projection,
java.awt.Rectangle viewport)
Transforms a point in screen coordinates to a point in model coordinates.
|
static boolean |
validateViewState(ViewUtil.ViewState viewState) |
public static double computeElevationAboveSurface(DrawContext dc, Position position)
public static double computeHorizonDistance(Globe globe, double elevation)
public static ViewUtil.ViewState computeModelCoordinates(Globe globe, Matrix modelTransform, Vec4 centerPoint, Vec4 eyePoint)
public static Matrix computeModelViewMatrix(Globe globe, Vec4 eyePoint, Vec4 centerPoint, Vec4 up)
public static double computePerspectiveNearDistance(Angle fieldOfView, double distanceToObject)
fieldOfView
- The viewport rectangle, in OpenGL screen coordinates.distanceToObject
- The distance from the perspective eye point to the nearest object, in model coordinates.java.lang.IllegalArgumentException
- if the field of view is null, or if the distance is negative.public static double computePerspectiveNearDistance(double farDistance, double farResolution, int depthBits)
farDistance
- The far clip distance, in model coordinates.farResolution
- The depth resolution at the far clip plane, in model coordinates.depthBits
- The number of bitplanes in the depth buffer. This is typically 16, 24, or 32 for OpenGL
depth buffers.java.lang.IllegalArgumentException
- if either the distance or the resolution are negative, or if the depthBits is
less than one.public static double computePixelSizeAtDistance(double distance, Angle fieldOfView, java.awt.Rectangle viewport)
public static Matrix computePositionTransform(Globe globe, Position center)
public static Line computeRayFromScreenPoint(View view, double x, double y, Matrix modelview, Matrix projection, java.awt.Rectangle viewport)
public static Matrix computeTransformMatrix(Globe globe, Position position, Angle heading, Angle pitch, Angle roll)
public static Angle computeVerticalFieldOfView(Angle horizontalFieldOfView, java.awt.Rectangle viewport)
horizontalFieldOfView
- the angle between the view frustum's left and right clipping planes.viewport
- the viewport dimensions, in window coordinates (screen pixels).java.lang.IllegalArgumentException
- if the horitontal-field-of-view is null, or if the viewport rectangle is null.public static ViewUtil.ViewState computeViewState(Globe globe, Vec4 eyePoint, Vec4 centerPoint, Vec4 up)
public static PositionAnimator createEyePositionAnimator(View view, long timeToMove, Position begin, Position end)
public static AngleAnimator createHeadingAnimator(View view, Angle begin, Angle end)
view
- View to animatebegin
- starting headingend
- final headingpublic static CompoundAnimator createHeadingPitchRollAnimator(View view, Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch, Angle beginRoll, Angle endRoll)
view
- View to animatebeginHeading
- staring headingendHeading
- final headingbeginPitch
- starting pitchendPitch
- final pitchbeginRoll
- starting rollendRoll
- final rollpublic static AngleAnimator createPitchAnimator(View view, Angle begin, Angle end)
view
- View to animatebegin
- starting pitchend
- final pitchpublic static AngleAnimator createRollAnimator(View view, Angle begin, Angle end)
view
- View to animatebegin
- starting rollend
- final rollpublic static Vec4 project(Vec4 modelPoint, Matrix modelview, Matrix projection, java.awt.Rectangle viewport)
modelPoint
- the point in model coordinates to transform into window coordinates.modelview
- the modelview matrix.projection
- the projection matrix.viewport
- the viewport rectangle.java.lang.IllegalArgumentException
- if any of the model point, modelview matrix, projection matrix, or viewport
rectangle are null.public static java.awt.Point subtract(java.awt.Point a, java.awt.Point b)
public static Vec4 unProject(Vec4 windowPoint, Matrix modelview, Matrix projection, java.awt.Rectangle viewport)
windowPoint
- the point in screen coordinates to transform into model coordinates.modelview
- the modelview matrix.projection
- the projection matrix.viewport
- the viewport rectangle.java.lang.IllegalArgumentException
- if any of the model point, modelview matrix, projection matrix, or viewport
rectangle are null.public static boolean validateViewState(ViewUtil.ViewState viewState)