public class FrustumWidget extends JOGLEdgedFacetedWidget
A rectangular frustum.
The face geometry has defined outward pointing unit normals. The edge geometry is composed of the near and far rectangular faces plus four axial lines along the frustum creases.
The horizontal and vertical subtended angles and near and far plane
locations are mutable. The near face is centered on and perpendicular to
the Z axis of the local coordinate frame, at positive depth near
;
the far face is also centered on and perpendicular to the Z axis and is at
positive depth far
>= near
. The frustum may be further
positioned e.g. by manipulating Widget.rx
.
trackWidgetLength(float...)
may be called to enable Widget.widgetLength
tracking, which causes near
and/or far
to track Widget.widgetLength
*trackNearFactor
and Widget.widgetLength
*trackFarFactor
, respectively.
Face vertex array is six tri strips:
H G D C A B E F
Edge vertex array is 1+1+4 line strips:
Copyright (C) 2008 Marsette A. Vona, III
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Modifier and Type | Field and Description |
---|---|
protected float |
angleX
the current apex angles
|
protected float |
angleY
the current apex angles
|
private static java.lang.String |
cvsid |
static float |
DEF_ANGLE_X
default angles for no-arg constructor
|
static float |
DEF_ANGLE_Y
default angles for no-arg constructor
|
static float |
DEF_FAR
default depths for no-arg constructor
|
static float |
DEF_NEAR
default depths for no-arg constructor
|
protected float |
far
the current near and far plane depths
|
protected float |
near
the current near and far plane depths
|
protected float |
trackFarFactor
mapping from
Widget.widgetLength to far , NaN if none |
protected float |
trackNearFactor
mapping from
Widget.widgetLength to near , NaN if none |
edgeGeometry, edgeVertices, faceGeometry, faceVertices, X, Y, Z
DASHED_PATTERN, DEF_EDGE_COLOR, DEF_OFFSET_BIAS, DEF_OFFSET_FACTOR, DOTTED_PATTERN, edgeAppearance, edgeColoringAttributes, edgeLineAttributes, EDGES, edgeTransparencyAttributes, facePolygonAttributes, SOLID_PATTERN
faceAppearance, faceMaterial, FACES, faceTransparencyAttributes
alpha, appearance, autoSetBoundingSpheres, boundingSphereCenter, boundingSphereCenterInView, boundingSphereRadius, boundingSphereRadiusInView, dbgEnabled, dbgNormalsGeometry, dbgNormalsVertices, dbgSpheresGeometry, dbgSpheresVertices, DEF_DBG_NORMAL_LENGTH, DEF_WIDGET_LENGTH, enabled, geometry, numGeometries, primitiveIterator, propertyMap, rx, vertexAccessor, widgetLength
Constructor and Description |
---|
FrustumWidget()
|
FrustumWidget(float angleX,
float angleY,
float near,
float far)
Creates a new FrustumWidget with given dims.
|
Modifier and Type | Method and Description |
---|---|
void |
enableAxialEdges(boolean enable)
enable/disable the four axial edges
|
void |
enableRadialEdges(boolean enable)
enable/disable the endcap edges
|
boolean |
setAngles(float angleX,
float angleY)
|
boolean |
setAngleX(float angleX)
covers
setAngles(float, float) , only sets horizontal angle |
boolean |
setAngleY(float angleY)
covers
setAngles(float, float) , only sets vertical angle |
boolean |
setFar(float far)
covers
setLengths(float, float) , only changes far |
boolean |
setLengths(float near,
float far)
|
boolean |
setLengthsAndAngles(float angleX,
float angleY,
float near,
float far)
Set the frustum dimensions.
|
boolean |
setNear(float near)
covers
setLengths(float, float) , only changes near |
void |
trackWidgetLength(float... trackFactor)
Set
trackNearFactor , trackFarFactor , see class header
doc. |
protected void |
widgetLengthChanged()
implements
Widget.widgetLength tracking, see class header doc |
gevc, gfnc, gfvc, sev, sevc, sfn, sfnc, sfv, sfvc
enableEdges, getEdgeAppearance, getEdgeGeometry, setAlpha, setColor, setColor, setEdgeAlpha, setEdgeColor, setEdgeColor, setEdgePattern, setEdgePattern, setEdgeWidth, setFaceOffset, setFaceOffsetBias, setFaceOffsetFactor
enableFaces, getFaceAppearance, getFaceGeometry, setFaceAlpha, setFaceColor, setFaceColor
cons, countGeometryArrays, disableBoundingSphere, disableBoundingSpheres, dump, dump, enableDBGGeometry, enableGeometry, ensureBoundingSpheresInView, getAppearance, getBoundingSphereCenter, getBoundingSphereRadius, getGeometry, getProperty, getWidget, getWidgetAlpha, hasBoundingSphere, hasBoundingSphereInView, hasProperty, indexOf, populateFrom, recomputeBoundingSphere, recomputeBoundingSpheres, removeDBGNormals, removeDBGSpheres, removeGeometry, removeGeometry, removeProperty, replaceAppearanceWithClone, replaceGeometryWithClone, scaleWidget, setAppearance, setBoundingSphereCenter, setBoundingSphereRadius, setGeometry, setGeometryAlpha, setGeometryAlpha, setGeometryAndAppearance, setProperty, setProperty, setWidgetAlpha, setWidgetLength, updateAllDBGNormals, updateAllDBGNormals, updateAllDBGSpheres, updateDBGNormals, updateDBGNormals, updateDBGSpheres, updateExistingDBGNormals, updateExistingDBGSpheres
private static final java.lang.String cvsid
public static final float DEF_ANGLE_X
public static final float DEF_ANGLE_Y
public static final float DEF_NEAR
public static final float DEF_FAR
protected float angleX
protected float angleY
protected float near
protected float far
protected float trackNearFactor
Widget.widgetLength
to near
, NaN if noneprotected float trackFarFactor
Widget.widgetLength
to far
, NaN if nonepublic FrustumWidget(float angleX, float angleY, float near, float far)
Creates a new FrustumWidget with given dims.
angleX
- the non-negative horizontal apex angle in radiansangleY
- the non-negative vertical apex angle in radiansnear
- the non-negative near distance <= farfar
- the non-negative far distance >= nearpublic FrustumWidget()
Covers FrustumWidget(float, float, float, float)
, uses DEF_ANGLE_X
, DEF_ANGLE_Y
, DEF_NEAR
, DEF_FAR
.
public void enableAxialEdges(boolean enable)
public void enableRadialEdges(boolean enable)
public boolean setLengthsAndAngles(float angleX, float angleY, float near, float far)
Set the frustum dimensions.
angleX
- the new horizontal apex angle in radians, ignored if NaN,
otherwise must be non-negativeangleY
- the new vertical apex angle in radians, ignored if NaN,
otherwise must be non-negativenear
- the new near plane distance, ignored if NaN, otherwise must be
non-negative and <= farfar
- the new far plane distance, ignored if NaN, otherwise must be
non-negative and >= nearpublic boolean setLengths(float near, float far)
Covers setLengthsAndAngles(float, float, float, float)
, does not change angleX
or
angleY
.
public boolean setNear(float near)
setLengths(float, float)
, only changes near
public boolean setFar(float far)
setLengths(float, float)
, only changes far
public boolean setAngles(float angleX, float angleY)
Covers setLengthsAndAngles(float, float, float, float)
, does not change near
or
far
.
public boolean setAngleX(float angleX)
setAngles(float, float)
, only sets horizontal anglepublic boolean setAngleY(float angleY)
setAngles(float, float)
, only sets vertical anglepublic void trackWidgetLength(float... trackFactor)
Set trackNearFactor
, trackFarFactor
, see class header
doc.
trackWidgetLength
in class Widget
protected void widgetLengthChanged()
Widget.widgetLength
tracking, see class header docwidgetLengthChanged
in class Widget