|
|
||||||||
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.ElasticBall
public final class ElasticBall extends java.lang.Object implements Item, HavingCenter, Spherical, HavingInteractionRadius, HavingMass, HavingVelocity
Elastic ball: a sphere with some density ρ and elasticity modulus μ, which can interact with other balls
and items as a solid body. The basic types of interaction, applying to this item, are
ElasticBallsInteractionRule
, ElasticBallByBunkerWallInteractionRule
,
EarthGravitationRule
and PhysicalMediumResistanceRule
.
Any elastic ball has a mass
m=4/3πr3ρ,
ρ is the density of the ball. Also an elastic ball has an elasticity modulus μ, which affects
the force of interaction with other solid items: if two items (for example, balls) little intersects,
the corresponding interaction rule produces a repulsion force, depending on the volume of intersection,
and μ is the proportionality coefficient in that dependence.
At last, any elastic ball has a friction coefficient, which is used
while calculating friction force between two items.
Any elastic ball has an interaction radius
, which is just equal to its
usual radius
. In other words, it is supposed that elastic ball can interact with other
item only if they intersect.
This class is not thread-safe, but is thread-compatible and can be synchronized manually if multithread access is necessary.
AlgART Laboratory 2010
Constructor and Description |
---|
ElasticBall(double x,
double y,
double z,
double radius,
double density,
double elasticityModulus,
double frictionCoefficient)
Creates new elastic ball with the specified parameters. |
Modifier and Type | Method and Description |
---|---|
double |
getCenterX()
Returns x-coordinate of the item's center. |
double |
getCenterY()
Returns y-coordinate of the item's center. |
double |
getCenterZ()
Returns z-coordinate of the item's center. |
float |
getDensity()
Returns the density ρ of this ball. |
double |
getElasticityModulus()
Returns the elasticity modulus. |
float |
getFrictionCoefficient()
Returns the friction coefficient. |
double |
getMass()
Returns the mass of this item. |
double |
getMaxInteractionRadius()
Returns the interaction radius R: maximal distance from the center where this object can affect to other item, also implementing this interface. |
double |
getRadius()
Returns the radius of this spherical item. |
double |
getVelocityX()
Returns x-component of the velocity of the item's center. |
double |
getVelocityY()
Returns y-component of the velocity of the item's center. |
double |
getVelocityZ()
Returns z-component of the velocity of the item's center. |
boolean |
intersects(Spherical other)
Returns true if and only if this sphere intersects the specified other sphere, i.e. |
boolean |
isInfinite()
Returns true if at least one of 3 coordinates of the item's center is Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY. |
boolean |
isNaN()
Returns true if at least one of 3 coordinates of the item's center is NaN. |
void |
setCenter(double x,
double y,
double z)
Sets all coordinates of the item's center. |
void |
setCenterX(double x)
Sets x-coordinate of the item's center. |
void |
setCenterY(double y)
Sets y-coordinate of the item's center. |
void |
setCenterZ(double z)
Sets z-coordinate of the item's center. |
void |
setDensity(float density)
Sets the density ρ of this ball. |
void |
setRadius(double radius)
Sets the radius of this ball. |
void |
setVelocity(double velocityX,
double velocityY,
double velocityZ)
Sets all components of the velocity of the item's center. |
void |
setVelocityX(double velocityX)
Sets x-component of the velocity of the item's center. |
void |
setVelocityY(double velocityY)
Sets y-component of the velocity of the item's center. |
void |
setVelocityZ(double velocityZ)
Sets z-component of the velocity of the item's center. |
double |
squareOfDistance(HavingCenter other)
Returns the square of the distance between this item's center and the center of the specified item. |
java.lang.String |
toString()
Returns a brief string description of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ElasticBall(double x, double y, double z, double radius, double density, double elasticityModulus, double frictionCoefficient)
x
- initial x-coordinate of the center.y
- initial y-coordinate of the center.z
- initial z-coordinate of the center.radius
- the radius of the new ball.density
- the density ρ of the new ball.elasticityModulus
- the elasticity modulus μ of the new ball (cannot be changed in future).frictionCoefficient
- the friction coefficient of the new ball (cannot be changed in future).java.lang.IllegalArgumentException
- if the passed radius is negative (< 0).Method Detail |
---|
public float getDensity()
public void setDensity(float density)
density
- new density ρ of this ball.public double getElasticityModulus()
public float getFrictionCoefficient()
public final double getCenterX()
HavingCenter
getCenterX
in interface HavingCenter
public final double getCenterY()
HavingCenter
getCenterY
in interface HavingCenter
public final double getCenterZ()
HavingCenter
getCenterZ
in interface HavingCenter
public void setCenterX(double x)
HavingCenter
setCenterX
in interface HavingCenter
x
- new x-coordinate of the new item's center.public void setCenterY(double y)
HavingCenter
setCenterY
in interface HavingCenter
y
- new y-coordinate of the new item's center.public void setCenterZ(double z)
HavingCenter
setCenterZ
in interface HavingCenter
z
- new z-coordinate of the new item's center.public void setCenter(double x, double y, double z)
HavingCenter
setCenter
in interface HavingCenter
x
- new x-coordinate of the new item's center.y
- new y-coordinate of the new item's center.z
- new z-coordinate of the new item's center.public boolean isNaN()
HavingCenter
isNaN
in interface HavingCenter
public boolean isInfinite()
HavingCenter
isInfinite
in interface HavingCenter
public final double squareOfDistance(HavingCenter other)
HavingCenter
squareOfDistance
in interface HavingCenter
other
- some other item, which also has a center.public double getRadius()
Spherical
getRadius
in interface Spherical
public void setRadius(double radius)
radius
- new radius of this ball.public boolean intersects(Spherical other)
Spherical
intersects
in interface Spherical
other
- some other spherical item.public double getMaxInteractionRadius()
HavingInteractionRadius
getMaxInteractionRadius
in interface HavingInteractionRadius
public double getMass()
HavingMass
getMass
in interface HavingMass
public double getVelocityX()
HavingVelocity
getVelocityX
in interface HavingVelocity
public double getVelocityY()
HavingVelocity
getVelocityY
in interface HavingVelocity
public double getVelocityZ()
HavingVelocity
getVelocityZ
in interface HavingVelocity
public void setVelocityX(double velocityX)
HavingVelocity
setVelocityX
in interface HavingVelocity
velocityX
- new x-component of the new velocity of the item's center.public void setVelocityY(double velocityY)
HavingVelocity
setVelocityY
in interface HavingVelocity
velocityY
- new y-component of the new velocity of the item's center.public void setVelocityZ(double velocityZ)
HavingVelocity
setVelocityZ
in interface HavingVelocity
velocityZ
- new z-component of the new velocity of the item's center.public void setVelocity(double velocityX, double velocityY, double velocityZ)
HavingVelocity
setVelocity
in interface HavingVelocity
velocityX
- new x-component of the new velocity of the item's center.velocityY
- new y-component of the new velocity of the item's center.velocityZ
- new z-component of the new velocity of the item's center.public java.lang.String toString()
The result of this method may depend on implementation.
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |