Package ome.util.math.geom2D
Class Line
- java.lang.Object
-
- ome.util.math.geom2D.Line
-
public class Line extends java.lang.Object
An orientated line in the Euclidean space R2.- Since:
- OME2.2
-
-
Field Summary
Fields Modifier and Type Field Description PlanePoint
direction
The unit vector that, given theorigin
point, identifies this line.PlanePoint
origin
The 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 theo
andp
points.Line(PlanePoint p, PlanePoint q, PlanePoint o)
Creates a new object to represent the line passing througho
and having direction pq.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Overridden to reflect equality of abstract values (data object) as opposite to object identity.PlanePoint
getPoint(double k)
Returns the point of this line defined byk
.int
hashCode()
Overridden to reflect equality of abstract values (data object) as opposite to object identity.boolean
lies(PlanePoint p)
Tells whether the specified point lies on this line.boolean
lies(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 theorigin
point, identifies this line.
-
-
Constructor Detail
-
Line
public Line(PlanePoint o, PlanePoint p)
Creates a new object to represent the line passing through theo
andp
points. Theo
point 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 benull
nor the same aso
.
-
Line
public Line(PlanePoint p, PlanePoint q, PlanePoint o)
Creates a new object to represent the line passing througho
and having direction pq. Thep
andq
points 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 benull
nor 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 the
point.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:
true
ifp
lies on this line,false
otherwise.
-
lies
public boolean lies(PlanePoint p, boolean positiveOrientation)
Tells whether the specified point lies on this line and within the specified orientation. ThepositiveOrientation
parameter is used to specify which side (with respect to theorigin
) of the line to check. Iftrue
, then we check to see whetherp
falls on the half line that has the same orientation as thedirection
unit vector this also includes theorigin
. Iffalse
, we check to see whetherp
falls on the opposite half line.- Parameters:
p
- The point to test. Mustn't benull
.positiveOrientation
-true
for the positive orientation,false
for the strictly negative orientation.- Returns:
true
ifp
lies on this line,false
otherwise.
-
equals
public boolean equals(java.lang.Object o)
Overridden to reflect equality of abstract values (data object) as opposite to object identity.- Overrides:
equals
in 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:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
-