Package ome.util.math.geom2D
Class Segment
- java.lang.Object
-
- ome.util.math.geom2D.Segment
-
public class Segment extends java.lang.ObjectA segment in the Euclidean space R2.- Since:
- OME2.2
-
-
Field Summary
Fields Modifier and Type Field Description doubledirectionX1The end point of the segment's first element.doubledirectionX2The end point of the segment's second element.doubleoriginX1The origin of the segment's first element.doubleoriginX2The origin of the segment's first element.
-
Constructor Summary
Constructors Constructor Description Segment(double originX1, double originX2, double endX1, double endX2)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(double k, double x1, double x2)Performs an equality test based on a point on this line defined bykas ingetPoint(double)and another given point.booleanequals(java.lang.Object o)Overridden to reflect equality of abstract values (data object) as opposite to object identity.PlanePointgetPoint(double k)Returns the point of this line defined byk.inthashCode()Overridden to reflect equality of abstract values (data object) as opposite to object identity.booleanlies(double x1, double x2)Tells whether a specified point lies on this line.
-
-
-
Field Detail
-
originX1
public final double originX1
The origin of the segment's first element.
-
originX2
public final double originX2
The origin of the segment's first element.
-
directionX1
public final double directionX1
The end point of the segment's first element.
-
directionX2
public final double directionX2
The end point of the segment's second element.
-
-
Constructor Detail
-
Segment
public Segment(double originX1, double originX2, double endX1, double endX2)Creates a new instance.- Parameters:
originX1- The origin of the segment's first element.originX2- The origin of the segment's second element.endX1- The end point's first element.endX2- The end point's second element.
-
-
Method Detail
-
getPoint
public PlanePoint getPoint(double k)
Returns the point of this line defined byk. More precisely, this method returns thepoint.origin+kdirection- Parameters:
k- The coefficient to select the point. Must be in the range[0, 1].- Returns:
- See above.
-
lies
public boolean lies(double x1, double x2)Tells whether a specified point lies on this line.- Parameters:
x1- The first element of the point to testx2- The second element of the point to test- Returns:
trueifplies on this line,falseotherwise.
-
equals
public boolean equals(double k, double x1, double x2)Performs an equality test based on a point on this line defined bykas ingetPoint(double)and another given point.- Parameters:
k- The coefficient to select the point. Must be in the range[0, 1].x1- The point to test's first element.x2- The point to test's second element.- Returns:
trueif the points are geometrically equal,falseotherwise.
-
equals
public boolean equals(java.lang.Object o)
Overridden to reflect equality of abstract values (data object) as opposite to object identity.- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(Object)
-
hashCode
public int hashCode()
Overridden to reflect equality of abstract values (data object) as opposite to object identity.- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
-