Package ome.util.math.geom2D
Class Line
- java.lang.Object
-
- ome.util.math.geom2D.Line
-
public class Line extends java.lang.ObjectAn orientated line in the Euclidean space R2.- Since:
- OME2.2
-
-
Field Summary
Fields Modifier and Type Field Description PlanePointdirectionThe unit vector that, given theoriginpoint, identifies this line.PlanePointoriginThe origin point of the line.
-
Constructor Summary
Constructors Constructor Description Line(PlanePoint o, PlanePoint p)Creates a new object to represent the line passing through theoandppoints.Line(PlanePoint p, PlanePoint q, PlanePoint o)Creates a new object to represent the line passing throughoand having direction pq.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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(PlanePoint p)Tells whether the specified point lies on this line.booleanlies(PlanePoint p, boolean positiveOrientation)Tells whether the specified point lies on this line and within the specified orientation.
-
-
-
Field Detail
-
origin
public final PlanePoint origin
-
direction
public final PlanePoint direction
The unit vector that, given theoriginpoint, identifies this line.
-
-
Constructor Detail
-
Line
public Line(PlanePoint o, PlanePoint p)
Creates a new object to represent the line passing through theoandppoints. Theopoint is taken to define the origin of the line and the direction is defined by the op vector.- Parameters:
o- The origin of the line. Mustn't benull.p- A point of the line. Mustn't benullnor the same aso.
-
Line
public Line(PlanePoint p, PlanePoint q, PlanePoint o)
Creates a new object to represent the line passing throughoand having direction pq. Thepandqpoints are, respectively, the tail and head of the vector pq that is taken to define the direction of the line.- Parameters:
p- Tail of a vector. Mustn't benull.q- Head of a vector. Mustn't benullnor the same asq.o- The origin of the line. Mustn't benull.
-
-
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.- Returns:
- See above.
-
lies
public boolean lies(PlanePoint p)
Tells whether the specified point lies on this line.- Parameters:
p- The point to test. Mustn't benull.- Returns:
trueifplies on this line,falseotherwise.
-
lies
public boolean lies(PlanePoint p, boolean positiveOrientation)
Tells whether the specified point lies on this line and within the specified orientation. ThepositiveOrientationparameter is used to specify which side (with respect to theorigin) of the line to check. Iftrue, then we check to see whetherpfalls on the half line that has the same orientation as thedirectionunit vector this also includes theorigin. Iffalse, we check to see whetherpfalls on the opposite half line.- Parameters:
p- The point to test. Mustn't benull.positiveOrientation-truefor the positive orientation,falsefor the strictly negative orientation.- Returns:
trueifplies on this line,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()
-
-