public class Straight
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
Vector |
direction
direction vector of this straight
|
Vector |
position
position vector of this straight
|
Constructor and Description |
---|
Straight(PrecisionPoint point1,
PrecisionPoint point2)
Constructs a new Straight between the two given Points.
|
Straight(Vector position,
Vector direction)
Constructs a new Straight with the given position and direction.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Vector vector)
Calculates whether the point indicated by the provided Vector is a point
on this Straight.
|
boolean |
containsWithinSegment(Vector segmentStart,
Vector segmentEnd,
Vector vector)
Calculates whether the point indicated by the provided Vector is a point
on the straight segment between the given start and end points.
|
boolean |
equals(java.lang.Object other)
Checks whether this Straight is equal to the provided Straight.
|
double |
getAngle(Straight other)
Returns the (smallest) angle between this Straight and the provided one.
|
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.
|
Vector |
getIntersection(Straight other)
Computes the intersection point of this Straight and the provided one, if
it exists.
|
Vector |
getProjection(Vector vector)
Returns the projection of the given Vector onto this Straight, which is
the point on this Straight with the minimal distance to the point,
denoted by the provided Vector.
|
int |
hashCode() |
boolean |
intersects(Straight other)
Checks whether this Straight and the provided one have an intersection
point.
|
boolean |
intersectsWithinSegment(Vector segmentStart,
Vector segmentEnd,
Straight other)
Checks whether this Straight and the provided one have an intersection
point, which is inside the specified segment between segmentStart and
segmentEnd.
|
boolean |
isParallelTo(Straight other)
Checks whether this Straight and the provided one are parallel to each
other.
|
java.lang.String |
toString() |
public Vector position
public Vector direction
public Straight(Vector position, Vector direction)
position
- direction
- public Straight(PrecisionPoint point1, PrecisionPoint point2)
point1
- a first waypoint of the Straight to be constructedpoint2
- a second waypoint of the Straight to be constructedpublic boolean intersects(Straight other)
other
- The Straight to use for the calculation.public boolean intersectsWithinSegment(Vector segmentStart, Vector segmentEnd, Straight other)
segmentEnd
- a Vector indicating the end point of the segment. Has to be a
point on the straight.other
- the Straight to testpublic Vector getIntersection(Straight other)
other
- The Straight to use for calculations.public double getAngle(Straight other)
other
- The Straight to be used for the calculation.public Vector getProjection(Vector vector)
vector
- The Vector whose projection should be determined.public double getDistance(Vector vector)
vector
- The Vector whose distance is to be calculated.public boolean contains(Vector vector)
vector
- the Vector who has to be checked.public boolean containsWithinSegment(Vector segmentStart, Vector segmentEnd, Vector vector)
segmentStart
- a Vector indicating the start point of the segment. Has to be
a point on the straight.segmentEnd
- a Vector indicating the end point of the segment. Has to be a
point on the straight.vector
- the Vector who has to be checked.public boolean isParallelTo(Straight other)
other
- The Straight to test for parallelism.public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.