public class Straight
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
| Constructor and Description |
|---|
Straight(Line line)
|
Straight(Point point1,
Point point2)
|
Straight(Vector position,
Vector direction)
|
| Modifier and Type | Method and Description |
|---|---|
Straight |
clone() |
boolean |
contains(Vector vector)
|
boolean |
containsWithinSegment(Vector segmentStart,
Vector segmentEnd,
Vector vector)
|
boolean |
equals(java.lang.Object other)
|
Angle |
getAngle(Straight other)
|
Angle |
getAngleCCW(Straight other)
|
Angle |
getAngleCW(Straight other)
|
Straight |
getCopy()
Returns a copy of this
Straight object. |
double |
getDistance(Vector vector)
Returns the distance of the provided
Vector to this
Straight, which is the distance between the provided
Vector and its projection onto this Straight (see
getProjection(Vector)). |
Vector |
getIntersection(Straight other)
|
double |
getParameterAt(Vector vp)
|
Vector |
getPositionVectorAt(double parameter)
|
Vector |
getProjection(Vector vector)
|
static double |
getSignedDistanceCCW(Point p,
Point q,
Point r)
|
double |
getSignedDistanceCCW(Vector vector)
|
double |
getSignedDistanceCW(Vector vector)
|
int |
hashCode() |
boolean |
intersects(Straight other)
|
boolean |
intersectsWithinSegment(Vector segmentStart,
Vector segmentEnd,
Straight other)
|
boolean |
isParallelTo(Straight other)
Checks if this
Straight and the provided one are parallel to each
other. |
java.lang.String |
toString() |
public Straight(Line line)
public static double getSignedDistanceCCW(Point p, Point q, Point r)
Computes the counter-clockwise (CCW) signed distance of the third
Point to the Straight through the first two Point
s.
The CCW signed distance is positive if the three Points are in
counter-clockwise order and negative if the Points are in
clockwise order. It is zero if the third Point lies on the line.
If the first two Points are equal to each other, this method
returns the distance of the first Point to the last Point
.
public Straight clone()
clone in class java.lang.Objectpublic boolean contains(Vector vector)
public boolean containsWithinSegment(Vector segmentStart, Vector segmentEnd, Vector vector)
Point indicated by the provided Vector is a
Point on the Straight segment between the given start and
end Points indicated by their corresponding position
Vectors.segmentStart - A Vector indicating the start Point of the
segment. It has to lie on this Straight.segmentEnd - A Vector indicating the end Point of the
segment. It has to lie on this Straight.vector - The Vector that is checked for containment.true if the Point indicated by the given
Vector lies on this Straight, within the
specified segment, otherwise falsepublic boolean equals(java.lang.Object other)
Straight is equal to the provided Straight
. Two Straights s1 and s2 are equal, if the position
Vector of s2 is a Point on s1 and the direction
Vectors of s1 and s2 are parallel.equals in class java.lang.ObjectObject.equals(java.lang.Object)public Angle getAngleCCW(Straight other)
Returns the counter-clockwise (CCW) or positive Angle spanned
between the two Straights.
The returned Angle is the semi-opposite (see
Angle.getOppositeSemi()) of the Angle returned by the
getAngleCW(Straight) method except that for 180deg/0deg,
both methods return an Angle of 0deg.
public Angle getAngleCW(Straight other)
Returns the clockwise (CW) or negative Angle spanned between the
two Straights.
The returned Angle is the semi-opposite (see
Angle.getOppositeSemi()) of the Angle returned by the
getAngleCCW(Straight) method except that for
180deg/0deg, both methods return an Angle of 0deg.
public Straight getCopy()
Straight object.Straight object.public double getDistance(Vector vector)
Vector to this
Straight, which is the distance between the provided
Vector and its projection onto this Straight (see
getProjection(Vector)).public double getParameterAt(Vector vp)
Returns this Straight's parameter value for the given
Vector. If the given Vector is not on this
Straight an IllegalArgumentException is thrown.
This method is the reverse of the
getPositionVectorAt(double) method.
public Vector getPositionVectorAt(double parameter)
Returns the Vector on this Straight at the given
parameter value. The Vector that you get is calculated by
multiplying this Straight's direction Vector by the
parameter value and translating that Vector by this
Straight's position Vector.
This method is the reverse of the getParameterAt(Vector)
method.
public double getSignedDistanceCCW(Vector vector)
Returns the counter-clockwise (CCW) signed distance of the given
Vector to this Straight.
The CCW signed distance indicates on which side of the Straight
the Vector lies. If it lies on the right side of this
Straight's direction Vector, the CCW signed distance is
negative. If it is on the left side of this Straight's direction
Vector, it is positive.
public double getSignedDistanceCW(Vector vector)
Returns the clockwise (CW) signed distance of the given Vector to
this Straight.
The CW signed distance indicates on which side of the Straight
the Vector lies. If it is on the right side of this
Straight's direction Vector, the CW signed distance is
positive. If it is on the left side of this Straight's direction
Vector, it is negative.
public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public boolean intersects(Straight other)
public boolean intersectsWithinSegment(Vector segmentStart, Vector segmentEnd, Straight other)
Straight and the provided one have an
intersection Point which is inside the specified segment between
the segmentStart and segmentEnd Vectors.segmentStart - A Vector indicating the start Point of the
segment. It has to be a Point on the Straight.segmentEnd - A Vector indicating the end Point of the
segment. It has to be a Point on the Straight.other - The Straight to test.true if the two Straights intersect and the
intersection Point is contained within the specified
segment, otherwise falsepublic boolean isParallelTo(Straight other)
public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()Copyright (c) 2014 itemis AG, and others. All rights reserved.