com.threerings.math
Class SphereCoords

java.lang.Object
  extended by com.threerings.math.SphereCoords
All Implemented Interfaces:
Encodable, Exportable, com.threerings.io.Streamable

public class SphereCoords
extends Object
implements Encodable, com.threerings.io.Streamable

A set of spherical coordinates.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
com.threerings.io.Streamable.Closure
 
Field Summary
 float azimuth
          The azimuth about the Z axis (in radians CCW from Y+).
 float distance
          The distance from the origin.
 float elevation
          The elevation above the XY plane, in radians.
 
Constructor Summary
SphereCoords()
          Creates a set of zero coordinates.
SphereCoords(float[] values)
          Creates a set of coordinates from three components.
SphereCoords(float azimuth, float elevation, float distance)
          Creates a set of coordinates from three components.
SphereCoords(SphereCoords other)
          Copy constructor.
 
Method Summary
 void decodeFromStream(DataInputStream in)
          Initializes this object with data read from the specified stream.
 void decodeFromString(String string)
          Initializes this object with the contents of the specified string.
 void encodeToStream(DataOutputStream out)
          Encodes this object to the specified stream.
 String encodeToString()
          Returns a string representation of this object.
 boolean equals(Object other)
           
 int hashCode()
           
 SphereCoords lerp(SphereCoords other, float t)
          Interpolates between this and the specified other set of coordinates.
 SphereCoords lerp(SphereCoords other, float t, SphereCoords result)
          Interpolates between this and the specified other set of coordinates, storing the result in the object provided.
 SphereCoords lerpLocal(SphereCoords other, float t)
          Interpolates between this and the specified other set of coordinates, storing the result in this object.
 SphereCoords set(float[] values)
          Sets all of the elements of the coordinates.
 SphereCoords set(float azimuth, float elevation, float distance)
          Sets all of the elements of the coordinates.
 SphereCoords set(SphereCoords other)
          Copies the elements of another set of coordinates.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

azimuth

@Editable(min=-180.0,
          max=180.0,
          scale=0.017453292519943295,
          hgroup="c")
public float azimuth
The azimuth about the Z axis (in radians CCW from Y+).


elevation

@Editable(min=-90.0,
          max=90.0,
          scale=0.017453292519943295,
          hgroup="c")
public float elevation
The elevation above the XY plane, in radians.


distance

@Editable(min=0.0,
          step=0.01,
          hgroup="c")
public float distance
The distance from the origin.

Constructor Detail

SphereCoords

public SphereCoords(float azimuth,
                    float elevation,
                    float distance)
Creates a set of coordinates from three components.


SphereCoords

public SphereCoords(float[] values)
Creates a set of coordinates from three components.


SphereCoords

public SphereCoords(SphereCoords other)
Copy constructor.


SphereCoords

public SphereCoords()
Creates a set of zero coordinates.

Method Detail

lerpLocal

public SphereCoords lerpLocal(SphereCoords other,
                              float t)
Interpolates between this and the specified other set of coordinates, storing the result in this object.

Returns:
a reference to these coords, for chaining.

lerp

public SphereCoords lerp(SphereCoords other,
                         float t)
Interpolates between this and the specified other set of coordinates.

Returns:
a new set of coordinates containing the result.

lerp

public SphereCoords lerp(SphereCoords other,
                         float t,
                         SphereCoords result)
Interpolates between this and the specified other set of coordinates, storing the result in the object provided.

Returns:
a reference to the result coords, for chaining.

set

public SphereCoords set(SphereCoords other)
Copies the elements of another set of coordinates.

Returns:
a reference to these coordinates, for chaining.

set

public SphereCoords set(float[] values)
Sets all of the elements of the coordinates.

Returns:
a reference to these coordinates, for chaining.

set

public SphereCoords set(float azimuth,
                        float elevation,
                        float distance)
Sets all of the elements of the coordinates.

Returns:
a reference to these coordinates, for chaining.

encodeToString

public String encodeToString()
Description copied from interface: Encodable
Returns a string representation of this object.

Specified by:
encodeToString in interface Encodable

decodeFromString

public void decodeFromString(String string)
                      throws Exception
Description copied from interface: Encodable
Initializes this object with the contents of the specified string.

Specified by:
decodeFromString in interface Encodable
Throws:
Exception

encodeToStream

public void encodeToStream(DataOutputStream out)
                    throws IOException
Description copied from interface: Encodable
Encodes this object to the specified stream.

Specified by:
encodeToStream in interface Encodable
Throws:
IOException

decodeFromStream

public void decodeFromStream(DataInputStream in)
                      throws IOException
Description copied from interface: Encodable
Initializes this object with data read from the specified stream.

Specified by:
decodeFromStream in interface Encodable
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object


Copyright © 2011. All Rights Reserved.