An oriented line can be defined either by prolongating a line segment between two points past these points, or by one point and an angular direction (in trigonometric orientation).
Since it is oriented the two half planes at its two sides are unambiguously identified as a left half plane and a right half plane. This can be used to identify the interior and the exterior in a simple way by local properties only when part of a line is used to define part of a polygon boundary.
A line can also be used to completely define a reference frame in the plane. It is sufficient to select one specific point in the line (the orthogonal projection of the original reference frame on the line) and to use the unit vector in the line direction and the orthogonal vector oriented from left half plane to right half plane. We define two coordinates by the process, the abscissa along the line, and the offset across the line. All points of the plane are uniquely identified by these two coordinates. The line is the set of points at zero offset, the left half plane is the set of points with negative offsets and the right half plane is the set of points with positive offsets.
| Modifier and Type | Class and Description |
|---|---|
| private static class | Line.
Class embedding an affine transform. |
| Modifier and Type | Field and Description |
|---|---|
| private double | angle
Angle with respect to the abscissa axis. |
| private double | cos
Cosine of the line angle. |
| private static final double | DEFAULT_TOLERANCE
Default value for tolerance. |
| private double | originOffset
Offset of the frame origin. |
| private Line | reverse
Reverse line. |
| private double | sin
Sine of the line angle. |
| private final double | tolerance
Tolerance below which points are considered identical. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| private | Line(final double
angle of the line with respect to abscissa axis angle, final double cosine of the angle cos, final double sine of the angle sin, final double offset of the origin originOffset, final double tolerance below which points are considered identical tolerance)Build a line from its internal characteristics. |
| public | Line(final Vector2D
first point p1, final Vector2D second point p2)
Deprecated
as of 3.3, replaced with
Line(Vector2D, Vector2D, double)
Build a line from two points. |
| public | Line(final Vector2D
point belonging to the line p, final double angle of the line with respect to abscissa axis angle)
Deprecated
as of 3.3, replaced with
Line(Vector2D, double, double)
Build a line from a point and an angle. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public Line | copySelf()
Implements org. Copy the instance. |
| public double | |
| public double | Returns: the angle of the line with respect to the abscissa axisGet the angle of the line. |
| public double | |
| public double | Returns: offset of the vectorvector to check vector)Get the offset (oriented distance) of a vector. |
| public double | getOffset(final Point<Euclidean2D>
point to check point)Implements org. Get the offset (oriented distance) of a point. |
| public double | |
| public Vector2D | Returns: one point in the plane, with given abscissa and offset relative to the linedesired abscissa for the point abscissa, final double desired offset for the point offset)Get one point from the plane. |
| public Line | Returns: a new line, with orientation opposite to the instance orientationGet the reverse of the instance. |
| public double | getTolerance()
Implements org. Get the tolerance below which points are considered to belong to the hyperplane. |
| public static Transform | getTransform(final AffineTransform
affine transform to embed (must be inversible
otherwise the transform)apply(Hyperplane) method would work only for some lines, and
fail for other ones)
Deprecated
as of 3.6, replaced with
getTransform(double, double, double, double, double, double)
Get a |
| public static Transform | getTransform(final double
transform factor between input abscissa and output abscissa cXX, final double transform factor between input abscissa and output ordinate cYX, final double transform factor between input ordinate and output abscissa cXY, final double transform factor between input ordinate and output ordinate cYY, final double transform addendum for output abscissa cX1, final double transform addendum for output ordinate cY1)Get a |
| public Vector2D | Returns: intersection point of the instance and the other line or null if there are no intersection pointsother line other)Get the intersection point of the instance and another line. |
| public boolean | Returns: true if the instance is parallel to the other line (they can have either the same or opposite orientations)other line to check line)Check the instance is parallel to another line. |
| public Point | project(Point<Euclidean2D>
point to project point)Implements org. Project a point to the hyperplane. |
| public void | |
| public void | |
| public void | |
| public boolean | sameOrientationAs(final Hyperplane<Euclidean2D>
other hyperplane to check against the instance other)Implements org. Check if the instance has the same orientation as another hyperplane. |
| public void | setAngle(final double
new angle of the line with respect to the abscissa axis angle)Set the angle of the line. |
| public void | |
| public Vector2D | Returns: n-dimension point of the space corresponding to the specified sub-space point(n-1)-dimension point of the sub-space vector)Transform a sub-space point into a space point. |
| public Vector2D | toSpace(final Point<Euclidean1D>
(n-1)-dimension point of the sub-space point)Implements org. Transform a sub-space point into a space point. |
| public Vector1D | Returns: (n-1)-dimension point of the sub-space corresponding to the specified space pointn-dimension point of the space vector)Transform a space point into a sub-space point. |
| public Vector1D | toSubSpace(final Point<Euclidean2D>
n-dimension point of the space point)Implements org. Transform a space point into a sub-space point. |
| public void | translateToPoint(final Vector2D
point by which the line should pass p)Translate the line to force it passing by a point. |
| private void | |
| public SubLine | wholeHyperplane()
Implements org. Build a sub-hyperplane covering the whole hyperplane. |
| public PolygonsSet | Returns: a region containing the instance (really aPolygonsSet instance)Implements org. Build a region covering the whole space. |
| angle | back to summary |
|---|---|
| private double angle Angle with respect to the abscissa axis. | |
| cos | back to summary |
|---|---|
| private double cos Cosine of the line angle. | |
| DEFAULT_TOLERANCE | back to summary |
|---|---|
| private static final double DEFAULT_TOLERANCE Default value for tolerance. | |
| originOffset | back to summary |
|---|---|
| private double originOffset Offset of the frame origin. | |
| reverse | back to summary |
|---|---|
| private Line reverse Reverse line. | |
| sin | back to summary |
|---|---|
| private double sin Sine of the line angle. | |
| tolerance | back to summary |
|---|---|
| private final double tolerance Tolerance below which points are considered identical. | |
| Line | back to summary |
|---|---|
| public Line(final Vector2D p1, final Vector2D p2, final double tolerance) Build a line from two points. The line is oriented from p1 to p2 | |
| Line | back to summary |
|---|---|
| public Line(final Vector2D p, final double angle, final double tolerance) Build a line from a point and an angle.
| |
| Line | back to summary |
|---|---|
| private Line(final double angle, final double cos, final double sin, final double originOffset, final double tolerance) Build a line from its internal characteristics.
| |
| Line | back to summary |
|---|---|
| public Line(final Vector2D p1, final Vector2D p2)
Deprecated as of 3.3, replaced with Build a line from two points. The line is oriented from p1 to p2
| |
| Line | back to summary |
|---|---|
| public Line(final Vector2D p, final double angle)
Deprecated as of 3.3, replaced with Build a line from a point and an angle.
| |
| Line | back to summary |
|---|---|
| public Line(final Line line) Copy constructor. The created instance is completely independent from the original instance, it is a deep copy.
| |
| contains | back to summary |
|---|---|
| public boolean contains(final Vector2D p) Check if the line contains a point.
| |
| copySelf | back to summary |
|---|---|
| public Line copySelf() Implements org. Doc from org. Copy the instance. The instance created is completely independant of the original one. A deep copy is used, none of the underlying objects are shared (except for immutable objects).
| |
| distance | back to summary |
|---|---|
| public double distance(final Vector2D p) Compute the distance between the instance and a point. This is a shortcut for invoking FastMath.abs(getOffset(p)), and provides consistency with what is in the org.apache.commons.math3.geometry.euclidean.threed.Line class.
| |
| getAngle | back to summary |
|---|---|
| public double getAngle() Get the angle of the line.
| |
| getOffset | back to summary |
|---|---|
| public double getOffset(final Line line) Get the offset (oriented distance) of a parallel line. This method should be called only for parallel lines otherwise the result is not meaningful. The offset is 0 if both lines are the same, it is positive if the line is on the right side of the instance and negative if it is on the left side, according to its natural orientation.
| |
| getOffset | back to summary |
|---|---|
| public double getOffset(Vector<Euclidean2D> vector) Get the offset (oriented distance) of a vector.
| |
| getOffset | back to summary |
|---|---|
| public double getOffset(final Point<Euclidean2D> point) Implements org. Doc from org. Get the offset (oriented distance) of a point. The offset is 0 if the point is on the underlying hyperplane, it is positive if the point is on one particular side of the hyperplane, and it is negative if the point is on the other side, according to the hyperplane natural orientation.
| |
| getOriginOffset | back to summary |
|---|---|
| public double getOriginOffset() Get the offset of the origin.
| |
| getPointAt | back to summary |
|---|---|
| public Vector2D getPointAt(final Vector1D abscissa, final double offset) Get one point from the plane. | |
| getReverse | back to summary |
|---|---|
| public Line getReverse() Get the reverse of the instance. Get a line with reversed orientation with respect to the instance.
As long as neither the instance nor its reverse are modified
(i.e. as long as none of the
| |
| getTolerance | back to summary |
|---|---|
| public double getTolerance() Implements org. Doc from org. Get the tolerance below which points are considered to belong to the hyperplane.
| |
| getTransform | back to summary |
|---|---|
| public static Transform Deprecated as of 3.6, replaced with Get a
| |
| getTransform | back to summary |
|---|---|
| public static Transform Get a
| |
| intersection | back to summary |
|---|---|
| public Vector2D intersection(final Line other) Get the intersection point of the instance and another line. | |
| isParallelTo | back to summary |
|---|---|
| public boolean isParallelTo(final Line line) Check the instance is parallel to another line.
| |
| project | back to summary |
|---|---|
| public Point Implements org. Doc from org. Project a point to the hyperplane.
| |
| reset | back to summary |
|---|---|
| public void reset(final Vector2D p1, final Vector2D p2) Reset the instance as if built from two points. The line is oriented from p1 to p2 | |
| reset | back to summary |
|---|---|
| public void reset(final Vector2D p, final double alpha) Reset the instance as if built from a line and an angle.
| |
| revertSelf | back to summary |
|---|---|
| public void revertSelf() Revert the instance. | |
| sameOrientationAs | back to summary |
|---|---|
| public boolean sameOrientationAs(final Hyperplane<Euclidean2D> other) Implements org. Doc from org. Check if the instance has the same orientation as another hyperplane. This method is expected to be called on parallel hyperplanes. The method should not re-check for parallelism, only for orientation, typically by testing something like the sign of the dot-products of normals.
| |
| setAngle | back to summary |
|---|---|
| public void setAngle(final double angle) Set the angle of the line.
| |
| setOriginOffset | back to summary |
|---|---|
| public void setOriginOffset(final double offset) Set the offset of the origin.
| |
| toSpace | back to summary |
|---|---|
| public Vector2D toSpace(Vector<Euclidean1D> vector) Transform a sub-space point into a space point.
| |
| toSpace | back to summary |
|---|---|
| public Vector2D toSpace(final Point<Euclidean1D> point) Implements org. Doc from org. Transform a sub-space point into a space point.
| |
| toSubSpace | back to summary |
|---|---|
| public Vector1D toSubSpace(Vector<Euclidean2D> vector) Transform a space point into a sub-space point.
| |
| toSubSpace | back to summary |
|---|---|
| public Vector1D toSubSpace(final Point<Euclidean2D> point) Implements org. Doc from org. Transform a space point into a sub-space point.
| |
| translateToPoint | back to summary |
|---|---|
| public void translateToPoint(final Vector2D p) Translate the line to force it passing by a point.
| |
| unlinkReverse | back to summary |
|---|---|
| private void unlinkReverse() Unset the link between an instance and its reverse. | |
| wholeHyperplane | back to summary |
|---|---|
| public SubLine wholeHyperplane() Implements org. Doc from org. Build a sub-hyperplane covering the whole hyperplane.
| |
| wholeSpace | back to summary |
|---|---|
| public PolygonsSet wholeSpace() Implements org. Build a region covering the whole space.
| |
This class is used in order to apply an affine transform to a line. Using a specific object allow to perform some computations on the transform only once even if the same transform is to be applied to a large number of lines (for example to a large polygon)./
| Modifier and Type | Field and Description |
|---|---|
| private double | c11
cXX * cYY - cYX * cXY. |
| private double | c1X
cXX * cY1 - cYX * cX1. |
| private double | c1Y
cXY * cY1 - cYY * cX1. |
| private double | cX1
Transform addendum for output abscissa. |
| private double | cXX
Transform factor between input abscissa and output abscissa. |
| private double | cXY
Transform factor between input ordinate and output abscissa. |
| private double | cY1
Transform addendum for output ordinate. |
| private double | cYX
Transform factor between input abscissa and output ordinate. |
| private double | cYY
Transform factor between input ordinate and output ordinate. |
| Access | Constructor and Description |
|---|---|
| pack-priv | LineTransform(final double
transform factor between input abscissa and output abscissa cXX, final double transform factor between input abscissa and output ordinate cYX, final double transform factor between input ordinate and output abscissa cXY, final double transform factor between input ordinate and output ordinate cYY, final double transform addendum for output abscissa cX1, final double transform addendum for output ordinate cY1)Build an affine line transform from a n |
| Modifier and Type | Method and Description |
|---|---|
| public Vector2D | apply(final Point<Euclidean2D>
point to transform point)Implements org. Transform a point of a space. |
| public Line | apply(final Hyperplane<Euclidean2D>
hyperplane to transform hyperplane)Implements org. Transform an hyperplane of a space. |
| public SubHyperplane | apply(final SubHyperplane<Euclidean1D>
sub-hyperplane to transform sub, final Hyperplane<Euclidean2D> hyperplane in which the sub-hyperplane is
defined (this is the original hyperplane, the transform has
not been applied to it) original, final Hyperplane<Euclidean2D> hyperplane in which the sub-hyperplane is
defined (this is the transformed hyperplane, the transform
has been applied to it) transformed)Implements org. Transform a sub-hyperplane embedded in an hyperplane. |
| c11 | back to summary |
|---|---|
| private double c11 cXX * cYY - cYX * cXY. | |
| c1X | back to summary |
|---|---|
| private double c1X cXX * cY1 - cYX * cX1. | |
| c1Y | back to summary |
|---|---|
| private double c1Y cXY * cY1 - cYY * cX1. | |
| cX1 | back to summary |
|---|---|
| private double cX1 Transform addendum for output abscissa. | |
| cXX | back to summary |
|---|---|
| private double cXX Transform factor between input abscissa and output abscissa. | |
| cXY | back to summary |
|---|---|
| private double cXY Transform factor between input ordinate and output abscissa. | |
| cY1 | back to summary |
|---|---|
| private double cY1 Transform addendum for output ordinate. | |
| cYX | back to summary |
|---|---|
| private double cYX Transform factor between input abscissa and output ordinate. | |
| cYY | back to summary |
|---|---|
| private double cYY Transform factor between input ordinate and output ordinate. | |
| LineTransform | back to summary |
|---|---|
| pack-priv LineTransform(final double cXX, final double cYX, final double cXY, final double cYY, final double cX1, final double cY1) throws MathIllegalArgumentException Build an affine line transform from a n
| |
| apply | back to summary |
|---|---|
| public Vector2D apply(final Point<Euclidean2D> point) Implements org. Doc from org. Transform a point of a space.
| |
| apply | back to summary |
|---|---|
| public Line apply(final Hyperplane<Euclidean2D> hyperplane) Implements org. Doc from org. Transform an hyperplane of a space.
| |
| apply | back to summary |
|---|---|
| public SubHyperplane Implements org. Doc from org. Transform a sub-hyperplane embedded in an hyperplane.
| |