gumbo.graphic.math
Class UnitVector3

java.lang.Object
  |
  +--gumbo.graphic.math.Tuple3
        |
        +--gumbo.graphic.math.Vector3
              |
              +--gumbo.graphic.math.UnitVector3
All Implemented Interfaces:
Graphic, GraphicGeometry, java.io.Serializable, TransformableGraphic

public class UnitVector3
extends Vector3

A 3D spatial element representing a vector that is always normalized (length is always one). Commonly used for surface normals and direction vectors. Not affected by translation or scaling transforms. Can't use partial state mutators.

Version:
$Revision: 1.9 $
Author:
Jon Barrilleaux (jonb@jmbaai.com) of JMB and Associates Inc.
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gumbo.graphic.math.Vector3
NORMALIZED_ZERO_LENGTH
 
Constructor Summary
UnitVector3()
          Creates an instance using an initializer, with a value of NORMALIZED_ZERO_LENGTH.
UnitVector3(double[] val)
          Creates an instance using a mutator.
UnitVector3(double x, double y, double z)
          Creates an instance using a mutator.
UnitVector3(Tuple3 tuple)
          Creates an instance using a mutator.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 UnitVector3 getUnitVector3()
          Gets a singleton immutable view of this object with the same identity (hashCode(), equals()) as this object.
protected  UnitVector3 implGetUnitVector3()
          Master whole state accessor.
protected  Tuple3 implSetTuple3(double[] val)
          Forces normalization of all full state input values.
protected  Tuple3 implSetTuple3(int dim, double val)
          Block all partial state input values because normalization requires the whole state.
protected  UnitVector3 implSetUnitVector3(UnitVector3 vector)
           
 void set(Tuple3 vector)
          Sets this tuple to the value of another tuple.
 
Methods inherited from class gumbo.graphic.math.Vector3
getVector3, implGetVector3, length, lengthSquared, normalize, transformGraphic, transformGraphic
 
Methods inherited from class gumbo.graphic.math.Tuple3
abs, add, add, clamp, clamp, clampMax, clampMax, clampMin, clampMin, clear, clearArray, div, div, get, get, getGraphic, getGraphicLocalSpace, getTuple3, getX, getY, getZ, implGetTuple3, implGetTuple3, implGetTuple3, implInitTuple3, isEqual, isEqual, isGreaterEqual, isInsideEqual, isLessEqual, isOutside, isZero, isZero, max, max, min, min, mult, mult, neg, noise, random, round, set, set, set, setArray, setX, setY, setZ, sub, sub, sum, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gumbo.graphic.space.GraphicGeometry
getGraphicLocalSpace
 
Methods inherited from interface gumbo.graphic.Graphic
getGraphic
 

Constructor Detail

UnitVector3

public UnitVector3()
Creates an instance using an initializer, with a value of NORMALIZED_ZERO_LENGTH.


UnitVector3

public UnitVector3(double x,
                   double y,
                   double z)
Creates an instance using a mutator.


UnitVector3

public UnitVector3(double[] val)
Creates an instance using a mutator.


UnitVector3

public UnitVector3(Tuple3 tuple)
Creates an instance using a mutator.

Method Detail

getUnitVector3

public UnitVector3 getUnitVector3()
Gets a singleton immutable view of this object with the same identity (hashCode(), equals()) as this object.

Returns:
The view. Never null.

set

public void set(Tuple3 vector)
Description copied from class: Tuple3
Sets this tuple to the value of another tuple.

Overrides:
set in class Tuple3
Parameters:
vector - Tuple to copy. Never null.

implSetTuple3

protected Tuple3 implSetTuple3(int dim,
                               double val)
Block all partial state input values because normalization requires the whole state.

Overrides:
implSetTuple3 in class Tuple3
Parameters:
dim - Dimension. Throws an exception if out of range.
val - New value for the dimension.
Returns:
This tuple.
Throws:
java.lang.UnsupportedOperationException - Can't set partial state. Use whole state mutators.

implSetTuple3

protected Tuple3 implSetTuple3(double[] val)
Forces normalization of all full state input values.

Overrides:
implSetTuple3 in class Tuple3
Parameters:
val - New value [3].

implSetUnitVector3

protected UnitVector3 implSetUnitVector3(UnitVector3 vector)

implGetUnitVector3

protected UnitVector3 implGetUnitVector3()
Master whole state accessor.


equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class Vector3