cz.cuni.utils.math.extended
Class Segment3D

java.lang.Object
  extended by cz.cuni.utils.math.extended.Segment3D

public class Segment3D
extends java.lang.Object

Contains hash code + method equals (endpoints of the segment must be the same, ordering doesn't metter), once created - shouldn't be changed.


Field Summary
 Vertex3D[] ab
          Endpoints of the segment.
 Vertex3D[] abN
          Normalized order of ab[].
 int hashCode
           
 double length
           
 Line3DExtended line
          Line in which segment lies.
 
Constructor Summary
Segment3D(Segment3D s)
           
Segment3D(Vertex3D a, Vertex3D b)
           
 
Method Summary
protected  int countHashCode()
          we have to add the points in the right order to obtain the same hash code ... we will compare their coordinates doesn't work for degenerated segments (a == b), that's why all degenerated segments have hash code == 0
 boolean equals(java.lang.Object o)
           
 boolean equals(Segment3D s)
           
 Vertex3D getOtherVertex(Vertex3D previousVertex)
           
 int hashCode()
           
 boolean hasVertex(Vertex3D v)
          Wether v is one of the endpoint of this segment.
 boolean inLine(Line3D iLine)
          Test wether the segment lines in this line.
 double length()
           
 Vertex3D sharedVertex(Segment3D s)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

line

public Line3DExtended line
Line in which segment lies.


ab

public Vertex3D[] ab
Endpoints of the segment.


abN

public Vertex3D[] abN
Normalized order of ab[].


length

public double length

hashCode

public final int hashCode
Constructor Detail

Segment3D

public Segment3D(Vertex3D a,
                 Vertex3D b)

Segment3D

public Segment3D(Segment3D s)
Method Detail

countHashCode

protected int countHashCode()
we have to add the points in the right order to obtain the same hash code ... we will compare their coordinates doesn't work for degenerated segments (a == b), that's why all degenerated segments have hash code == 0

Returns:
hash code

equals

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

equals

public boolean equals(Segment3D s)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

length

public double length()

hasVertex

public boolean hasVertex(Vertex3D v)
Wether v is one of the endpoint of this segment.


toString

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

inLine

public boolean inLine(Line3D iLine)
Test wether the segment lines in this line.

Parameters:
iLine -

getOtherVertex

public Vertex3D getOtherVertex(Vertex3D previousVertex)

sharedVertex

public Vertex3D sharedVertex(Segment3D s)