Class Straight
- All Implemented Interfaces:
Serializable
,Cloneable
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionclone()
boolean
boolean
containsWithinSegment
(Vector segmentStart, Vector segmentEnd, Vector vector) boolean
getAngleCCW
(Straight other) getAngleCW
(Straight other) getCopy()
Returns a copy of thisStraight
object.double
getDistance
(Vector vector) Returns the distance of the providedVector
to thisStraight
, which is the distance between the providedVector
and its projection onto thisStraight
(seegetProjection(Vector)
).getIntersection
(Straight other) double
getParameterAt
(Vector vp) getPositionVectorAt
(double parameter) getProjection
(Vector vector) double
getSignedDistanceCCW
(Vector vector) static double
getSignedDistanceCCW
(Point p, Point q, Point r) double
getSignedDistanceCW
(Vector vector) int
hashCode()
boolean
intersects
(Straight other) boolean
intersectsWithinSegment
(Vector segmentStart, Vector segmentEnd, Straight other) boolean
isParallelTo
(Straight other) Checks if thisStraight
and the provided one are parallel to each other.toString()
-
Field Details
-
position
-
direction
-
-
Constructor Details
-
Straight
-
Straight
-
Straight
-
-
Method Details
-
getSignedDistanceCCW
Computes the counter-clockwise (CCW) signed distance of the third
Point
to theStraight
through the first twoPoint
s.The CCW signed distance is positive if the three
Point
s are in counter-clockwise order and negative if thePoint
s are in clockwise order. It is zero if the thirdPoint
lies on the line.If the first two
Point
s are equal to each other, this method returns the distance of the firstPoint
to the lastPoint
. -
clone
-
contains
-
containsWithinSegment
Checks if thePoint
indicated by the providedVector
is aPoint
on theStraight
segment between the given start and endPoint
s indicated by their corresponding positionVector
s.- Parameters:
segmentStart
- AVector
indicating the startPoint
of the segment. It has to lie on thisStraight
.segmentEnd
- AVector
indicating the endPoint
of the segment. It has to lie on thisStraight
.vector
- TheVector
that is checked for containment.- Returns:
true
if thePoint
indicated by the givenVector
lies on thisStraight
, within the specified segment, otherwisefalse
-
equals
Checks if thisStraight
is equal to the providedStraight
. TwoStraight
s s1 and s2 are equal, if the positionVector
of s2 is aPoint
on s1 and the directionVector
s of s1 and s2 are parallel. -
getAngle
-
getAngleCCW
Returns the counter-clockwise (CCW) or positive
Angle
spanned between the twoStraight
s.The returned
Angle
is the semi-opposite (seeAngle.getOppositeSemi()
) of theAngle
returned by thegetAngleCW(Straight)
method except that for 180deg/0deg, both methods return anAngle
of 0deg. -
getAngleCW
Returns the clockwise (CW) or negative
Angle
spanned between the twoStraight
s.The returned
Angle
is the semi-opposite (seeAngle.getOppositeSemi()
) of theAngle
returned by thegetAngleCCW(Straight)
method except that for 180deg/0deg, both methods return anAngle
of 0deg. -
getCopy
Returns a copy of thisStraight
object.- Returns:
- a copy of this
Straight
object.
-
getDistance
Returns the distance of the providedVector
to thisStraight
, which is the distance between the providedVector
and its projection onto thisStraight
(seegetProjection(Vector)
). -
getIntersection
-
getParameterAt
Returns this
Straight
's parameter value for the givenVector
. If the givenVector
is not on thisStraight
anIllegalArgumentException
is thrown.This method is the reverse of the
getPositionVectorAt(double)
method. -
getPositionVectorAt
Returns the
Vector
on thisStraight
at the given parameter value. TheVector
that you get is calculated by multiplying thisStraight
's directionVector
by the parameter value and translating thatVector
by thisStraight
's positionVector
.This method is the reverse of the
getParameterAt(Vector)
method. -
getProjection
-
getSignedDistanceCCW
Returns the counter-clockwise (CCW) signed distance of the given
Vector
to thisStraight
.The CCW signed distance indicates on which side of the
Straight
theVector
lies. If it lies on the right side of thisStraight
's directionVector
, the CCW signed distance is negative. If it is on the left side of thisStraight
's directionVector
, it is positive. -
getSignedDistanceCW
Returns the clockwise (CW) signed distance of the given
Vector
to thisStraight
.The CW signed distance indicates on which side of the
Straight
theVector
lies. If it is on the right side of thisStraight
's directionVector
, the CW signed distance is positive. If it is on the left side of thisStraight
's directionVector
, it is negative. -
hashCode
public int hashCode() -
intersects
-
intersectsWithinSegment
Checks whether thisStraight
and the provided one have an intersectionPoint
which is inside the specified segment between the segmentStart and segmentEndVector
s.- Parameters:
segmentStart
- AVector
indicating the startPoint
of the segment. It has to be aPoint
on theStraight
.segmentEnd
- AVector
indicating the endPoint
of the segment. It has to be aPoint
on theStraight
.other
- TheStraight
to test.- Returns:
true
if the twoStraight
s intersect and the intersectionPoint
is contained within the specified segment, otherwisefalse
-
isParallelTo
-
toString
-