public class MeshCurve extends RenderableCompositeBase
Modifier and Type | Class and Description |
---|---|
static class |
MeshCurve.Interpolation |
ModelComponent.NavpanelVisibility
CompositeComponent.NavpanelDisplay
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_CLOSED |
static MeshCurve.Interpolation |
DEFAULT_INTERPOLATION |
static double |
DEFAULT_NORMAL_LENGTH |
static boolean |
DEFAULT_PROJECT_TO_MESH |
static int |
DEFAULT_RESOLUTION |
static double |
INF |
static PropertyList |
myProps |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
MeshCurve() |
MeshCurve(MeshComponent mcomp) |
Modifier and Type | Method and Description |
---|---|
MeshMarker |
addMarker(Point3d pos) |
void |
clearMarkers() |
void |
componentChanged(ComponentChangeEvent e)
Notifies this composite component that a change has occured within one or
more of its descendants.
|
MeshCurve |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap) |
RenderProps |
createRenderProps()
Factory method to create render properties appropriate to this object.
|
double |
findNearestPoint(Point3d pr,
Point3d p0,
double r0)
Finds the nearest point on this curve to a prescribed point
p0 . |
double |
findPointAtDistance(Point3d pr,
Point3d p0,
double dist,
double r0)
Finds the point on this curve that is a specified distance
dist
from a prescribed point p0 , within machine precision. |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
MeshCurve.Interpolation |
getInterpolation() |
PointList<MeshMarker> |
getMarkers() |
PolygonalMesh |
getMesh() |
MeshComponent |
getMeshComp() |
Vector3d |
getNormal(int idx)
|
double |
getNormalComputeRadius()
Queries the radius around the marker used to collect vertices for
estimating its surface normal.
|
PropertyMode |
getNormalComputeRadiusMode() |
double |
getNormalLength() |
java.util.List<Vector3d> |
getNormals()
Returns a list of all the normals on this curve.
|
Vector3d |
getPoint(int idx)
|
java.util.List<Point3d> |
getPoints()
Returns a list of all the points on this curve.
|
boolean |
getProjectToMesh() |
double |
getResolution() |
Vector3d |
getTangent(int idx)
Returns the curve tangent for the
idx -th point on this curve,
where idx should be in the range 0 to numPoints() -1; The
tangent is computed by numerically differencing adjacent points. |
boolean |
isClosed() |
int |
numMarkers() |
int |
numPoints()
Returns the number of points (and normals) associated with this
MeshCurve.
|
void |
prerender(RenderList list)
Called prior to rendering to allow this object to update the internal
state required for rendering (such as by caching rendering coordinates).
|
boolean |
removeMarker(MeshMarker mkr) |
void |
render(Renderer renderer,
int flags)
Render this object using the functionality of the supplied
Renderer . |
void |
setClosed(boolean closed) |
void |
setInterpolation(MeshCurve.Interpolation interp) |
void |
setNormalComputeRadius(double rad)
Sets the radius around the marker used to collect vertices for estimating
its surface normal.
|
void |
setNormalComputeRadiusMode(PropertyMode mode) |
void |
setNormalLength(double len) |
void |
setProjectToMesh(boolean enable) |
void |
setResolution(double res) |
void |
updateBounds(Vector3d pmin,
Vector3d pmax)
Update the minimum and maximum points for this object.
|
void |
updateCurveIfNecessary() |
void |
updatePosition() |
getRenderHints, getRenderProps, getSelection, isSelectable, numSelectionQueriesNeeded, setRenderProps
findComponent, get, get, getByNumber, getChildren, getNavpanelDisplay, getNumberLimit, hasChildren, hasState, hierarchyContainsReferences, indexOf, iterator, numComponents, postscan, scan, setDisplayMode, updateNameMap
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, isFixed, isMarked, isScanning, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable, updateReferences, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable, updateReferences
getProperty
getChildren, hasChildren
postscan
isWritable, write
public static final double INF
public static int DEFAULT_RESOLUTION
public static boolean DEFAULT_CLOSED
public static MeshCurve.Interpolation DEFAULT_INTERPOLATION
public static double DEFAULT_NORMAL_LENGTH
public static boolean DEFAULT_PROJECT_TO_MESH
public static PropertyList myProps
public MeshCurve()
public MeshCurve(MeshComponent mcomp)
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class ModelComponentBase
public double getResolution()
public void setResolution(double res)
public MeshCurve.Interpolation getInterpolation()
public boolean isClosed()
public void setClosed(boolean closed)
public void setInterpolation(MeshCurve.Interpolation interp)
public double getNormalLength()
public void setNormalLength(double len)
public void setNormalComputeRadius(double rad)
rad
- normal compute radiuspublic double getNormalComputeRadius()
setNormalComputeRadius(double)
for a
description of how this is done.public PropertyMode getNormalComputeRadiusMode()
public void setNormalComputeRadiusMode(PropertyMode mode)
public boolean getProjectToMesh()
public void setProjectToMesh(boolean enable)
public PolygonalMesh getMesh()
public MeshComponent getMeshComp()
public MeshMarker addMarker(Point3d pos)
public PointList<MeshMarker> getMarkers()
public int numMarkers()
public boolean removeMarker(MeshMarker mkr)
public void clearMarkers()
public void updatePosition()
public int numPoints()
n
is determined by the curve's resolution
property, and is computed so that in the case of linear
interpolation between the knot points, the distance between each point
will be <=
resolution.public java.util.List<Point3d> getPoints()
numPoints
.public Vector3d getPoint(int idx)
idx
- index of the desired pointidx
-th pointpublic java.util.List<Vector3d> getNormals()
numPoints
.public Vector3d getNormal(int idx)
idx
- index of the desired normalidx
-th normalpublic Vector3d getTangent(int idx)
idx
-th point on this curve,
where idx
should be in the range 0 to numPoints()
-1; The
tangent is computed by numerically differencing adjacent points. If the
number of curve points is less than 1, the tangent is set to 0.idx
- index of the point for which the tangent is desiredidx
-th pointpublic double findPointAtDistance(Point3d pr, Point3d p0, double dist, double r0)
dist
from a prescribed point p0
, within machine precision. Point
locations on the curve are described by a non-negative parameter r
, which takes the form
r = k + swhere
k
is the index of a curve point (as returned by getPoints()
), and s
is a scalar parameter in the range [0,1]
that specifies the location along the interval between curve points
k
and k+1
. If the curve is open, the search for the
distance point begins at a location specified by r0
and locations
before r0
are ignored. If the curve is closed, r0
is
ignored.
If found, the method will return the point's location parameter r
, as well as the point's value in the optional parameter pr
if
it is not null
. If the point is not found, the method will return
-1.
pr
- if not null
, returns the distance point, if foundp0
- point with respect to which distance should be determineddist
- desired distance from p0
r0
- for open curves, a non-negative scalar giving the location on
the curve where the search should start. This should be a non-negative
scalar whose value is less than or equal to the number of curve points
(as returned by numPoints()
).public double findNearestPoint(Point3d pr, Point3d p0, double r0)
p0
. Locations on the curve are described by a non-negative
parameter r
, which takes the form
r = k + swhere
k
is the index of a curve point (as returned by getPoints()
), and s
is a scalar parameter in the range [0,1]
that specifies the location along the interval between curve points
k
and k+1
. If the curve is open, the search for the
nearest point begins at a location specified by r0
and locations
before r0
are ignored. If the polyline is closed, r0
is
ignored. The nearest point may not be unique.
The method will return the nearest point's location parameter r
, as well as the point's value in the optional parameter pr
if
it is not null
. If the curve is empty, both r
and
pr
at set to 0.
pr
- if not null
, returns the nearest pointp0
- point for which the nearest point should be determinedr0
- for open curves, a non-negative scalar giving the location
on the curve where the search should start. This should be a
non-negative scalar whose value is less than or equal to the number of
curve points (as returned by numPoints()
).public void updateCurveIfNecessary()
public void componentChanged(ComponentChangeEvent e)
CompositeComponentBase
This method should propagate the notification up the component hierarchy
by calling notifyParentOfChange
.
componentChanged
in interface ComponentChangeListener
componentChanged
in interface CompositeComponent
componentChanged
in class CompositeComponentBase
e
- optional argument giving specific information about the changepublic RenderProps createRenderProps()
HasRenderProps
createRenderProps
in interface HasRenderProps
createRenderProps
in class RenderableCompositeBase
public void prerender(RenderList list)
IsRenderable
list.addIfVisible (obj);
for each of the objects in question.prerender
in interface IsRenderable
prerender
in class RenderableCompositeBase
list
- list of objects to be renderedpublic void render(Renderer renderer, int flags)
IsRenderable
Renderer
.render
in interface IsRenderable
render
in class RenderableCompositeBase
renderer
- provides the functionality used to perform the rendering.flags
- flags that may be used to control different
aspects of the rendering. Flags are defined in Renderer
and currently include
Renderer.HIGHLIGHT
and
Renderer.SORT_FACES
.public void updateBounds(Vector3d pmin, Vector3d pmax)
IsRenderable
updateBounds
in interface IsRenderable
updateBounds
in class RenderableCompositeBase
pmin
- minimum pointpmax
- maximum pointpublic MeshCurve copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
copy
in class RenderableCompositeBase