net.algart.model3d.common.movement.model
Interface HavingCenter

All Superinterfaces:
Item
All Known Subinterfaces:
HavingInteractionRadius, HavingVelocity, Spherical
All Known Implementing Classes:
ElasticBall

public interface HavingCenter
extends Item

Item which has a geometrical center. Only such items can be moved as a result of physical interaction. Some items, like Earth or BunkerWall, have no center and cannot be moved — but can act to another items.

AlgART Laboratory 2010

Since:
JDK 1.5
Version:
1.0
Author:
Daniel Alievsky

Method Summary
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.
 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.
 double squareOfDistance(HavingCenter other)
          Returns the square of the distance between this item's center and the center of the specified item.
 

Method Detail

getCenterX

double getCenterX()
Returns x-coordinate of the item's center.

Returns:
x-coordinate of the item's center.

getCenterY

double getCenterY()
Returns y-coordinate of the item's center.

Returns:
y-coordinate of the item's center.

getCenterZ

double getCenterZ()
Returns z-coordinate of the item's center.

Returns:
z-coordinate of the item's center.

setCenterX

void setCenterX(double x)
Sets x-coordinate of the item's center.

Parameters:
x - new x-coordinate of the new item's center.

setCenterY

void setCenterY(double y)
Sets y-coordinate of the item's center.

Parameters:
y - new y-coordinate of the new item's center.

setCenterZ

void setCenterZ(double z)
Sets z-coordinate of the item's center.

Parameters:
z - new z-coordinate of the new item's center.

setCenter

void setCenter(double x,
               double y,
               double z)
Sets all coordinates of the item's center.

Parameters:
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.

isNaN

boolean isNaN()
Returns true if at least one of 3 coordinates of the item's center is NaN.

Returns:
whether at least one of 3 coordinates of the item's center is NaN.

isInfinite

boolean isInfinite()
Returns true if at least one of 3 coordinates of the item's center is Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY.

Returns:
whether at least one of 3 coordinates of the item's center is infinite.

squareOfDistance

double squareOfDistance(HavingCenter other)
Returns the square of the distance between this item's center and the center of the specified item. Equivalent to the following formula: (otherX-x)*(otherX-x) + (otherY-y)*(otherY-y) + (otherZ-z)*(other-z), where x, y, z are coordinates of the center of this item and otherX, otherY, otherZ are coordinates of the center of the argument.

Parameters:
other - some other item, which also has a center.
Returns:
the square of the distance between centers of this and the other items.