|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.algart.model3d.common.movement.model.ElasticBallsInteractionRule
public final class ElasticBallsInteractionRule extends java.lang.Object implements SymmetricInteractionRule
Interaction between two elastic balls
.
In this class, isApplicable
method returns true if and only if
both items are instances of ElasticBall
,
and in this case calculateForce
method fills resultXYZ vector
by some force F, depending on the volume of intersection of these 2 spheres
and, if their friction coefficients
are not zero,
on their relative velocities. The precise behaviour of this rule is not specified, but
it corresponds to the general specification of the elastic balls in ElasticBall
class.
Note that the interaction, specified by this class, is symmetric
.
Also note that if two spheres do not intersect, than the interaction force F=0.
This class is immutable and thread-safe: there are no ways to modify settings of the created instance.
AlgART Laboratory 2010
Constructor and Description |
---|
ElasticBallsInteractionRule()
|
Modifier and Type | Method and Description |
---|---|
boolean |
calculateForce(double[] resultXYZ,
Item toItem,
Item byItem,
double time)
Calculates the force F=(Fx,Fy,Fz) of the action of byItem to toItem and returns it in first 3 elements of resultXYZ array (x-component Fx |
boolean |
isApplicable(Item toItem,
Item byItem)
Checks whether this interaction type is applicable to the given items. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ElasticBallsInteractionRule()
Method Detail |
---|
public boolean isApplicable(Item toItem, Item byItem)
InteractionRule
InteractionRule.calculateForce(double[], Item, Item, double)
method fills its result
(first 3 elements of resultXYZ array) by 0.0.
If this method returns true, then with high probability
InteractionRule.calculateForce(double[], Item, Item, double)
method returns a non-zero force.
The arguments of this method can be null; in this case, this method returns false.
isApplicable
in interface InteractionRule
toItem
- the item to which byItem acts;
can be null, then this method returns false.byItem
- the acting item; can be null, then this method returns false.public boolean calculateForce(double[] resultXYZ, Item toItem, Item byItem, double time)
InteractionRule
This method must work correctly (return false and zero resulting force) also in all situations,
when InteractionRule.isApplicable(Item, Item)
method returns false.
calculateForce
in interface InteractionRule
resultXYZ
- resulting force (x-component in resultXYZ[0],
y-component in resultXYZ[1], z-component in resultXYZ[2]).toItem
- the item to which byItem acts.byItem
- the acting item.time
- the current time (some interaction can change behaviour in time).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |