Modifier and Type | Field and Description |
---|---|
static int |
RELATIVE_OFFSET_POSITION_OFFSET
The relative offset of the Position Offset parameter in the
float array. |
static int |
RELATIVE_OFFSET_RADIUS
The relative offset of the Radius parameter in the
float array. |
static int |
SIZE
The size of a
Sphere in the float array. |
static int |
TYPE
The type number associated with a
Sphere . |
Constructor and Description |
---|
Sphere(Point3F position)
Constructs a new
Sphere instance. |
Sphere(Point3F position,
float radius)
Constructs a new
Sphere instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object object)
Compares
object to this Sphere instance for equality. |
Point3F |
getPosition()
Returns the center position of this
Sphere . |
float |
getRadius()
Returns the radius of this
Sphere . |
int |
getSize()
Returns the size of this
Sphere instance. |
int |
getType()
Returns the type of this
Sphere instance. |
int |
hashCode()
Returns a hash code for this
Sphere instance. |
boolean |
isWithinRadius(float x,
float y,
float z)
Returns
true if, and only if, the point denoted by x , y and z is within radius to this Sphere instance, false otherwise. |
boolean |
isWithinRadius(float x,
float y,
float z,
float threshold)
Returns
true if, and only if, the point denoted by x , y and z is within radius to this Sphere instance, false otherwise. |
java.lang.String |
toString()
Returns a
String representation of this Sphere instance. |
public static final int RELATIVE_OFFSET_POSITION_OFFSET
float
array. The value is 0
.public static final int RELATIVE_OFFSET_RADIUS
float
array. The value is 1
.public static final int SIZE
Sphere
in the float
array. The size is 2
.public static final int TYPE
Sphere
. The number is 1
.public Sphere(Point3F position)
Sphere
instance.
If position
is null
, a NullPointerException
will be thrown.
position
- the position of this Sphere
java.lang.NullPointerException
- thrown if, and only if, position
is null
public Sphere(Point3F position, float radius)
Sphere
instance.
If position
is null
, a NullPointerException
will be thrown.
position
- the position of this Sphere
radius
- the radius of this Sphere
java.lang.NullPointerException
- thrown if, and only if, position
is null
public Point3F getPosition()
Sphere
.Sphere
public java.lang.String toString()
String
representation of this Sphere
instance.toString
in class java.lang.Object
String
representation of this Sphere
instancepublic boolean equals(java.lang.Object object)
object
to this Sphere
instance for equality.
Returns true
if, and only if, object
is an instance of Sphere
, and their respective values are equal, false
otherwise.
equals
in class java.lang.Object
object
- the Object
to compare to this Sphere
instance for equalitytrue
if, and only if, object
is an instance of Sphere
, and their respective values are equal, false
otherwisepublic boolean isWithinRadius(float x, float y, float z)
true
if, and only if, the point denoted by x
, y
and z
is within radius to this Sphere
instance, false
otherwise.
Calling this method is equivalent to calling isWithinRadius(x, y, z, 0.0F)
.
x
- the X-coordinatey
- the Y-coordinatez
- the Z-coordinatetrue
if, and only if, the point denoted by x
, y
and z
is within radius to this Sphere
instance, false
otherwisepublic boolean isWithinRadius(float x, float y, float z, float threshold)
true
if, and only if, the point denoted by x
, y
and z
is within radius to this Sphere
instance, false
otherwise.
The actual radius will be sphere.getRadius() + threshold
.
x
- the X-coordinatey
- the Y-coordinatez
- the Z-coordinatethreshold
- the threshold valuetrue
if, and only if, the point denoted by x
, y
and z
is within radius to this Sphere
instance, false
otherwisepublic float getRadius()
Sphere
.Sphere
public int getSize()
Sphere
instance.public int getType()
Sphere
instance.public int hashCode()
Sphere
instance.hashCode
in class java.lang.Object
Sphere
instance