Class Straight
- All Implemented Interfaces:
Serializable,Cloneable
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionclone()booleanbooleancontainsWithinSegment(Vector segmentStart, Vector segmentEnd, Vector vector) booleangetAngleCCW(Straight other) getAngleCW(Straight other) getCopy()Returns a copy of thisStraightobject.doublegetDistance(Vector vector) Returns the distance of the providedVectorto thisStraight, which is the distance between the providedVectorand its projection onto thisStraight(seegetProjection(Vector)).getIntersection(Straight other) doublegetParameterAt(Vector vp) getPositionVectorAt(double parameter) getProjection(Vector vector) doublegetSignedDistanceCCW(Vector vector) static doublegetSignedDistanceCCW(Point p, Point q, Point r) doublegetSignedDistanceCW(Vector vector) inthashCode()booleanintersects(Straight other) booleanintersectsWithinSegment(Vector segmentStart, Vector segmentEnd, Straight other) booleanisParallelTo(Straight other) Checks if thisStraightand 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
Pointto theStraightthrough the first twoPoints.The CCW signed distance is positive if the three
Points are in counter-clockwise order and negative if thePoints are in clockwise order. It is zero if the thirdPointlies on the line.If the first two
Points are equal to each other, this method returns the distance of the firstPointto the lastPoint. -
clone
-
contains
-
containsWithinSegment
Checks if thePointindicated by the providedVectoris aPointon theStraightsegment between the given start and endPoints indicated by their corresponding positionVectors.- Parameters:
segmentStart- AVectorindicating the startPointof the segment. It has to lie on thisStraight.segmentEnd- AVectorindicating the endPointof the segment. It has to lie on thisStraight.vector- TheVectorthat is checked for containment.- Returns:
trueif thePointindicated by the givenVectorlies on thisStraight, within the specified segment, otherwisefalse
-
equals
Checks if thisStraightis equal to the providedStraight. TwoStraights s1 and s2 are equal, if the positionVectorof s2 is aPointon s1 and the directionVectors of s1 and s2 are parallel. -
getAngle
-
getAngleCCW
Returns the counter-clockwise (CCW) or positive
Anglespanned between the twoStraights.The returned
Angleis the semi-opposite (seeAngle.getOppositeSemi()) of theAnglereturned by thegetAngleCW(Straight)method except that for 180deg/0deg, both methods return anAngleof 0deg. -
getAngleCW
Returns the clockwise (CW) or negative
Anglespanned between the twoStraights.The returned
Angleis the semi-opposite (seeAngle.getOppositeSemi()) of theAnglereturned by thegetAngleCCW(Straight)method except that for 180deg/0deg, both methods return anAngleof 0deg. -
getCopy
Returns a copy of thisStraightobject.- Returns:
- a copy of this
Straightobject.
-
getDistance
Returns the distance of the providedVectorto thisStraight, which is the distance between the providedVectorand its projection onto thisStraight(seegetProjection(Vector)). -
getIntersection
-
getParameterAt
Returns this
Straight's parameter value for the givenVector. If the givenVectoris not on thisStraightanIllegalArgumentExceptionis thrown.This method is the reverse of the
getPositionVectorAt(double)method. -
getPositionVectorAt
Returns the
Vectoron thisStraightat the given parameter value. TheVectorthat you get is calculated by multiplying thisStraight's directionVectorby the parameter value and translating thatVectorby 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
Vectorto thisStraight.The CCW signed distance indicates on which side of the
StraighttheVectorlies. 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
Vectorto thisStraight.The CW signed distance indicates on which side of the
StraighttheVectorlies. 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 thisStraightand the provided one have an intersectionPointwhich is inside the specified segment between the segmentStart and segmentEndVectors.- Parameters:
segmentStart- AVectorindicating the startPointof the segment. It has to be aPointon theStraight.segmentEnd- AVectorindicating the endPointof the segment. It has to be aPointon theStraight.other- TheStraightto test.- Returns:
trueif the twoStraights intersect and the intersectionPointis contained within the specified segment, otherwisefalse
-
isParallelTo
-
toString
-