public class FixedMeshBody extends MeshComponent implements HasCoordinateFrame
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static PropertyList |
myProps |
DEFAULT_COLOR_INTERPOLATION, DEFAULT_SELECTABLE, DEFAULT_VERTEX_COLOR_MIXING
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
TG_ARTICULATED, TG_DRAGGER, TG_PRESERVE_ORIENTATION, TG_SIMULATING
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
FixedMeshBody()
Create an empty, unnamed FixedMeshBody.
|
FixedMeshBody(MeshBase mesh)
Create an unnamed FixedMeshBody containing the specified mesh.
|
FixedMeshBody(java.lang.String name)
Create an empty, named FixedMeshBody.
|
FixedMeshBody(java.lang.String name,
MeshBase mesh)
Create a named FixedMeshBody containing the specified mesh.
|
Modifier and Type | Method and Description |
---|---|
Vector3d |
centerPoseOnCentroid()
Adjusts the pose so that it reflects the mesh's centroid.
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
Renderer.AxisDrawStyle |
getAxisDrawStyle() |
double |
getAxisLength() |
Point3d |
getCentroid()
Returns the centroid of this mesh body.
|
AxisAngle |
getOrientation()
Queries the orientation of this body's coordinate frame relative to world.
|
RigidTransform3d |
getPose()
Queries the pose of this body's coordinate frame relative to world.
|
void |
getPose(RigidTransform3d XFrameToWorld) |
Point3d |
getPosition()
Queries the position of this body's coordinate frame relative to world.
|
Quaternion |
getRotation() |
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).
|
void |
render(Renderer renderer,
int flags)
Render this object using the functionality of the supplied
Renderer . |
void |
scaleDistance(double s)
Scales all distance coordinates.
|
void |
scaleMesh(double s) |
void |
scaleMesh(double sx,
double sy,
double sz) |
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
void |
setAxisDrawStyle(Renderer.AxisDrawStyle style) |
void |
setAxisLength(double len) |
void |
setMesh(MeshBase mesh,
java.lang.String fileName,
AffineTransform3dBase X)
Sets a mesh for this body.
|
void |
setMeshFromFile(MeshBase mesh,
java.lang.String fileName) |
void |
setMeshFromFile(MeshBase mesh,
java.lang.String fileName,
AffineTransform3dBase X) |
void |
setOrientation(AxisAngle axisAng)
Sets the orientation of this body's coordinate frame relative to world.
|
void |
setPose(RigidTransform3d XFrameToWorld)
Sets the pose of this body's coordinate frame relative to world.
|
void |
setPosition(Point3d pos)
Sets the position of this body's coordinate frame relative to world.
|
void |
setRotation(Quaternion q) |
void |
transformCoordinateFrame(RigidTransform3d TNB)
Transforms the coordinate frame of this body, given a transform
TNB from the new frame N to the current body frame B. |
void |
transformGeometry(GeometryTransformer gtr,
TransformGeometryContext context,
int flags)
Transforms the geometry of this component, using the geometry transformer
gtr to transform its individual attributes. |
void |
transformMesh(AffineTransform3dBase X) |
void |
translateCoordinateFrame(Point3d off)
Shifts the coordinate frame by a specified offset.
|
void |
updateBounds(Vector3d pmin,
Vector3d pmax)
Update the minimum and maximum points for this object.
|
addTransformableDependencies, copy, createSurfaceMeshArray, getColorInterpolation, getFileName, getFileTransform, getMesh, getMeshToWorld, getSurfaceMeshes, getVertex, getVertexColorMixing, isFileTransformRigid, isMeshModified, isMeshPolygonal, isMeshTriangular, isSelectable, numSurfaceMeshes, numVertices, prerenderMesh, render, scaleMass, setColorInterpolation, setFileName, setFileTransform, setMesh, setMesh, setMeshToWorld, setSelectable, setVertexColorMixing, transformGeometry, updatePosition, updateSlavePos
createRenderProps, defaultRenderPropsAreNull, getRenderHints, getRenderProps, getSelection, isVisible, numSelectionQueriesNeeded, setRenderProps, setVisible, updateRenderProps
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, hasState, isFixed, isMarked, isScanning, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, 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
transformPriority
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable, updateReferences
getProperty
getChildren, hasChildren
postscan
isWritable, write
public static PropertyList myProps
public FixedMeshBody()
public FixedMeshBody(java.lang.String name)
name
- name of the bodypublic FixedMeshBody(MeshBase mesh)
mesh
- mesh geometrypublic FixedMeshBody(java.lang.String name, MeshBase mesh)
name
- name of the bodymesh
- mesh geometrypublic PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class MeshComponent
public void setPose(RigidTransform3d XFrameToWorld)
XFrameToWorld
- pose of this body relative to worldpublic RigidTransform3d getPose()
public void getPose(RigidTransform3d XFrameToWorld)
getPose
in interface HasCoordinateFrame
public Point3d getPosition()
public void setPosition(Point3d pos)
pos
- new body positionpublic AxisAngle getOrientation()
public void setOrientation(AxisAngle axisAng)
axisAng
- body orientation relative to worldpublic Quaternion getRotation()
public void setRotation(Quaternion q)
public double getAxisLength()
public void setAxisLength(double len)
public Renderer.AxisDrawStyle getAxisDrawStyle()
public void setAxisDrawStyle(Renderer.AxisDrawStyle style)
public void setMeshFromFile(MeshBase mesh, java.lang.String fileName) throws java.io.IOException
java.io.IOException
public void setMeshFromFile(MeshBase mesh, java.lang.String fileName, AffineTransform3dBase X) throws java.io.IOException
java.io.IOException
public void scaleDistance(double s)
ScalableUnits
scaleDistance
in interface ScalableUnits
scaleDistance
in class MeshComponent
s
- scaling factorpublic void setMesh(MeshBase mesh, java.lang.String fileName, AffineTransform3dBase X)
setMesh
in class MeshComponent
public void scaleMesh(double sx, double sy, double sz)
public void scaleMesh(double s)
public void transformMesh(AffineTransform3dBase X)
public void transformGeometry(GeometryTransformer gtr, TransformGeometryContext context, int flags)
TransformableGeometry
gtr
to transform its individual attributes. The
context
argument supplies information about what other
components are currently being transformed, and also allows the
requesting of update actions to be performed after all transform called
have completed. The context is also the usual entity that calls
this method, from within its TransformGeometryContext.apply(maspack.geometry.GeometryTransformer, int)
method. The argument flags
provides flags to specify
various conditions associated with the the transformation.
At present, the available flags are TransformableGeometry.TG_SIMULATING
and
TransformableGeometry.TG_ARTICULATED
.
This method is not usually called directly by applications.
Instead, it is typically called from within the
TransformGeometryContext.apply(maspack.geometry.GeometryTransformer, int)
method of the context,
which takes care of the various operations needed for a
complete transform operation, including calling
TransformableGeometry.addTransformableDependencies(artisynth.core.modelbase.TransformGeometryContext, int)
to collect other
components that should be transformed, calling
TransformableGeometry.transformGeometry(maspack.matrix.AffineTransform3dBase)
for each component, notifying
component parents that the geometry has changed, and calling
any requested TransformGeometryAction
s. More details
are given in the documentation for
TransformGeometryContext.apply(maspack.geometry.GeometryTransformer, int)
.
TransformGeometryContext
provides a number of
static convenience transform
methods
which take care of building the context and calling
apply()
for a specified set of components.
This method should not
generally call transformGeometry()
for its descendant
components. Instead, descendants needing transformation should be
specified by adding them to the context in the method TransformableGeometry.addTransformableDependencies(artisynth.core.modelbase.TransformGeometryContext, int)
.
transformGeometry
in interface TransformableGeometry
transformGeometry
in class MeshComponent
gtr
- transformer implementing the transformcontext
- context information, including what other components
are being transformedflags
- specifies conditions associated with the transformationpublic void scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
ModelComponentBase
write
.scan
in interface ModelComponent
scan
in interface Scannable
scan
in class ModelComponentBase
rtok
- Tokenizer from which to scan the elementref
- optional reference object which can be used for resolving references to
other objectsjava.io.IOException
- if an I/O or formatting error occuredpublic void prerender(RenderList list)
IsRenderable
list.addIfVisible (obj);
for each of the objects in question.prerender
in interface IsRenderable
prerender
in class MeshComponent
list
- list of objects to be renderedpublic void updateBounds(Vector3d pmin, Vector3d pmax)
IsRenderable
updateBounds
in interface IsRenderable
updateBounds
in class MeshComponent
pmin
- minimum pointpmax
- maximum pointpublic void render(Renderer renderer, int flags)
IsRenderable
Renderer
.render
in interface IsRenderable
render
in class MeshComponent
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 Point3d getCentroid()
public Vector3d centerPoseOnCentroid()
public void translateCoordinateFrame(Point3d off)
public void transformCoordinateFrame(RigidTransform3d TNB)
TNB
from the new frame N to the current body frame B. If the current
pose if TBW
, the new pose will be updated to TBW TNB
. The
mesh geometry of the body will be adjusted so that they remain ``in
place''.