public class RigidMeshComp extends MeshComponent implements PointAttachable, HasSurfaceMesh, CollidableBody
Collidable.Collidability, Collidable.Group
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_PHYSICAL |
static PropertyList |
myProps |
DEFAULT_COLOR_INTERPOLATION, DEFAULT_VERTEX_COLOR_MIXING
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
All, AllBodies, Deformable, Rigid, Self
TG_ARTICULATED, TG_DRAGGER, TG_PRESERVE_ORIENTATION, TG_SIMULATING
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
RigidMeshComp() |
RigidMeshComp(MeshBase mesh,
java.lang.String fileName,
AffineTransform3dBase X) |
RigidMeshComp(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
boolean |
allowCollision(ContactPoint cpnt,
Collidable other,
java.util.Set<Vertex3d> attachedVertices)
Returns
true if a collision between this Collidable
and other should be allowed for the contact point
cpnt . |
boolean |
containsContactMaster(CollidableDynamicComponent comp)
Returns true if this Collidable contains a specified contact master
component.
|
RigidMeshComp |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap) |
PointFrameAttachment |
createPointAttachment(Point pnt)
Returns a PointAttachment that attaches
pnt
to this component. |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
Collidable.Collidability |
getCollidable()
Returns the
Collidable.Collidability of this Collidable. |
Collidable |
getCollidableAncestor()
Returns the most immediate Collidable ancestor of this Collidable,
if any.
|
int |
getCollidableIndex() |
PolygonalMesh |
getCollisionMesh()
Returns the mesh that should be used for computing collisions, or
null if there is no such mesh. |
DistanceGrid |
getDistanceGrid()
Returns a signed distance grid that can be used with a
SignedDistanceCollider, or
null if this Collidable
does not support a signed distance grid (i.e., if
CollidableBody.hasDistanceGrid() returns false ). |
double |
getMass() |
int |
getMaxGridDivisions() |
RigidBody |
getRigidBody() |
void |
getSelection(java.util.LinkedList<java.lang.Object> list,
int qid)
Append to
list the component (or components) associated with
the qid -th selection query issued by this component's render
method. |
PolygonalMesh |
getSurfaceMesh()
Returns the surface mesh associated with this component, or
null if no mesh exists. |
PolygonalMesh[] |
getSurfaceMeshes()
Returns an array listing all the (non-null) surface meshes associated
with this component, or a zero-length array if there are none.
|
void |
getVertexMasters(java.util.List<ContactMaster> mlist,
Vertex3d vtx)
Returns all the contact master components associated with a particular
mesh vertex.
|
boolean |
hasDistanceGrid()
Returns
true if this Collidable supports a signed
distance grid that can be used with a SignedDistanceCollider. |
boolean |
isCompound()
Queries whether or not this collidable has sub-collidables.
|
boolean |
isDeformable()
Returns
true if this collidable is deformable. |
boolean |
isPhysical() |
int |
numSelectionQueriesNeeded()
If this selectable manages its own selection (by issuing selection
queries within its
render method), then this method should
return the maximum number of selection queries that will be
required. |
int |
numSurfaceMeshes()
Returns the number of surfaces meshes associated with this
component, or 0 if no meshes exist.
|
void |
render(Renderer renderer,
RenderProps props,
int flags) |
void |
setCollidable(Collidable.Collidability c) |
void |
setCollidableIndex(int idx) |
void |
setMaxGridDivisions(int max) |
void |
setPhysical(boolean set) |
void |
transformGeometry(GeometryTransformer gtr,
TransformGeometryContext context,
int flags)
Transforms the geometry of this component, using the geometry transformer
gtr to transform its individual attributes. |
addTransformableDependencies, createRenderProps, createSurfaceMeshArray, getColorInterpolation, getFileTransform, getMesh, getMeshToWorld, getSurfaceMeshes, getVertex, getVertexColorMixing, isFileTransformRigid, isMeshModfied, numSurfaceMeshes, numVertices, prerender, render, scaleDistance, scaleMass, setColorInterpolation, setDefaultValues, setMesh, setMesh, setMesh, setMeshToWorld, setVertexColorMixing, transformGeometry, updateBounds, updatePosition, updateSlavePos
getRenderHints, getRenderProps, isSelectable, setRenderProps, updateRenderProps
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, hasState, isConnectedToHierarchy, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, postscan, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences
getProperty
getChildren, hasChildren
isWritable, write
public static boolean DEFAULT_PHYSICAL
public static PropertyList myProps
public RigidMeshComp()
public RigidMeshComp(java.lang.String name)
public RigidMeshComp(MeshBase mesh, java.lang.String fileName, AffineTransform3dBase X)
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class MeshComponent
public boolean isPhysical()
public void setPhysical(boolean set)
public void render(Renderer renderer, RenderProps props, int flags)
render
in class MeshComponent
public RigidBody getRigidBody()
public RigidMeshComp copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
copy
in class MeshComponent
public int numSelectionQueriesNeeded()
IsSelectable
render
method), then this method should
return the maximum number of selection queries that will be
required. Otherwise, this method should return -1.numSelectionQueriesNeeded
in interface IsSelectable
numSelectionQueriesNeeded
in class RenderableComponentBase
public void getSelection(java.util.LinkedList<java.lang.Object> list, int qid)
IsSelectable
list
the component (or components) associated with
the qid
-th selection query issued by this component's render
method. This will only be called if this component manages its own
selection (i.e., the number nums
returned by IsSelectable.numSelectionQueriesNeeded()
is positive), and qid
will in
turn be a number between 0 and nums
-1.getSelection
in interface IsSelectable
getSelection
in class RenderableComponentBase
list
- selected objects are appended to the end of this listqid
- index of the selection querypublic PolygonalMesh getCollisionMesh()
CollidableBody
null
if there is no such mesh. If this method
returns null
, then no collisions will
be performed for this collidable, regardless any default or explicit
collision behaviors that have been arranged by the system.getCollisionMesh
in interface CollidableBody
public boolean hasDistanceGrid()
CollidableBody
true
if this Collidable supports a signed
distance grid that can be used with a SignedDistanceCollider. At
present, this will only be true for non-deformable bodies.hasDistanceGrid
in interface CollidableBody
true
if this Collidable supports a signed
distance gridpublic DistanceGrid getDistanceGrid()
CollidableBody
null
if this Collidable
does not support a signed distance grid (i.e., if
CollidableBody.hasDistanceGrid()
returns false
).getDistanceGrid
in interface CollidableBody
public double getMass()
getMass
in interface CollidableBody
public Collidable getCollidableAncestor()
Collidable
null
.getCollidableAncestor
in interface Collidable
null
.public boolean isCompound()
Collidable
isCompound
in interface Collidable
true
if this collidable has sub-collidablespublic Collidable.Collidability getCollidable()
Collidable
Collidable.Collidability
of this Collidable. This provides
control over whether external and/or internal collisions are enabled for
this Collidable. This setting takes precedence over default and
explicitly requested collision behaviors.
Note that for collisions to actually occur, they still need to be enabled through either a default or explicit collision behavior in the MechModel.
getCollidable
in interface Collidable
public void setCollidable(Collidable.Collidability c)
public boolean isDeformable()
Collidable
true
if this collidable is deformable. Whether or
not a collidable is deformable determines how it responds to default
collision behaviors involving deformable and rigid collidables. Also,
self-collisions among sub-collidables of a collidable A are permitted
only if A is deformable.isDeformable
in interface Collidable
true
if this collidable is deformablepublic void getVertexMasters(java.util.List<ContactMaster> mlist, Vertex3d vtx)
CollidableBody
mlist
. The list should not be cleared. The vertex
should be a vertex of the mesh returned by CollidableBody.getCollisionMesh()
.getVertexMasters
in interface CollidableBody
mlist
- collected master component informationvtx
- vertex for which the master components are requestedpublic boolean containsContactMaster(CollidableDynamicComponent comp)
CollidableBody
containsContactMaster
in interface CollidableBody
comp
- component to test fortrue
if comp
is contained in
this Collidablepublic boolean allowCollision(ContactPoint cpnt, Collidable other, java.util.Set<Vertex3d> attachedVertices)
CollidableBody
true
if a collision between this Collidable
and other
should be allowed for the contact point
cpnt
. In making this decision, this method may
refer to attachedVertices
, which supplies a list
of vertices on this Collidable which are attached in some way
to the other Collidable.allowCollision
in interface CollidableBody
cpnt
- contact point being testedother
- opposing collidableattachedVertices
- list of vertices attached to other
.true
if the collision should be allowedpublic int getCollidableIndex()
getCollidableIndex
in interface CollidableBody
public void setCollidableIndex(int idx)
setCollidableIndex
in interface CollidableBody
public void setMaxGridDivisions(int max)
public int getMaxGridDivisions()
public PointFrameAttachment createPointAttachment(Point pnt)
PointAttachable
pnt
to this component. It should not be assumed that pnt
is currently connected to the component hierarchy, and no attempt
should be made to connect the returned attachment to the hierarchy;
the latter, if desired, is the responsibility of the caller.
In some cases, it may not be possible to attach the point at its present location. In that case, the method will create an attachment to the nearest feasible location.
createPointAttachment
in interface PointAttachable
pnt
- point for which an attachment should be createdpnt
to this componentpublic PolygonalMesh getSurfaceMesh()
HasSurfaceMesh
null
if no mesh exists. If multiple surface
meshes exist, this should be first one in the array returned
by HasSurfaceMesh.getSurfaceMeshes()
.getSurfaceMesh
in interface HasSurfaceMesh
public int numSurfaceMeshes()
HasSurfaceMesh
HasSurfaceMesh.getSurfaceMesh()
returns null
, then this method should return 0.numSurfaceMeshes
in interface HasSurfaceMesh
public PolygonalMesh[] getSurfaceMeshes()
HasSurfaceMesh
HasSurfaceMesh.getSurfaceMesh()
returns null
, then a
zero-length array should be returned.getSurfaceMeshes
in interface HasSurfaceMesh
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 transformation