gumbo.graphic.math
Class Line3

java.lang.Object
  |
  +--gumbo.graphic.math.Line3
All Implemented Interfaces:
Graphic, GraphicGeometry, java.io.Serializable, TransformableGraphic
Direct Known Subclasses:
Ray3

public class Line3
extends java.lang.Object
implements java.io.Serializable, TransformableGraphic

A 3D spatial element representing a line of infinite extent, which is defined by a position point and a direction unit vector.

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

Constructor Summary
Line3()
          Creates an instance with the position at the origin, and a default unit vector direction.
Line3(Line3 target)
          Creates an instance with the same geometry as the target.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 UnitVector3 getDirection()
          Gets an immutable view of this line's direction.
 java.lang.Object getGraphic()
          Default implementation: Returns this (non-native implementation).
 SpaceNode getGraphicLocalSpace()
          Default implementation: Returns null (absolute reference space).
 Line3 getLine3()
          Gets a singleton immutable view of this object with the same identity (hashCode(), equals()) as this object.
 Point3 getPosition()
          Gets an immutable view of this line's position.
 void set(Line3 line)
          Sets this line to the value of another line.
 Line3 setDirection(Vector3 vector)
          Sets this line's direction.
 Line3 setPosition(Point3 point)
          Sets this line's position.
 java.lang.String toString()
           
 void transformGraphic(Matrix4 matrix)
          Default implementation: Uses setPosition() and setDirection() for subclass compatibility.
 void transformGraphic(SpaceNode from, SpaceNode to)
          Default implementation: Uses setPosition() and setDirection() for subclass compatibility.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Line3

public Line3()
Creates an instance with the position at the origin, and a default unit vector direction.


Line3

public Line3(Line3 target)
Creates an instance with the same geometry as the target.

Method Detail

set

public void set(Line3 line)
Sets this line to the value of another line.

Parameters:
line - Line to copy. Never null.

setPosition

public Line3 setPosition(Point3 point)
Sets this line's position. Master partial state mutator.


setDirection

public Line3 setDirection(Vector3 vector)
Sets this line's direction. Master partial state mutator.


getPosition

public Point3 getPosition()
Gets an immutable view of this line's position. Master partial state accessor.


getDirection

public UnitVector3 getDirection()
Gets an immutable view of this line's direction. Master partial state accessor.


getLine3

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

Returns:
The view. Never null.

transformGraphic

public void transformGraphic(SpaceNode from,
                             SpaceNode to)
Default implementation: Uses setPosition() and setDirection() for subclass compatibility.

Specified by:
transformGraphic in interface TransformableGraphic
Parameters:
from - The current reference space. Never null.
to - The new reference space. Never null.

transformGraphic

public void transformGraphic(Matrix4 matrix)
Default implementation: Uses setPosition() and setDirection() for subclass compatibility.

Specified by:
transformGraphic in interface TransformableGraphic
Parameters:
matrix - Value of the transform matrix. Never null.

getGraphicLocalSpace

public SpaceNode getGraphicLocalSpace()
Default implementation: Returns null (absolute reference space).

Specified by:
getGraphicLocalSpace in interface GraphicGeometry
Returns:
Reference to the space. If null, absolute space.

getGraphic

public java.lang.Object getGraphic()
Default implementation: Returns this (non-native implementation).

Specified by:
getGraphic in interface Graphic
Returns:
The target graphic object. Possibly this object (self-proxy, direct implementation), but never null.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

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