gumbo.graphic.math
Class Segment3

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

public class Segment3
extends Ray3

A 3D spatial element representing a line of finite extent (line segment), which is defined by a position point, a direction vector, and a length, and by a head point and a tail point. The position and tail points are identical.

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

Constructor Summary
Segment3()
          Creates an instance with head, tail, and position at the origin, zero length, and a default unit vector direction.
Segment3(Segment3 target)
          Creates an instance with the same geometry as the target.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 Point3 getHeadPoint()
          Gets an immutable view of this segment's head point.
 double getLength()
          Gets the length of this segment.
 Segment3 getSegment3()
          Gets a singleton immutable view of this object with the same identity (hashCode(), equals()) as this object.
 Point3 getTailPoint()
          Gets an immutable view of this segment's tail (position) point.
 Line3 setDirection(Vector3 vector)
          Sets the direction of this segment.
 Segment3 setHeadPoint(Point3 point)
          Sets the head point of this segment.
 Segment3 setLength(double length)
          Sets the length of this segment.
 Line3 setPosition(Point3 point)
          Sets the position (tail) point of this segment.
 Segment3 setTailPoint(Point3 point)
          Sets the tail (position) point of this segment.
 java.lang.String toString()
           
 
Methods inherited from class gumbo.graphic.math.Ray3
getRay3
 
Methods inherited from class gumbo.graphic.math.Line3
getDirection, getGraphic, getGraphicLocalSpace, getLine3, getPosition, set, transformGraphic, transformGraphic
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Segment3

public Segment3()
Creates an instance with head, tail, and position at the origin, zero length, and a default unit vector direction.


Segment3

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

Method Detail

setLength

public Segment3 setLength(double length)
Sets the length of this segment. The tail point is unaffected. Master partial state mutator.


setHeadPoint

public Segment3 setHeadPoint(Point3 point)
Sets the head point of this segment. The tail point is unaffected. Master partial state mutator.


setTailPoint

public Segment3 setTailPoint(Point3 point)
Sets the tail (position) point of this segment. The head point is unaffected. Master partial state mutator.


getLength

public double getLength()
Gets the length of this segment. Master partial state accessor.


getHeadPoint

public Point3 getHeadPoint()
Gets an immutable view of this segment's head point. Master partial state accessor.


getTailPoint

public Point3 getTailPoint()
Gets an immutable view of this segment's tail (position) point. Master partial state accessor.


getSegment3

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

Returns:
The view. Never null.

setPosition

public Line3 setPosition(Point3 point)
Sets the position (tail) point of this segment. The length and direction are unaffected. Master partial state mutator.

Overrides:
setPosition in class Line3

setDirection

public Line3 setDirection(Vector3 vector)
Sets the direction of this segment. The length and position (tail) point are unaffected. Master partial state mutator.

Overrides:
setDirection in class Line3

toString

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

equals

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