public class Point extends DynamicComponentBase implements RenderablePoint, TransformableGeometry, ScalableUnits, DynamicComponent, Traceable, MotionTargetComponent, CopyableComponent, CollidableDynamicComponent
Modifier and Type | Field and Description |
---|---|
static PropertyList |
myProps |
float[] |
myRenderCoords |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
TRANSLUCENT, TWO_DIMENSIONAL
ARTICULATED, SIMULATING
COPY_REFERENCES
Modifier and Type | Method and Description |
---|---|
void |
addEffectiveMass(double m) |
void |
addExternalForce(Vector3d f) |
void |
addForce(Vector3d f) |
void |
addLocalForce(Vector3d f) |
void |
addPosImpulse(double[] xbuf,
int xidx,
double h,
double[] vbuf,
int vidx) |
void |
addPosJacobian(SparseNumberedBlockMatrix S,
double s)
Scales the components of the position Jacobian associated with this force
effector and adds it to the supplied solve matrix M.
|
void |
addScaledExternalForce(double s,
Vector3d f) |
void |
addScaledForce(double s,
Vector3d f) |
void |
addScaledLocalForce(double s,
Vector3d f) |
void |
addSolveBlock(SparseNumberedBlockMatrix S) |
void |
addSolveBlocks(SparseNumberedBlockMatrix S)
Adds any needed blocks to a solve matrix in order to accomodate the
Jacobian terms associated with this force effector.
|
int |
addTargetJacobian(SparseBlockMatrix J,
int bi)
Add a row to the motion target Jacobian for this motion target.
|
void |
addToPointVelocity(Vector3d vel,
double w,
ContactPoint cpnt)
Computes the velocity imparted to a contact point by this component's
current velocity, multiples it by a weighting factor
w ,
and add it to vel . |
void |
addToSolveBlockDiagonal(SparseNumberedBlockMatrix S,
double d) |
void |
addVelJacobian(SparseNumberedBlockMatrix S,
double s)
Scales the components of the velocity Jacobian associated with this force
effector and adds it to the supplied solve matrix M.
|
void |
applyExternalForces() |
void |
applyForces(double t)
Adds forces to the components affected by this force effector at a
particular time.
|
void |
applyGravity(Vector3d gacc)
Applies a gravity force to this component, given a prescribed
gravity acceleration vector.
|
ModelComponent |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap)
Create a copy of this component.
|
Matrix3x3DiagBlock |
createMassBlock()
Create a matrix block for representing the mass of this component,
initialized to the component's effective mass (instrinsic mass
plus the mass due to all attachmented components).
|
RenderProps |
createRenderProps()
Factory method to create render properties appropriate to this object.
|
MatrixBlock |
createSolveBlock() |
double |
distance(Point pnt) |
double |
distance(Point3d pos) |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
boolean |
getCopyReferences(java.util.List<ModelComponent> refs,
ModelComponent ancestor)
Collects external references which must also be copied in order to
duplicate this component.
|
double |
getEffectiveMass() |
void |
getEffectiveMass(Matrix M,
double t)
Gets the effective mass of this component at a particular time.
|
int |
getEffectiveMassForces(VectorNd f,
double t,
int idx)
Gets the mass forces for this component at a particular time.
|
Vector3d |
getExternalForce() |
Vector3d |
getForce() |
int |
getForce(double[] f,
int idx) |
int |
getJacobianType()
Returns a code indicating the matrix type that results when the Jacobian
terms of this force effector are added to the solve matrix.
|
Point3d |
getLocalPosition() |
void |
getLocalPosition(Vector3d pos) |
Vector3d |
getLocalVelocity() |
void |
getLocalVelocity(Vector3d vel) |
double |
getMass(double t)
Returns the scalar mass of this component at time t.
|
void |
getMass(Matrix M,
double t)
Gets the mass of this component at a particular time.
|
double |
getPointDamping() |
PropertyMode |
getPointDampingMode() |
Frame |
getPointFrame() |
int |
getPosDerivative(double[] dxdt,
int idx) |
Point3d |
getPosition()
Returns the current position of this point, in world coordinates.
|
void |
getPosition(Point3d pos) |
int |
getPosState(double[] x,
int idx) |
int |
getPosStateSize() |
float[] |
getRenderCoords() |
RenderProps |
getRenderProps()
Returns the render properities for this object.
|
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. |
int |
getState(VectorNd x,
int idx) |
MotionTarget.TargetActivity |
getTargetActivity() |
int |
getTargetPos(double[] post,
double s,
double h,
int idx) |
Point3d |
getTargetPosition() |
int |
getTargetVel(double[] velt,
double s,
double h,
int idx) |
Vector3d |
getTargetVelocity() |
java.lang.String |
getTraceablePositionProperty(java.lang.String traceableName)
For a given traceable property, returns the name of a property (if any)
which provides a reference position to be used for the traceable property.
|
java.lang.String[] |
getTraceables()
Returns a list of all traceable properties in this Traceable.
|
Vector3d |
getVelocity() |
void |
getVelocity(Vector3d vel) |
int |
getVelState(double[] v,
int idx) |
int |
getVelStateSize() |
boolean |
isDuplicatable()
Returns true if this component can be duplicated.
|
boolean |
isMassConstant() |
boolean |
isSelectable()
Returns true if this object is in fact selectable.
|
int |
mulInverseEffectiveMass(Matrix M,
double[] a,
double[] f,
int idx) |
void |
prerender(RenderList list)
Prepare for rendering, and potentially add itself to a list to be drawn
by a GLRenderer.
|
void |
render(GLRenderer renderer,
int flags)
Render this object using Open GL via the JOGL.
|
void |
resetEffectiveMass()
Resets the effective mass of this component to the nominal mass.
|
void |
resetTargets() |
void |
scaleDistance(double s)
Scales all distance coordinates.
|
void |
scaleMass(double s)
Scales all mass units.
|
void |
setContactConstraint(double[] buf,
double w,
Vector3d dir,
ContactPoint cpnt)
Computes the values for the block matrix which defines this component's
contribution to a contact constraint matrix.
|
void |
setExternalForce(Vector3d f) |
int |
setForce(double[] f,
int idx) |
void |
setForce(Vector3d f) |
void |
setLocalPosition(double x,
double y,
double z) |
void |
setLocalPosition(Vector3d pos) |
void |
setLocalVelocity(double x,
double y,
double z) |
void |
setLocalVelocity(Vector3d vel) |
void |
setPointDamping(double d) |
void |
setPointDampingMode(PropertyMode mode) |
void |
setPointFrame(Frame frame) |
void |
setPosition(double x,
double y,
double z) |
void |
setPosition(Point3d p) |
int |
setPosState(double[] p,
int idx) |
void |
setRenderProps(RenderProps props)
Assigns a new set of render properties to this object.
|
void |
setScaledExternalForce(double s,
Vector3d f) |
void |
setState(Point point) |
int |
setState(VectorNd x,
int idx) |
void |
setTargetActivity(MotionTarget.TargetActivity activity) |
int |
setTargetPos(double[] post,
int idx) |
void |
setTargetPosition(Point3d pos) |
int |
setTargetVel(double[] velt,
int idx) |
void |
setTargetVelocity(Vector3d vel) |
void |
setVelocity(double x,
double y,
double z) |
void |
setVelocity(Vector3d vel) |
int |
setVelState(double[] v,
int idx) |
void |
subForce(Vector3d f) |
void |
subLocalForce(Vector3d f) |
void |
transformGeometry(AffineTransform3dBase X)
Applies an affine transformation to the geometry of this object.
|
void |
transformGeometry(AffineTransform3dBase X,
TransformableGeometry topObject,
int flags)
Applies an affine transformation to the geometry of this object.
|
void |
updateBounds(Point3d pmin,
Point3d pmax)
Update the minimum and maximum points for this object.
|
void |
updatePosState() |
void |
updateVelState() |
boolean |
velocityLimitExceeded(double tlimit,
double rlimit)
Checks if the current component velocity exceeds specified limits.
|
void |
zeroExternalForces() |
void |
zeroForces() |
addMasterAttachment, getAttachment, getInverseMass, getMasterAttachments, getSolveIndex, hasState, isActive, isAttached, isControllable, isDynamic, isParametric, removeMasterAttachment, setAttached, setSolveIndex
getRenderHints, numSelectionQueriesNeeded, updateRenderProps
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, 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
isSelected
numSelectionQueriesNeeded
getRenderHints
addMasterAttachment, checkFlag, clearFlag, getAttachment, getInverseMass, getMasterAttachments, getSolveIndex, isActive, isAttached, isControllable, isDynamic, isParametric, removeMasterAttachment, setAttached, setFlag, setSolveIndex
public float[] myRenderCoords
public static PropertyList myProps
public Point()
public Point(Point3d pnt)
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class ModelComponentBase
public void setPointFrame(Frame frame)
public Frame getPointFrame()
public Vector3d getForce()
public void setForce(Vector3d f)
public void addForce(Vector3d f)
public void addScaledForce(double s, Vector3d f)
public void subForce(Vector3d f)
public void addLocalForce(Vector3d f)
public void addScaledLocalForce(double s, Vector3d f)
public void subLocalForce(Vector3d f)
public void zeroForces()
zeroForces
in interface DynamicComponent
public void applyExternalForces()
applyExternalForces
in interface DynamicComponent
public void addExternalForce(Vector3d f)
public void addScaledExternalForce(double s, Vector3d f)
public Vector3d getExternalForce()
public void setExternalForce(Vector3d f)
public void zeroExternalForces()
zeroExternalForces
in interface DynamicComponent
public void setScaledExternalForce(double s, Vector3d f)
public void applyForces(double t)
ForceEffector
applyForces
in interface ForceEffector
t
- time (seconds)public void addVelJacobian(SparseNumberedBlockMatrix S, double s)
ForceEffector
M is guaranteed to be the same matrix supplied in the most recent call to
addSolveBlocks
, and so implementations may choose
to cache the relevant matrix blocks from that call, instead of retrieving
them directly from M.
addVelJacobian
in interface ForceEffector
S
- solve matrix to which scaled velocity Jacobian is to be addeds
- scaling factor for velocity Jacobianpublic void addPosJacobian(SparseNumberedBlockMatrix S, double s)
ForceEffector
M is guaranteed to be the same matrix supplied in the most recent call to
addSolveBlocks
, and so implementations may choose
to cache the relevant matrix blocks from that call, instead of retrieving
them directly from M.
addPosJacobian
in interface ForceEffector
S
- solve matrix to which scaled position Jacobian is to be addeds
- scaling factor for position Jacobianpublic void addSolveBlocks(SparseNumberedBlockMatrix S)
ForceEffector
getSolveIndex
) for all dynamic or attached components affected by this
force effector.addSolveBlocks
in interface ForceEffector
S
- solve matrix to which blocks should be addedpublic int getJacobianType()
ForceEffector
Matrix.SYMMETRIC
or Matrix.POSITIVE_DEFINITE
. The former should be set if adding the Jacobian
terms preserves symmetry, and the latter should be set if positive
definiteness if preserved. Both should be set if there is no Jacobian for
this effector (i.e., the Jacobian methods are not implemented). Matrix
types from all the force effectors are logically and-ed together to
determine the type for the entire solve matrix.getJacobianType
in interface ForceEffector
public Point3d getPosition()
public void getPosition(Point3d pos)
public void setPosition(Point3d p)
public void setPosition(double x, double y, double z)
public double distance(Point pnt)
public double distance(Point3d pos)
public int getPosState(double[] x, int idx)
getPosState
in interface DynamicComponent
public int setPosState(double[] p, int idx)
setPosState
in interface DynamicComponent
public void addPosImpulse(double[] xbuf, int xidx, double h, double[] vbuf, int vidx)
addPosImpulse
in interface DynamicComponent
public int getPosDerivative(double[] dxdt, int idx)
getPosDerivative
in interface DynamicComponent
public Vector3d getVelocity()
public void getVelocity(Vector3d vel)
public void setVelocity(Vector3d vel)
public void setVelocity(double x, double y, double z)
public int getVelState(double[] v, int idx)
getVelState
in interface DynamicComponent
public int setVelState(double[] v, int idx)
setVelState
in interface DynamicComponent
public int setForce(double[] f, int idx)
setForce
in interface DynamicComponent
public int getForce(double[] f, int idx)
getForce
in interface DynamicComponent
public void resetTargets()
resetTargets
in interface MotionTargetComponent
public MotionTarget.TargetActivity getTargetActivity()
getTargetActivity
in interface MotionTargetComponent
public void setTargetActivity(MotionTarget.TargetActivity activity)
setTargetActivity
in interface MotionTargetComponent
public Point3d getTargetPosition()
public void setTargetPosition(Point3d pos)
public Vector3d getTargetVelocity()
public void setTargetVelocity(Vector3d vel)
public int getTargetVel(double[] velt, double s, double h, int idx)
getTargetVel
in interface MotionTargetComponent
public int setTargetVel(double[] velt, int idx)
setTargetVel
in interface MotionTargetComponent
public int getTargetPos(double[] post, double s, double h, int idx)
getTargetPos
in interface MotionTargetComponent
public int setTargetPos(double[] post, int idx)
setTargetPos
in interface MotionTargetComponent
public int addTargetJacobian(SparseBlockMatrix J, int bi)
vt = J u
addTargetJacobian
in interface MotionTargetComponent
J
- motion target Jacobianbi
- block row index for the row to be addedpublic double getPointDamping()
public void setPointDamping(double d)
public PropertyMode getPointDampingMode()
public void setPointDampingMode(PropertyMode mode)
public void applyGravity(Vector3d gacc)
applyGravity
in interface DynamicComponent
public float[] getRenderCoords()
getRenderCoords
in interface RenderablePoint
public void setRenderProps(RenderProps props)
HasRenderProps
null
will remove render properties from this object.setRenderProps
in interface HasRenderProps
setRenderProps
in class RenderableComponentBase
props
- new render properties for this objectpublic RenderProps getRenderProps()
HasRenderProps
getRenderProps
in interface HasRenderProps
getRenderProps
in class RenderableComponentBase
public RenderProps createRenderProps()
HasRenderProps
createRenderProps
in interface HasRenderProps
createRenderProps
in class RenderableComponentBase
public java.lang.String[] getTraceables()
getTraceables
in interface Traceable
public java.lang.String getTraceablePositionProperty(java.lang.String traceableName)
+
or
-
character, which is used to control the rendering
of the tracing probe in case the traceable property is a 3-vector.
A prepended +
character means that the vector will
be rendered starting at, and directed away from the reference
position (or render as pull), while a +
character
means that the vector will be rendered starting away from, and
directed into the reference position (or render as push).getTraceablePositionProperty
in interface Traceable
null
.public void prerender(RenderList list)
GLRenderable
prerender
in interface GLRenderable
prerender
in class RenderableComponentBase
public void updateBounds(Point3d pmin, Point3d pmax)
GLRenderable
updateBounds
in interface GLRenderable
updateBounds
in class RenderableComponentBase
pmin
- minimum pointpmax
- maximum pointpublic boolean isSelectable()
RenderableComponentBase
isSelectable
in interface GLSelectable
isSelectable
in class RenderableComponentBase
public void render(GLRenderer renderer, int flags)
GLRenderable
render
in interface GLRenderable
render
in class RenderableComponentBase
renderer
- renderer object which is used to perform the rendering. Provides pointers
to GL and GLU, along with helper functions.flags
- supplies flags that may be used to control different
aspects of the rendering. Flags are defined in GLRenderer
and currently include
GLRenderer.SELECTED
,
GLRenderer.VERTEX_COLORING
,
GLRenderer.HSV_COLOR_INTERPOLATION
,
GLRenderer.SORT_FACES
, and
GLRenderer.CLEAR_MESH_DISPLAY_LISTS
.public void getSelection(java.util.LinkedList<java.lang.Object> list, int qid)
GLSelectable
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 GLSelectable.numSelectionQueriesNeeded()
is positive), and qid
will in
turn be a number between 0 and nums
-1.getSelection
in interface GLSelectable
getSelection
in class RenderableComponentBase
list
- selected objects are appended to the end of this listqid
- index of the selection querypublic void scaleDistance(double s)
ScalableUnits
scaleDistance
in interface ScalableUnits
s
- scaling factorpublic void scaleMass(double s)
ScalableUnits
scaleMass
in interface ScalableUnits
s
- scaling factorpublic void transformGeometry(AffineTransform3dBase X, TransformableGeometry topObject, int flags)
TransformableGeometry
topComponent
should be the component for which the method
was initially invoked. The variable flags
provides
information about the context in which the transformation is
being applied. At present, the available flags are
TransformableGeometry.SIMULATING
and TransformableGeometry.ARTICULATED
.transformGeometry
in interface TransformableGeometry
X
- affine transformationtopObject
- component on which the method was initially invokedflags
- provides information about the context in which the
transformation is being applied.public void transformGeometry(AffineTransform3dBase X)
TransformableGeometry
transformGeometry (X, this, 0);
transformGeometry
in interface TransformableGeometry
X
- affine transformationpublic Matrix3x3DiagBlock createMassBlock()
DynamicComponent
createMassBlock
in interface DynamicComponent
public boolean isMassConstant()
isMassConstant
in interface DynamicComponent
public double getMass(double t)
DynamicComponent
getMass
in interface DynamicComponent
public void getMass(Matrix M, double t)
DynamicComponent
getMass
in interface DynamicComponent
M
- matrix to return the mass int
- current timepublic double getEffectiveMass()
public void getEffectiveMass(Matrix M, double t)
DynamicComponent
getEffectiveMass
in interface DynamicComponent
M
- matrix to return the mass int
- current timepublic int mulInverseEffectiveMass(Matrix M, double[] a, double[] f, int idx)
mulInverseEffectiveMass
in interface DynamicComponent
public int getEffectiveMassForces(VectorNd f, double t, int idx)
DynamicComponent
f
, starting at the location
specified by idx
. Upon return, this method should
return the value of idx
incremented by the dimension
of the mass forces.getEffectiveMassForces
in interface DynamicComponent
f
- vector to return the forces int
- current timeidx
- starting location within f
where forces should be storedidx
public void resetEffectiveMass()
DynamicComponent
resetEffectiveMass
in interface DynamicComponent
public void addEffectiveMass(double m)
public void addSolveBlock(SparseNumberedBlockMatrix S)
addSolveBlock
in interface DynamicComponent
addSolveBlock
in class DynamicComponentBase
public MatrixBlock createSolveBlock()
public void setState(Point point)
public int setState(VectorNd x, int idx)
public int getState(VectorNd x, int idx)
public void addToSolveBlockDiagonal(SparseNumberedBlockMatrix S, double d)
public boolean velocityLimitExceeded(double tlimit, double rlimit)
velocityLimitExceeded
in interface DynamicComponent
tlimit
- translational velocity limitrlimit
- rotational velocity limitpublic boolean isDuplicatable()
true
if and only if CopyableComponent.getCopyReferences(java.util.List<artisynth.core.modelbase.ModelComponent>, artisynth.core.modelbase.ModelComponent)
returns true.
This method is not currently used. It is intended to provide a faster
way of determining if a component can be duplicated, without having to
use CopyableComponent.getCopyReferences(java.util.List<artisynth.core.modelbase.ModelComponent>, artisynth.core.modelbase.ModelComponent)
to build the list of copy references.
isDuplicatable
in interface CopyableComponent
true
if this component can be duplicated.public boolean getCopyReferences(java.util.List<ModelComponent> refs, ModelComponent ancestor)
true
if and only if CopyableComponent.isDuplicatable()
returns
true.getCopyReferences
in interface CopyableComponent
refs
- list to which references are appendedancestor
- root node of the hierarchy from which references are to be excludedpublic ModelComponent copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
CopyableComponent
COPY_REFERENCES
is set in flags
, then any component referenced
by this component should itself be set to a copy. This
should be done first checking copyMap
for an
existing copy of the referenced component. If there is no existing
copy, then a copy should be created by calling copy
recursively and adding the new copy to copyMap
.copy
in interface CopyableComponent
copy
in class DynamicComponentBase
public int getVelStateSize()
getVelStateSize
in interface DynamicComponent
getVelStateSize
in interface MotionTargetComponent
public int getPosStateSize()
getPosStateSize
in interface DynamicComponent
getPosStateSize
in interface MotionTargetComponent
public void setContactConstraint(double[] buf, double w, Vector3d dir, ContactPoint cpnt)
CollidableDynamicComponent
n
is the component's velocity state size, and the contact is
defined by a direction dir
and a point cpnt
.
The computed values should be scaled by a weighting factor
w
.setContactConstraint
in interface CollidableDynamicComponent
buf
- returns the n values for the block matrixw
- weighting factor by which the values should be scaleddir
- contact direction (world coordinates)cpnt
- contact pointpublic void addToPointVelocity(Vector3d vel, double w, ContactPoint cpnt)
CollidableDynamicComponent
w
,
and add it to vel
.addToPointVelocity
in interface CollidableDynamicComponent
vel
- accumulates contact point velocity (world coordinates)w
- weighting factorcpnt
- contact pointpublic void getLocalPosition(Vector3d pos)
public Point3d getLocalPosition()
public void setLocalPosition(Vector3d pos)
public void setLocalPosition(double x, double y, double z)
public void getLocalVelocity(Vector3d vel)
public Vector3d getLocalVelocity()
public void setLocalVelocity(Vector3d vel)
public void setLocalVelocity(double x, double y, double z)
public void updatePosState()
public void updateVelState()