backend.spheremodel
Class SphereLineModel

java.lang.Object
  extended by java.util.Observable
      extended by backend.spheremodel.SphereBasicObject
          extended by backend.spheremodel.SphereMultiPointBase
              extended by backend.spheremodel.SphereLineModel
All Implemented Interfaces:
CircleIntersection, java.util.Observer
Direct Known Subclasses:
SphereGreatCircleModel, SphereLongLineModel, SphereParaLineModel, SphereShortLineModel

public abstract class SphereLineModel
extends SphereMultiPointBase
implements java.util.Observer, CircleIntersection

SphereLineModel is a backend representation of a line


Nested Class Summary
static class SphereLineModel.LineType
           
 
Constructor Summary
SphereLineModel(SpherePointModel fPoint, SpherePointModel sPoint, SphereModel theSphere)
          This SphereLineModel constructor will initalize that basics that need to be set in place for any Line that will be placed on there Sphere.
 
Method Summary
 boolean equals(java.lang.Object checkMe)
           
 SpherePointModel getFirstPoint()
          getFirstPoint returns the first point of this line
 java.util.ArrayList<javax.vecmath.Point3f> getIntersectionPoints(SphereLineModel checkMe, double sphereRadius)
          getIntersectionPoints will return the points of intersection of this line and the one passed in
abstract  float getLength()
          getLength will return the length of this line
 Line3f getLineFromCirc(javax.vecmath.Vector3f rotationAxis)
          getLineFromCirc this function should create a line which lies on the plane formed by the object implementing this class and it should use this axis of rotation to create the line by rotating the center point of the circle.
 SphereLineModel.LineType getLineType()
          getLineType returns the type of this line
 javax.vecmath.Vector3f getNormalVecToPlane()
          getNormalVecToPlane() should return a normal vector to the plane created by whatever class implements this interface.
 javax.vecmath.Point3f[] getPointsOnLine()
          getPointsOnLine returns an array of points which can be used to form the spherical line
 SpherePointModel getSecondPoint()
          getSecondPoint returns the second point of this line
abstract  boolean isIntersectionPtOnLine(javax.vecmath.Point3f checkMe)
          This function is ONLY for use with getIntersectionPoints because it assumes the points passed in lies on the great circle formed by the line in question.
 void update(java.util.Observable obv, java.lang.Object arg1)
           
 
Methods inherited from class backend.spheremodel.SphereMultiPointBase
getNumVerticies
 
Methods inherited from class backend.spheremodel.SphereBasicObject
addChild, getChild, getChildCount, getSelected, isBeingRemoved, isHidden, notifyFamily, removeChild, setBeingRemoved, setHidden, setSelected
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SphereLineModel

public SphereLineModel(SpherePointModel fPoint,
                       SpherePointModel sPoint,
                       SphereModel theSphere)
This SphereLineModel constructor will initalize that basics that need to be set in place for any Line that will be placed on there Sphere. If you extend this class please call this constructor!

Parameters:
fPoint - is the first point of this line
sPoint - is the second point of this line
theSphere - is the SphereModel to look after
Method Detail

getLength

public abstract float getLength()
getLength will return the length of this line

Returns:
the length of the line

getLineType

public SphereLineModel.LineType getLineType()
getLineType returns the type of this line

Returns:
The type of this line

getFirstPoint

public SpherePointModel getFirstPoint()
getFirstPoint returns the first point of this line

Returns:
The first point of the line

getSecondPoint

public SpherePointModel getSecondPoint()
getSecondPoint returns the second point of this line

Returns:
returns the second point of this SphereLineModel

getIntersectionPoints

public java.util.ArrayList<javax.vecmath.Point3f> getIntersectionPoints(SphereLineModel checkMe,
                                                                        double sphereRadius)
getIntersectionPoints will return the points of intersection of this line and the one passed in

Parameters:
checkMe - The line to check against
sphereRadius - The radius of the sphere the lines reside on
Returns:
An ArrayList of Point3fs with the interesction points. (There will only be 0, 1, or 2)

equals

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

update

public void update(java.util.Observable obv,
                   java.lang.Object arg1)
Specified by:
update in interface java.util.Observer

isIntersectionPtOnLine

public abstract boolean isIntersectionPtOnLine(javax.vecmath.Point3f checkMe)
This function is ONLY for use with getIntersectionPoints because it assumes the points passed in lies on the great circle formed by the line in question. It SHOULD NOT be used to try and tell if a point is on a line!

Parameters:
checkMe - The point to check against this line
Returns:
True if it's on the line false if it's not

getPointsOnLine

public javax.vecmath.Point3f[] getPointsOnLine()
getPointsOnLine returns an array of points which can be used to form the spherical line

Specified by:
getPointsOnLine in class SphereMultiPointBase
Returns:
An array of points to form *this* line with

getNormalVecToPlane

public javax.vecmath.Vector3f getNormalVecToPlane()
Description copied from interface: CircleIntersection
getNormalVecToPlane() should return a normal vector to the plane created by whatever class implements this interface. WARNING: The vector may or may not be normalized in the sense that its magnitude is one.

Specified by:
getNormalVecToPlane in interface CircleIntersection
Returns:
a vector3f which is a normal vector to this plane. Please note that which this vector will be perpendicular to the plane it may or may not be normalized

getLineFromCirc

public Line3f getLineFromCirc(javax.vecmath.Vector3f rotationAxis)
Description copied from interface: CircleIntersection
getLineFromCirc this function should create a line which lies on the plane formed by the object implementing this class and it should use this axis of rotation to create the line by rotating the center point of the circle.

Specified by:
getLineFromCirc in interface CircleIntersection
Parameters:
rotationAxis - is the axis of rotation to use for rotating the all important center point
Returns:
A line which lies on the plane created by the circle implementing this interface and using the axis of rotation passed in to this function.