Package com.ardor3d.math
Class Ring
java.lang.Object
com.ardor3d.math.Ring
- All Implemented Interfaces:
Poolable
,ReadOnlyRing
,Savable
,Externalizable
,Serializable
,Cloneable
public class Ring
extends Object
implements Cloneable, Savable, Externalizable, ReadOnlyRing, Poolable
Ring
defines a flat ring or disk within three dimensional space that is specified via the ring's center
point, an up vector, an inner radius, and an outer radius.- See Also:
-
Constructor Summary
ConstructorDescriptionRing()
Constructor creates a newRing
lying on the XZ plane, centered at the origin, with an inner radius of zero and an outer radius of one (a unit disk).Ring
(ReadOnlyRing source) Copy constructor.Ring
(ReadOnlyVector3 center, ReadOnlyVector3 up, double innerRadius, double outerRadius) Constructor creates a newRing
with defined center point, up vector, and inner and outer radii. -
Method Summary
Modifier and TypeMethodDescriptionclone()
boolean
static final Ring
getCenter
returns the center of the ring.double
getInnerRadius
returns the ring's inner radius.double
getOuterRadius
returns the ring's outer radius.getUp()
getUp
returns the ring's up vector.int
hashCode()
static boolean
isValid
(ReadOnlyRing ring) Check a ring... if it is null or its radii, or the doubles of its center or up are NaN or infinite, return false.random
returns a random point within the ring.void
read
(InputCapsule capsule) void
Used with serialization.static final void
releaseTempInstance
(Ring ring) Releases a Ring back to be used by a future call to fetchTempInstance.set
(ReadOnlyRing source) Copy the value of the given source Ring into this Ring.void
setCenter
(ReadOnlyVector3 center) setCenter
sets the center of the ring.void
setInnerRadius
(double innerRadius) setInnerRadius
sets the ring's inner radius.void
setOuterRadius
(double outerRadius) setOuterRadius
sets the ring's outer radius.void
setUp
(ReadOnlyVector3 up) setUp
sets the ring's up vector.toString()
void
write
(OutputCapsule capsule) void
Used with serialization.
-
Constructor Details
-
Ring
public Ring()Constructor creates a newRing
lying on the XZ plane, centered at the origin, with an inner radius of zero and an outer radius of one (a unit disk). -
Ring
Copy constructor.- Parameters:
source
- the ring to copy from.
-
Ring
Constructor creates a newRing
with defined center point, up vector, and inner and outer radii.- Parameters:
center
- the center of the ring.up
- the unit up vector defining the ring's orientation.innerRadius
- the ring's inner radius.outerRadius
- the ring's outer radius.
-
-
Method Details
-
set
Copy the value of the given source Ring into this Ring.- Parameters:
source
- the source of the data to copy.- Returns:
- this ring for chaining
- Throws:
NullPointerException
- if source is null.
-
getCenter
getCenter
returns the center of the ring.- Specified by:
getCenter
in interfaceReadOnlyRing
- Returns:
- the center of the ring.
-
setCenter
setCenter
sets the center of the ring.- Parameters:
center
- the center of the ring.
-
getUp
getUp
returns the ring's up vector.- Specified by:
getUp
in interfaceReadOnlyRing
- Returns:
- the ring's up vector.
-
setUp
setUp
sets the ring's up vector.- Parameters:
up
- the ring's up vector.
-
getInnerRadius
public double getInnerRadius()getInnerRadius
returns the ring's inner radius.- Specified by:
getInnerRadius
in interfaceReadOnlyRing
- Returns:
- the ring's inner radius.
-
setInnerRadius
public void setInnerRadius(double innerRadius) setInnerRadius
sets the ring's inner radius.- Parameters:
innerRadius
- the ring's inner radius.
-
getOuterRadius
public double getOuterRadius()getOuterRadius
returns the ring's outer radius.- Specified by:
getOuterRadius
in interfaceReadOnlyRing
- Returns:
- the ring's outer radius.
-
setOuterRadius
public void setOuterRadius(double outerRadius) setOuterRadius
sets the ring's outer radius.- Parameters:
outerRadius
- the ring's outer radius.
-
random
random
returns a random point within the ring.- Specified by:
random
in interfaceReadOnlyRing
- Parameters:
store
- Vector to store result in- Returns:
- a random point within the ring.
-
isValid
Check a ring... if it is null or its radii, or the doubles of its center or up are NaN or infinite, return false. Else return true.- Parameters:
ring
- the ring to check- Returns:
- true or false as stated above.
-
toString
-
hashCode
public int hashCode() -
equals
-
clone
- Specified by:
clone
in interfaceReadOnlyRing
- Overrides:
clone
in classObject
-
getClassTag
- Specified by:
getClassTag
in interfaceSavable
-
write
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-
readExternal
Used with serialization. Not to be called manually.- Specified by:
readExternal
in interfaceExternalizable
- Parameters:
in
- ObjectInput- Throws:
IOException
- if something wrong occurs while readingClassNotFoundException
- if a class is not found
-
writeExternal
Used with serialization. Not to be called manually.- Specified by:
writeExternal
in interfaceExternalizable
- Parameters:
out
- ObjectOutput- Throws:
IOException
- if something wrong occurs while writing
-
fetchTempInstance
- Returns:
- An instance of Ring that is intended for temporary use in calculations and so forth. Multiple calls to the method should return instances of this class that are not currently in use.
-
releaseTempInstance
Releases a Ring back to be used by a future call to fetchTempInstance. TAKE CARE: this Ring object should no longer have other classes referencing it or "Bad Things" will happen.- Parameters:
ring
- the Ring to release.
-