cz.cuni.utils.math.extended
Class Segment2D

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

public class Segment2D
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
 Vertex2D[] ab
          Endpoints of the segment.
 Vertex2D[] abN
          Normalized order of vertices a,b
protected  int hashCode
           
 double length
           
 Line2D line
          Line in which segment lies.
 
Constructor Summary
Segment2D(Vertex2D a, Vertex2D b)
           
 
Method Summary
protected  int countHashCode()
           
 boolean equals(java.lang.Object o)
           
 boolean equals(Segment2D s)
           
 Vertex2D getOtherVertex(Vertex2D previousVertex)
           
 int hashCode()
           
 boolean hasVertex(Vertex2D v)
          Wether v is one of the endpoint of this segment.
 double length()
           
 Tuple2D[] segmentPoints(Tuple2D point, double distance)
          Returns points which distance from 'point' is 'distance' and lies inside the segment.
 Vertex2D sharedVertex(Segment2D s)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

line

public Line2D line
Line in which segment lies.


ab

public Vertex2D[] ab
Endpoints of the segment.


abN

public Vertex2D[] abN
Normalized order of vertices a,b


length

public double length

hashCode

protected final int hashCode
Constructor Detail

Segment2D

public Segment2D(Vertex2D a,
                 Vertex2D b)
Method Detail

countHashCode

protected int countHashCode()

toString

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

equals

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

equals

public boolean equals(Segment2D s)

segmentPoints

public Tuple2D[] segmentPoints(Tuple2D point,
                               double distance)
Returns points which distance from 'point' is 'distance' and lies inside the segment.

Parameters:
point - ... must be part of the segment's line!
distance -

hashCode

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

length

public double length()

hasVertex

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


getOtherVertex

public Vertex2D getOtherVertex(Vertex2D previousVertex)

sharedVertex

public Vertex2D sharedVertex(Segment2D s)