public class RectangleWidget extends JOGLEdgedFacetedWidget
A rectangle.
The face geometry has defined normals. The edge geometry is the rectangle perimeter plus horizontal and vertical gridlines.
The min and max extents in each dimension are mutable, and the rectangle
faces are always axis-aligned. The rectangle lies in the XY plane with
outward normal along the positive Z axis. It may be further positioned
e.g. by manipulating Widget.rx
.
trackWidgetLength(float...)
may be called to enable Widget.widgetLength
tracking, which causes the width and/or height to track Widget.widgetLength
*trackWidthFactor
corresp. Widget.widgetLength
*trackHeightFactor
.
Face vertex array is one quad in ccw order from (xmin, ymin, 0).
Edge vertex array is four line segments in ccw order from (xmin, ymin,
0), defining the perimeter, followed by numXGridLines
vertical
segments from xmin to xmax, followed by numYGridLines
horizontal
segments from ymin to ymax.
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 |
---|---|
private static java.lang.String |
cvsid |
protected static float[] |
DUMMY_CENTER
used in some apis if an explicit center is not passed
|
protected float[][] |
extent
extent indexed by [coord][direction]
|
protected int |
numXGridLines
the number of gridlines in each dimension
|
protected int |
numYGridLines
the number of gridlines in each dimension
|
protected float |
trackHeightFactor
mapping from
Widget.widgetLength to height, NaN if none |
protected float |
trackWidthFactor
mapping from
Widget.widgetLength to width, 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 |
---|
RectangleWidget()
Covers
RectangleWidget(float, float, float, float, int, int) ,
centers a width 1.0f square on the origin, no grid lines. |
RectangleWidget(float width)
Covers
RectangleWidget(float, float, float, float, int, int) ,
makes a square of the given width around the origin with no grid
lines. |
RectangleWidget(float[] min,
float[] max)
Covers
RectangleWidget(float, float, float, float, int, int) ,
zero grid lines. |
RectangleWidget(float[] min,
float[] max,
int numGridLines)
Covers
RectangleWidget(float, float, float, float, int, int) ,
equal numbers horizontal and vertical grid lines. |
RectangleWidget(float[] min,
float[] max,
int numXGridLines,
int numYGridLines)
|
RectangleWidget(float width,
float height)
Covers
RectangleWidget(float, float, float, float, int, int) ,
makes a rectangle of the given dims around the origin with no grid
lines. |
RectangleWidget(float width,
float height,
float[] center,
int numXGridLines,
int numYGridLines)
Covers
RectangleWidget(float, float, float, float, int, int) ,
makes a rectangle of the given widths around the given center. |
RectangleWidget(float xMin,
float yMin,
float xMax,
float yMax)
Covers
RectangleWidget(float, float, float, float, int, int) ,
zero grid lines. |
RectangleWidget(float xMin,
float yMin,
float xMax,
float yMax,
int numGridLines)
Covers
RectangleWidget(float, float, float, float, int, int) ,
equal numbers horizontal and vertical grid lines. |
RectangleWidget(float xMin,
float yMin,
float xMax,
float yMax,
int numXGridLines,
int numYGridLines)
Creates a new RectangleWidget with the given extents.
|
RectangleWidget(float width,
float height,
int numGridLines)
Covers
RectangleWidget(float, float, float, float, int, int) ,
makes a rectangle of the given dims around the origin with equal numbers
horizontal and vertical grid lines. |
RectangleWidget(float width,
float height,
int numXGridLines,
int numYGridLines)
Covers
RectangleWidget(float, float, float, float, int, int) ,
makes a rectangle of the given dims around the origin. |
RectangleWidget(float width,
int numGridLines)
Covers
RectangleWidget(float, float, float, float, int, int) ,
makes a square of the given width around the origin with equal numbers
horizontal and vertical grid lines. |
RectangleWidget(int numGridLines)
Covers
RectangleWidget(float, float, float, float, int, int) ,
centers a width 1.0f square on the origin, equal numbers horizontal and
vertical grid lines. |
RectangleWidget(int numXGridLines,
int numYGridLines)
Covers
RectangleWidget(float, float, float, float, int, int) ,
centers a width 1.0f square on the origin. |
Modifier and Type | Method and Description |
---|---|
void |
enableXAxisEdges(boolean enable)
enable/disable the perimeter edges perpendicular to the X axis
|
void |
enableXGridLines(boolean enable) |
void |
enableYAxisEdges(boolean enable)
enable/disable the perimeter edges perpendicular to the Y axis
|
void |
enableYGridLines(boolean enable) |
protected static float[] |
ensureCenter(float[] center)
returns center if usable, else
DUMMY_CENTER |
boolean |
setExtents(float[] min,
float[] max)
|
boolean |
setExtents(float xMin,
float yMin,
float xMax,
float yMax)
Set the rectangle extents.
|
boolean |
setLengths(float width,
float height)
covers
setSymmetricExtents(float, float, float...) , uses current center |
boolean |
setSymmetricExtents(float width,
float height,
float... center)
Covers
setExtents(float, float, float, float) , sets symmetric
extents wrt center. |
boolean |
setXExtents(float min,
float max)
Covers
setExtents(float, float, float, float) , only sets x
extents. |
boolean |
setXLength(float length)
covers
setLengths(float, float) , only sets x length |
boolean |
setYExtents(float min,
float max)
Covers
setExtents(float, float, float, float) , only sets y
extents. |
boolean |
setYLength(float length)
covers
setLengths(float, float) , only sets y length |
void |
trackWidgetLength(float... trackFactor)
Set
trackWidthFactor , trackHeightFactor , 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
protected static final float[] DUMMY_CENTER
protected float[][] extent
protected float trackWidthFactor
Widget.widgetLength
to width, NaN if noneprotected float trackHeightFactor
Widget.widgetLength
to height, NaN if noneprotected final int numXGridLines
protected final int numYGridLines
public RectangleWidget(float xMin, float yMin, float xMax, float yMax, int numXGridLines, int numYGridLines)
Creates a new RectangleWidget with the given extents.
The min extent in each dimension must be less than or equal to the max extent in that dimension.
public RectangleWidget(float xMin, float yMin, float xMax, float yMax, int numGridLines)
Covers RectangleWidget(float, float, float, float, int, int)
,
equal numbers horizontal and vertical grid lines.
public RectangleWidget(float xMin, float yMin, float xMax, float yMax)
Covers RectangleWidget(float, float, float, float, int, int)
,
zero grid lines.
public RectangleWidget(float[] min, float[] max, int numXGridLines, int numYGridLines)
public RectangleWidget(float[] min, float[] max, int numGridLines)
Covers RectangleWidget(float, float, float, float, int, int)
,
equal numbers horizontal and vertical grid lines.
public RectangleWidget(float[] min, float[] max)
Covers RectangleWidget(float, float, float, float, int, int)
,
zero grid lines.
public RectangleWidget(int numXGridLines, int numYGridLines)
Covers RectangleWidget(float, float, float, float, int, int)
,
centers a width 1.0f square on the origin.
public RectangleWidget(int numGridLines)
Covers RectangleWidget(float, float, float, float, int, int)
,
centers a width 1.0f square on the origin, equal numbers horizontal and
vertical grid lines.
public RectangleWidget()
Covers RectangleWidget(float, float, float, float, int, int)
,
centers a width 1.0f square on the origin, no grid lines.
public RectangleWidget(float width, float height, float[] center, int numXGridLines, int numYGridLines)
Covers RectangleWidget(float, float, float, float, int, int)
,
makes a rectangle of the given widths around the given center.
center
- the center for the rectangle or null or empty to use the
originpublic RectangleWidget(float width, float height, int numXGridLines, int numYGridLines)
Covers RectangleWidget(float, float, float, float, int, int)
,
makes a rectangle of the given dims around the origin.
public RectangleWidget(float width, float height, int numGridLines)
Covers RectangleWidget(float, float, float, float, int, int)
,
makes a rectangle of the given dims around the origin with equal numbers
horizontal and vertical grid lines.
public RectangleWidget(float width, float height)
Covers RectangleWidget(float, float, float, float, int, int)
,
makes a rectangle of the given dims around the origin with no grid
lines.
public RectangleWidget(float width, int numGridLines)
Covers RectangleWidget(float, float, float, float, int, int)
,
makes a square of the given width around the origin with equal numbers
horizontal and vertical grid lines.
public RectangleWidget(float width)
Covers RectangleWidget(float, float, float, float, int, int)
,
makes a square of the given width around the origin with no grid
lines.
protected static float[] ensureCenter(float[] center)
DUMMY_CENTER
public void enableXAxisEdges(boolean enable)
public void enableYAxisEdges(boolean enable)
public void enableXGridLines(boolean enable)
public void enableYGridLines(boolean enable)
public boolean setExtents(float xMin, float yMin, float xMax, float yMax)
Set the rectangle extents.
Any parameter passed as NaN will be ignored (the curent value of that extent will be retained). Each non-NaN parameter must be correctly ordered with respect to the other (new) extent in that dimension.
public boolean setExtents(float[] min, float[] max)
public boolean setSymmetricExtents(float width, float height, float... center)
Covers setExtents(float, float, float, float)
, sets symmetric
extents wrt center.
Any length parameter passed as NaN will be ignored (the curent value of that extent will be retained). Each non-NaN parameter must be non-negative.
center
- the center for the rect or null or empty to use the current
centerpublic boolean setLengths(float width, float height)
setSymmetricExtents(float, float, float...)
, uses current centerpublic boolean setXLength(float length)
setLengths(float, float)
, only sets x lengthpublic boolean setYLength(float length)
setLengths(float, float)
, only sets y lengthpublic boolean setXExtents(float min, float max)
Covers setExtents(float, float, float, float)
, only sets x
extents.
public boolean setYExtents(float min, float max)
Covers setExtents(float, float, float, float)
, only sets y
extents.
public void trackWidgetLength(float... trackFactor)
Set trackWidthFactor
, trackHeightFactor
, see class
header doc.
trackWidgetLength
in class Widget
protected void widgetLengthChanged()
Widget.widgetLength
tracking, see class header docwidgetLengthChanged
in class Widget