public class MFreeMeshComp extends FemMeshComp implements CollidableBody, PointAttachable
Collidable.Collidability, Collidable.GroupModelComponent.FilePathSaveType, ModelComponent.NavpanelVisibilityCompositeComponent.NavpanelDisplay| Modifier and Type | Field and Description |
|---|---|
static PropertyList |
myProps |
DEFAULT_COLOR_INTERPOLATION, DEFAULT_SELECTABLE, DEFAULT_VERTEX_COLOR_MIXINGenforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNamesAll, AllBodies, Deformable, Rigid, SelfTRANSPARENT, TWO_DIMENSIONALTG_ARTICULATED, TG_DRAGGER, TG_PRESERVE_ORIENTATION, TG_SIMULATING| Constructor and Description |
|---|
MFreeMeshComp() |
MFreeMeshComp(MFreeModel3d mfree) |
MFreeMeshComp(MFreeModel3d fem,
java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
addVertexAttachment(PointAttachment attachment) |
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. |
void |
collectVertexMasters(java.util.List<ContactMaster> mlist,
Vertex3d vtx)
Collects the contact masters for a particular mesh vertex.
|
void |
connectToHierarchy(CompositeComponent hcomp)
Called by the system after this component, or an ancestor of this
component, is added to the component hierarchy (i.e., added as
a child of another CompositeComponent).
|
boolean |
containsContactMaster(CollidableDynamicComponent comp)
Returns true if this Collidable contains a specified contact master
component.
|
MFreeMeshComp |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap) |
static MFreeMeshComp |
createEmbedded(MFreeMeshComp surf,
MeshBase mesh) |
static MFreeMeshComp |
createEmbedded(MFreeMeshComp surf,
MeshBase mesh,
MFreeModel3d mfree)
Assumes the mesh is in "rest" coordinates, not current coordinates
|
static MFreeMeshComp |
createEmbedded(MFreeModel3d fem,
MeshBase mesh) |
PointFem3dAttachment |
createPointAttachment(Point pnt)
Returns a PointAttachment that attaches
pnt
to this component. |
void |
disconnectFromHierarchy(CompositeComponent hcomp)
Called by the system after this component, or an ancestor of this
component, is removed from the component hierarchy (i.e., removed as a
child of its parent).
|
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. |
DistanceGridComp |
getDistanceGridComp()
Returns a
DistanceGridComp object that in turn contains
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). |
MFreeElement3d |
getFaceElement(Face face) |
MFreeModel3d |
getFem() |
double |
getMass()
Returns the mass of the body.
|
FemModel3d |
getModel() |
MFreeNode3d |
getNodeForVertex(Vertex3d vtx)
Returns the node to which a specified vertex is directly attached,
or
null if no such node exists. |
PointAttachment |
getVertexAttachment(int idx)
Retrieves (or creates) a vertex attachment component associated with
vertex vidx, describing how its motion is driven by the underlying
physical system.
|
PointAttachment |
getVertexAttachment(Vertex3d vtx)
Retrieves (or creates) a vertex attachment component associated with
vertex vtx, describing how its motion is driver by the underlying
physical system.
|
Vertex3d |
getVertexForNode(MFreeNode3d node)
Returns a vertex which is directly attached to the specified
node, or
null if no such vertex exists. |
boolean |
hasDistanceGrid()
Returns
true if this Collidable supports a signed
distance grid that can be used with a SignedDistanceCollider. |
boolean |
hasNodeDependency(MFreeNode3d node)
Check if this mesh depends on a particular node
|
boolean |
isCompound()
Queries whether or not this collidable has sub-collidables.
|
boolean |
isDeformable()
Returns
true if this collidable is deformable. |
boolean |
isSingleNodeMapped()
Returns
true if every vertex in this mesh is
directly attached to a single FEM node. |
boolean |
isSurfaceMesh() |
int |
numVertexAttachments() |
void |
render(Renderer renderer,
int flags)
Render this object using the functionality of the supplied
Renderer. |
MeshBase |
scanMesh(ReaderTokenizer rtok)
Scans this mesh from a file, using the format described for
writeMesh(java.lang.String). |
void |
setCollidable(Collidable.Collidability c) |
void |
setCollidableIndex(int idx) |
void |
setSurfaceRendering(FemModel.SurfaceRender mode) |
void |
setVertexAttachment(int vidx,
double[] weights,
MFreeNode3d[] nodes) |
void |
setVertexAttachment(int vidx,
PointAttachment attachment) |
boolean |
writeMesh(java.io.PrintWriter pw)
Writes the mesh for this FemMeshComp out to a PrintWriter, using a format
of the form
|
boolean |
writeMesh(java.io.PrintWriter pw,
boolean nodeFormat) |
boolean |
writeMesh(java.lang.String fileName)
Writes the mesh for this FemMeshComp out to a named file,
using the format described for
writeMesh(PrintWriter). |
createEmbedded, createEmbedded, createEmbedded, createEmbeddingAttachments, createNodalEmbedded, createNodalEmbedded, createShellSurface, createShellSurface, createShellSurface, createShellSurface, createSurface, createSurface, createSurface, createVolumetricShellSurface, createVolumetricSurface, createVolumetricSurface, createVolumetricSurface, createVolumetricSurface, getHalfEdgeForNodes, getNodes, getVertexEnergyDensity, getVertexForNode, getVertexStrain, getVertexStress, hasInvariantMasters, hasNodeDependency, isGeneratedSurface, isSurfaceEdge, postscan, setVertexAttachment, transformGeometrygetColorMap, getColorMapMode, getSelection, getStressPlotRange, getStressPlotRangeMode, getStressPlotRanging, getStressPlotRangingMode, getSurfaceRendering, getSurfaceRenderingMode, numSelectionQueriesNeeded, prerender, render, resetAutoStressPlotRange, setColorMap, setColorMapMode, setMeshFromInfo, setStressPlotRange, setStressPlotRangeMode, setStressPlotRanging, setStressPlotRangingMode, setSurfaceRenderingModegetSurfaceMesh, getSurfaceMeshes, numSurfaceMeshes, scaleDistance, setNavpanelDisplay, updateSlavePos, updateSlaveVeladdCurve, addCurve, addExternalCurve, addMeshMarker, addMeshMarker, addTransformableDependencies, clearCurves, clearMeshMarkers, createSurfaceMeshArray, getColorInterpolation, getCurves, getFileName, getFileTransform, getMesh, getMeshMarkers, getMeshToWorld, getSurfaceMeshes, getVertex, getVertexColorMixing, isFileTransformRigid, isMeshModified, isMeshPolygonal, isMeshTriangular, isSelectable, numSurfaceMeshes, numVertices, prerenderMesh, removeCurve, removeExternalCurve, removeMeshMarker, scaleMass, scan, setColorInterpolation, setFileName, setFileTransform, setMesh, setMesh, setMesh, setMeshToWorld, setSelectable, setVertexColorMixing, transformGeometry, updateBounds, updatePositioncreateRenderProps, getRenderHints, getRenderProps, setRenderPropscomponentChanged, findComponent, get, get, getByNumber, getChildren, getNavpanelDisplay, getNumberLimit, hasChildren, hasState, hierarchyContainsReferences, indexOf, iterator, numComponents, setDisplayMode, updateNameMapcheckFlag, checkName, checkNameUniqueness, clearFlag, clone, createTempFlag, 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, writeequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasInvariantMastersgetHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable, updateReferencesgetPropertygetChildren, hasChildrenpostscanisWritable, writegetMesh, isMeshPolygonalgetSelection, isSelectable, numSelectionQueriesNeededgetRenderHints, prerender, updateBoundscreateRenderProps, getRenderProps, setRenderPropscomponentChanged, findComponent, get, get, getByNumber, getNavpanelDisplay, getNumberLimit, hierarchyContainsReferences, indexOf, numComponents, recursivelyFind, updateNameMaptransformPrioritypublic static PropertyList myProps
public MFreeMeshComp()
public MFreeMeshComp(MFreeModel3d mfree)
public MFreeMeshComp(MFreeModel3d fem, java.lang.String name)
public PropertyList getAllPropertyInfo()
HasPropertiesgetAllPropertyInfo in interface HasPropertiesgetAllPropertyInfo in class FemMeshComppublic void setSurfaceRendering(FemModel.SurfaceRender mode)
setSurfaceRendering in class FemMeshBasepublic void render(Renderer renderer, int flags)
IsRenderableRenderer.render in interface IsRenderablerender in class FemMeshComprenderer - 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 int numVertexAttachments()
numVertexAttachments in class FemMeshComppublic PointAttachment getVertexAttachment(Vertex3d vtx)
DynamicMeshComponentgetVertexAttachment in class FemMeshCompvtx - vertexpublic PointAttachment getVertexAttachment(int idx)
DynamicMeshComponentgetVertexAttachment in class FemMeshCompidx - vertex indexpublic boolean isSingleNodeMapped()
true if every vertex in this mesh is
directly attached to a single FEM node. If this is the case, then
getNodeForVertex(maspack.geometry.Vertex3d) and getVertexForNode(artisynth.core.mfreemodels.MFreeNode3d) will never return
null.isSingleNodeMapped in class FemMeshComptrue if every vertex is attached
a single nodepublic MFreeNode3d getNodeForVertex(Vertex3d vtx)
null if no such node exists. In particular,
if the specified vertex is controlled by multiple nodes,
then this method will return null.getNodeForVertex in class FemMeshCompvtx - vertex being queriedvtx is directly attached, or
null.public Vertex3d getVertexForNode(MFreeNode3d node)
null if no such vertex exists.node - node whose vertex is being queriednull.public MFreeElement3d getFaceElement(Face face)
getFaceElement in class FemMeshComppublic static MFreeMeshComp createEmbedded(MFreeMeshComp surf, MeshBase mesh)
public MFreeModel3d getFem()
getFem in interface FemMeshgetFem in class FemMeshComppublic void addVertexAttachment(PointAttachment attachment)
addVertexAttachment in class FemMeshComppublic void setVertexAttachment(int vidx,
PointAttachment attachment)
setVertexAttachment in class FemMeshComppublic void setVertexAttachment(int vidx,
double[] weights,
MFreeNode3d[] nodes)
public static MFreeMeshComp createEmbedded(MFreeMeshComp surf, MeshBase mesh, MFreeModel3d mfree)
surf - mfree surface to populate (or null to create one)mesh - mesh to embedmfree - model to embed mesh inpublic static MFreeMeshComp createEmbedded(MFreeModel3d fem, MeshBase mesh)
public boolean writeMesh(java.lang.String fileName)
writeMesh(PrintWriter).writeMesh in class FemMeshCompfileName - Name of file to write the mesh totrue if the mesh is a polygonal mesh and was written,
and false otherwise.public boolean writeMesh(java.io.PrintWriter pw)
[ v 3 1.0 v 3 0.5 1 0.5 v 1 0.25 2 0.35 3 0.25 4 0.25 v 2 0.5 4 0.5 v 4 1.0 f 1 3 2 f 1 5 3 f 3 5 4 ]Here each line beginning with
v describes a mesh
vertex in terms of the FEM nodes to which it is attached.
This takes the form of a list of number/weight pairs:
v n_0 w_0 n_1 w_1 n_2 w_2 ...where
n_i and w_i indicate, respectively,
a FEM node (using its number as returned by
getNumber()),
and its corresponding weight. In the case where a vertex
is not associated with any nodes, then it is described by
a line of the form
v -1 pz py pzwhere
px, py, and pz
give the vertex's (fixed) position in space.
Each line beginning with f describes a mesh face,
using the vertex numbers in counter-clockwise order about the
outward facing normal. To be consistent with Wavefront .obj
format, the vertex numbers are 1-based and so are equal to the
vertex indices plus one.
If the mesh is not an instance of
PolygonalMesh, then the method does
nothing and returns null.
writeMesh in class FemMeshComppw - writer to whichmesh is writtentrue if the mesh is a polygonal mesh and was written,
and false otherwise.public boolean writeMesh(java.io.PrintWriter pw,
boolean nodeFormat)
writeMesh in class FemMeshComppublic MeshBase scanMesh(ReaderTokenizer rtok) throws java.io.IOException
writeMesh(java.lang.String). For backward compatibility, a format
of the form
[ f 0 1 2 f 2 3 4 f 4 5 6 ]Where no vertex information is given, and each face is instead described using the numbers of the FEM nodes that underlie each vertex. This makes the assumption that the mesh is single node mapped (i.e.,
isSingleNodeMapped() returns
true), so that each vertex is associated with
a single FEM node.scanMesh in class FemMeshComprtok - tokenizer from which mesh is readjava.io.IOExceptionpublic void connectToHierarchy(CompositeComponent hcomp)
ModelComponentBase When this method is called, ModelComponent.getParent() will return the new
parent component; the system will have set this beforehand.
connectToHierarchy in interface ModelComponentconnectToHierarchy in class FemMeshComphcomp - hierarchy component to which this component,
or its ancestor, was attachedpublic void disconnectFromHierarchy(CompositeComponent hcomp)
ModelComponentBase When this method is called, ModelComponent.getParent() will still return this
original parent component; the system will set this to null
after.
disconnectFromHierarchy in interface ModelComponentdisconnectFromHierarchy in class FemMeshComphcomp - hierarchy component from which this component,
or its ancestor, was detachedpublic MFreeMeshComp copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
copy in class FemMeshComppublic boolean isSurfaceMesh()
isSurfaceMesh in class FemMeshComppublic boolean hasNodeDependency(MFreeNode3d node)
public PolygonalMesh getCollisionMesh()
CollidableBodynull 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 CollidableBodygetCollisionMesh in class FemMeshComppublic boolean hasDistanceGrid()
CollidableBodytrue 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 CollidableBodyhasDistanceGrid in class FemMeshComptrue if this Collidable supports a signed
distance gridpublic DistanceGridComp getDistanceGridComp()
CollidableBodyDistanceGridComp object that in turn contains
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).getDistanceGridComp in interface CollidableBodygetDistanceGridComp in class FemMeshComppublic Collidable.Collidability getCollidable()
CollidableCollidable.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 CollidablegetCollidable in class FemMeshComppublic void setCollidable(Collidable.Collidability c)
setCollidable in class FemMeshComppublic Collidable getCollidableAncestor()
Collidablenull.getCollidableAncestor in interface CollidablegetCollidableAncestor in class FemMeshCompnull.public boolean isCompound()
CollidableisCompound in interface CollidableisCompound in class FemMeshComptrue if this collidable has sub-collidablespublic boolean isDeformable()
Collidabletrue 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 CollidableisDeformable in class FemMeshComptrue if this collidable is deformablepublic double getMass()
CollidableBodygetMass in interface CollidableBodygetMass in class FemMeshComppublic void collectVertexMasters(java.util.List<ContactMaster> mlist, Vertex3d vtx)
FemMeshCompmlist. The vertex
should be a vertex of the mesh returned by CollidableBody.getCollisionMesh().
If CollidableBody.hasInvariantMasters() returns true, then the
contact masters will not depend on vtx.
collectVertexMasters in interface CollidableBodycollectVertexMasters in class FemMeshCompmlist - collected master componentsvtx - vertex for which the master components are requestedpublic boolean containsContactMaster(CollidableDynamicComponent comp)
CollidableBodycontainsContactMaster in interface CollidableBodycontainsContactMaster in class FemMeshCompcomp - component to test fortrue if comp is contained in
this Collidablepublic boolean allowCollision(ContactPoint cpnt, Collidable other, java.util.Set<Vertex3d> attachedVertices)
CollidableBodytrue 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 CollidableBodyallowCollision in class FemMeshCompcpnt - contact point being testedother - opposing collidableattachedVertices - list of vertices attached to other.true if the collision should be allowedpublic int getCollidableIndex()
getCollidableIndex in interface CollidableBodygetCollidableIndex in class FemMeshComppublic void setCollidableIndex(int idx)
setCollidableIndex in interface CollidableBodysetCollidableIndex in class FemMeshComppublic PointFem3dAttachment createPointAttachment(Point pnt)
PointAttachablepnt
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 PointAttachablecreatePointAttachment in class FemMeshComppnt - point for which an attachment should be createdpnt to this componentpublic FemModel3d getModel()
getModel in class FemMeshComp