public abstract class CurveWidget extends Widget
Base class for widgets that are curves.
trackWidgetLength(float...)
may be called to enable Widget.widgetLength
tracking, which causes the length to track Widget.widgetLength
*trackLengthFactor
, maintaining the same midpoint and spatial
orientation.
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 javax.media.j3d.Appearance |
appearance
the appearance
|
private static java.lang.String |
cvsid |
static int |
DASHED_PATTERN
line attributes pattern mask
|
static float[] |
DEF_COLOR
default line color
|
static float[] |
DEF_END_COORD
default coords
|
static float[] |
DEF_START_COORD
default coords
|
static int |
DOTTED_PATTERN
line attributes pattern mask
|
protected float[] |
endColor
endpoint vertex colors
|
protected float[] |
endCoord
endpoint vertices
|
protected JOGLGeometry |
geometry
the geometry
|
protected javax.media.j3d.LineAttributes |
lineAttributes
the line attributes
|
static float[] |
ORIGIN
3D origin
|
static int |
SOLID_PATTERN
line attributes pattern mask
|
protected float[] |
startColor
endpoint vertex colors
|
protected float[] |
startCoord
endpoint vertices
|
protected float[] |
tempV3
temp storage
|
protected float |
trackLengthFactor
mapping from
Widget.widgetLength to segment length, NaN if none |
protected java.nio.FloatBuffer |
vertexBuffer
the vertex buffer
|
static int |
X
coordinate indices
|
static int |
Y
coordinate indices
|
static int |
Z
coordinate indices
|
alpha, autoSetBoundingSpheres, boundingSphereCenter, boundingSphereCenterInView, boundingSphereRadius, boundingSphereRadiusInView, dbgEnabled, dbgNormalsGeometry, dbgNormalsVertices, dbgSpheresGeometry, dbgSpheresVertices, DEF_DBG_NORMAL_LENGTH, DEF_WIDGET_LENGTH, enabled, numGeometries, primitiveIterator, propertyMap, rx, vertexAccessor, widgetLength
Constructor and Description |
---|
CurveWidget(int numVertices,
float[] startCoord,
float[] endCoord,
float[] startColor,
float[] endColor)
Creates a new CurveWidget from startCoord to endCoord.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
different(float[] a,
float[] b)
check if two vectors differ, iff they are the same length
|
protected void |
endDiffChanged(float... diffCoord)
hook called from
setEndDiff(float...) |
protected void |
extentsChanged(boolean startDiffers,
boolean endDiffers)
hook called from
setExtents(float[], float[]) |
boolean |
isDegenerate()
check if
startCoord and endCoord are the same |
protected void |
lengthChanged(float length,
float dx,
float dy,
float dz)
hook called from
setLength(float) |
protected void |
recomputeBoundingSphere(float[] a,
float[] b)
compute bounding sphere given two points on its diameter
|
void |
recomputeBoundingSpheres()
recompute the geometric bounding sphere
|
boolean |
setColor(java.awt.Color color)
covers
setColors(Color, Color) sets same colors |
boolean |
setColor(float... color)
covers
setColors(float[], float[]) sets same colors |
boolean |
setColors(java.awt.Color startColor,
java.awt.Color endColor)
covers
setColors(float[], float[]) |
boolean |
setColors(float[] startColor,
float[] endColor)
Update the terminal colors.
|
boolean |
setEnd(float... coord)
covers
setExtents(float[], float[]) , only sets end |
boolean |
setEndColor(java.awt.Color color)
covers
setColors(Color, Color) , only sets end color |
boolean |
setEndColor(float... color)
covers
setColors(float[], float[]) , only sets end color |
boolean |
setEndDiff(float... diffCoord)
set the end coord relative to the start coord
|
boolean |
setExtents(float[] startCoord,
float[] endCoord)
Update the terminal vertices.
|
boolean |
setLength(float length)
Update the start-to-end length, maintaining current midpoint and spatial
orientation.
|
void |
setLinePattern(int pattern)
covers
setLinePattern(int, int) , does not change scale |
void |
setLinePattern(int pattern,
int scale)
set the line pattern mask and scale
|
void |
setLineWidth(float width)
set the line width
|
boolean |
setStart(float... coord)
covers
setExtents(float[], float[]) , only sets start |
boolean |
setStartColor(java.awt.Color color)
covers
setColors(Color, Color) , only sets start color |
boolean |
setStartColor(float... color)
covers
setColors(float[], float[]) , only sets start color |
void |
trackWidgetLength(float... trackFactor)
set
trackLengthFactor , see class header doc |
protected abstract void |
update()
recompute coords, colors, and
recomputeBoundingSpheres() |
protected void |
widgetLengthChanged()
implements
Widget.widgetLength tracking, see class header doc |
cons, countGeometryArrays, disableBoundingSphere, disableBoundingSpheres, dump, dump, enableDBGGeometry, enableGeometry, ensureBoundingSpheresInView, getAppearance, getBoundingSphereCenter, getBoundingSphereRadius, getGeometry, getProperty, getWidget, getWidgetAlpha, hasBoundingSphere, hasBoundingSphereInView, hasProperty, indexOf, populateFrom, recomputeBoundingSphere, 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 int DASHED_PATTERN
public static final int DOTTED_PATTERN
public static final int SOLID_PATTERN
public static final int X
public static final int Y
public static final int Z
public static final float[] DEF_COLOR
public static final float[] ORIGIN
public static final float[] DEF_START_COORD
public static final float[] DEF_END_COORD
protected final JOGLGeometry geometry
protected final javax.media.j3d.Appearance appearance
protected final javax.media.j3d.LineAttributes lineAttributes
protected final java.nio.FloatBuffer vertexBuffer
protected float trackLengthFactor
Widget.widgetLength
to segment length, NaN if noneprotected final float[] startCoord
protected final float[] endCoord
protected final float[] startColor
protected final float[] endColor
protected final float[] tempV3
public CurveWidget(int numVertices, float[] startCoord, float[] endCoord, float[] startColor, float[] endColor)
Creates a new CurveWidget from startCoord to endCoord.
startCoord
- the coordinates of the start vertex, or null to use
DEF_START_COORD
endCoord
- the coordinates of the end vertex, or null to use DEF_END_COORD
startColor
- the color at the start vertex, or null to use DEF_COLOR
endColor
- the color at the end vertex, or null to use DEF_COLOR
public boolean setExtents(float[] startCoord, float[] endCoord)
Update the terminal vertices.
startCoord
- the new start vertex coords, or null to keep currentendCoord
- the new end vertex coords, or null to keep currentprotected void extentsChanged(boolean startDiffers, boolean endDiffers)
setExtents(float[], float[])
public boolean setStart(float... coord)
setExtents(float[], float[])
, only sets startpublic boolean setEnd(float... coord)
setExtents(float[], float[])
, only sets endpublic boolean setEndDiff(float... diffCoord)
protected void endDiffChanged(float... diffCoord)
setEndDiff(float...)
public boolean setLength(float length)
Update the start-to-end length, maintaining current midpoint and spatial orientation.
If the segment is currently degenerate its spatial orientation is taken to be (0, 0, 1).
length
- the new length, NaN or same as current to leave unchangedprotected void lengthChanged(float length, float dx, float dy, float dz)
setLength(float)
public boolean setColors(float[] startColor, float[] endColor)
Update the terminal colors.
startColor
- the new start color, or null to keep currentendColor
- the new end color, or null to keep currentpublic boolean setColors(java.awt.Color startColor, java.awt.Color endColor)
setColors(float[], float[])
public boolean setStartColor(float... color)
setColors(float[], float[])
, only sets start colorpublic boolean setEndColor(float... color)
setColors(float[], float[])
, only sets end colorpublic boolean setColor(float... color)
setColors(float[], float[])
sets same colorspublic boolean setStartColor(java.awt.Color color)
setColors(Color, Color)
, only sets start colorpublic boolean setEndColor(java.awt.Color color)
setColors(Color, Color)
, only sets end colorpublic boolean setColor(java.awt.Color color)
setColors(Color, Color)
sets same colorspublic void setLineWidth(float width)
public void setLinePattern(int pattern, int scale)
public void setLinePattern(int pattern)
setLinePattern(int, int)
, does not change scalepublic void trackWidgetLength(float... trackFactor)
trackLengthFactor
, see class header doctrackWidgetLength
in class Widget
public boolean isDegenerate()
startCoord
and endCoord
are the sameprotected void widgetLengthChanged()
Widget.widgetLength
tracking, see class header docwidgetLengthChanged
in class Widget
protected abstract void update()
recomputeBoundingSpheres()
public void recomputeBoundingSpheres()
recomputeBoundingSpheres
in class Widget
protected void recomputeBoundingSphere(float[] a, float[] b)
protected boolean different(float[] a, float[] b)