ome.util.math.geom2D

## Class Line

• ```public class Line
extends Object```
An orientated line in the Euclidean space R2.
Since:
OME2.2
Version:
2.2 (Internal version: \$Revision\$ \$Date: 2005/06/09 15:01:32 \$)
Author:
Jean-Marie Burel      j.burel@dundee.ac.uk,
Andrea Falconi      a.falconi@dundee.ac.uk
• ### Field Summary

Fields
Modifier and Type Field and Description
`PlanePoint` `direction`
The unit vector that, given the `origin` point, identifies this line.
`PlanePoint` `origin`
The origin point of the line.
• ### Constructor Summary

Constructors
Constructor and Description
```Line(PlanePoint o, PlanePoint p)```
Creates a new object to represent the line passing through the `o` and `p` points.
```Line(PlanePoint p, PlanePoint q, PlanePoint o)```
Creates a new object to represent the line passing through `o` and having direction pq.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`boolean` `equals(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 by `k`.
`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.
• ### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### origin

`public final PlanePoint origin`
The origin point of the line. Any point (within the line) that falls on the half line that has the same orientation as the `direction` unit vector is said to have positive orientation — this also includes the `origin` point. All other points of the line are said to have (strictly) negative orientation.
• #### direction

`public final PlanePoint direction`
The unit vector that, given the `origin` point, identifies this line.
• ### Constructor Detail

• #### Line

```public Line(PlanePoint o,
PlanePoint p)```
Creates a new object to represent the line passing through the `o` and `p` points. The `o` 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 be `null`.
`p` - A point of the line. Mustn't be `null` nor the same as `o`.
• #### Line

```public Line(PlanePoint p,
PlanePoint q,
PlanePoint o)```
Creates a new object to represent the line passing through `o` and having direction pq. The `p` and `q` 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 be `null`.
`q` - Head of a vector. Mustn't be `null` nor the same as `q`.
`o` - The origin of the line. Mustn't be `null`.
• ### Method Detail

• #### getPoint

`public PlanePoint getPoint(double k)`
Returns the point of this line defined by `k`. More precisely, this method returns the `origin+kdirection` point.
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 be `null`.
Returns:
`true` if `p` 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. The `positiveOrientation` parameter is used to specify which side (with respect to the `origin`) of the line to check. If `true`, then we check to see whether `p` falls on the half line that has the same orientation as the `direction` unit vector — this also includes the `origin`. If `false`, we check to see whether `p` falls on the opposite half line.
Parameters:
`p` - The point to test. Mustn't be `null`.
`positiveOrientation` - `true` for the positive orientation, `false` for the strictly negative orientation.
Returns:
`true` if `p` lies on this line, `false` otherwise.
• #### equals

`public boolean equals(Object o)`
Overridden to reflect equality of abstract values (data object) as opposite to object identity.
Overrides:
`equals` in class `Object`
`Object.equals(Object)`
• #### hashCode

`public int hashCode()`
Overridden to reflect equality of abstract values (data object) as opposite to object identity.
Overrides:
`hashCode` in class `Object`
`Object.hashCode()`