math.geom2d.line
Class StraightLine2D

java.lang.Object
  extended by math.geom2d.line.StraightObject2D
      extended by math.geom2d.line.LineArc2D
          extended by math.geom2d.line.StraightLine2D
All Implemented Interfaces:
java.awt.Shape, Boundary2D, ContinuousBoundary2D, ContinuousCurve2D, ContinuousOrientedCurve2D, Curve2D, OrientedCurve2D, SmoothCurve2D, SmoothOrientedCurve2D, Shape2D

public class StraightLine2D
extends LineArc2D
implements ContinuousBoundary2D

Representation of straigth lines. Such lines can be constructed using two points, a point and a parallel line or straight object, or with coefficient of the cartesian equation.


Field Summary
 
Fields inherited from class math.geom2d.line.LineArc2D
t0, t1
 
Fields inherited from class math.geom2d.line.StraightObject2D
dx, dy, x0, y0
 
Fields inherited from interface math.geom2d.curve.ContinuousCurve2D
CIRCLE, CLOSED_EDGE, LOOP, OPEN_EDGE
 
Fields inherited from interface math.geom2d.Shape2D
ACCURACY, defaultClipWindow, EMPTY_SET
 
Constructor Summary
StraightLine2D()
          Empty constructor: a straight line corresponding to horizontal axis.
StraightLine2D(double a, double b, double c)
          Define a new straight line, from the coefficients of the cartesian equation.
StraightLine2D(double xp, double yp, double dx, double dy)
          Define a new Straight line going through the point (xp, yp) and with the direction dx, dy.
StraightLine2D(java.awt.geom.Point2D point, double angle)
          Define a new Straight line going through the given point, and with the specified direction given by angle.
StraightLine2D(java.awt.geom.Point2D point, double dx, double dy)
          Define a new Straight line going through the given point, and with the specified direction vector.
StraightLine2D(java.awt.geom.Point2D point1, java.awt.geom.Point2D point2)
          Define a new Straight line going through the two given points.
StraightLine2D(java.awt.geom.Point2D point, Vector2D direction)
          Define a new Straight line going through the given point, and with the specified direction vector.
StraightLine2D(StraightObject2D obj)
          Define a new Straight line at the same position and with the same direction than an other straight object (line, edge or ray).
StraightLine2D(StraightObject2D line, java.awt.geom.Point2D point)
          Define a new Straight line, parallel to another straigth object (ray, straight line or edge), and going through the given point.
 
Method Summary
 CurveSet2D<SmoothCurve2D> clipSmoothCurve(SmoothCurve2D curve)
          clip a continuous smooth curve by the half-plane defined by this line.
static StraightLine2D createCartesianLine2D(double a, double b, double c)
          Return a new Straight line, with the given coefficient of the cartesian equation (a*x + b*y + c = 0).
static StraightLine2D createMedian2D(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
          *
static StraightLine2D createOrthogonalLine2D(StraightObject2D line, Point2D point)
          Return a new Straight line, parallel to another straigth object (ray, straight line or edge), and going through the given point.
static StraightLine2D createParallelLine2D(StraightObject2D line, double d)
          Return a new Straight line, parallel to another straight object (ray, straight line or edge), and going through the given point.
static StraightLine2D createParallelLine2D(StraightObject2D line, java.awt.geom.Point2D point)
          Return a new Straight line, parallel to another straight object (ray, straight line or edge), and going through the given point.
static StraightLine2D createStraightLine2D(java.awt.geom.Point2D point, double dx, double dy)
          Return a new Straight line going through the given point, and with the specified direction vector.
static StraightLine2D createStraightLine2D(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
           
 java.util.Collection<ContinuousBoundary2D> getBoundaryCurves()
          Return the different continuous curves composing the boundary
static Point2D getIntersection(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, java.awt.geom.Point2D p3, java.awt.geom.Point2D p4)
          Compute the intersection point of the two (infinite) lines going through p1 and p2 for the first one, and p3 and p4 for the second one.
 StraightLine2D getParallel(double d)
          Return the parallel line located at a distance d.
 StraightLine2D getParallel(java.awt.geom.Point2D point)
          Return a new Straight line, parallel to another straigth object (ray, straight line or edge), and going through the given point.
 StraightLine2D getPerpendicular(Point2D point)
          Return a new Straight line, parallel to another straigth object (ray, straight line or edge), and going through the given point.
 StraightLine2D getReverseCurve()
          Returns the straight line with same origin but with opposite direction vector.
 void setCartesianEquation(double a, double b, double c)
           
 void setLine(double x0, double y0, double dx, double dy)
           
 void setLine(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
           
 void setPoints(double x1, double y1, double x2, double y2)
           
 StraightLine2D transform(AffineTransform2D trans)
          Returns the transformed line.
 
Methods inherited from class math.geom2d.line.LineArc2D
appendPath, clip, contains, contains, equals, equals, getAsPolyline, getBoundingBox, getBounds, getBounds2D, getContinuousCurves, getCurvature, getDistance, getDistance, getFirstPoint, getInnerPath, getLastPoint, getLength, getPathIterator, getPathIterator, getPoint, getPoint, getPoint1, getPoint2, getPosition, getSmoothPieces, getSubCurve, getT0, getT1, getTangent, getWindingAngle, getX1, getX2, getY1, getY2, intersects, intersects, isBounded, isInside, project, toString
 
Methods inherited from class math.geom2d.line.StraightObject2D
contains, contains, getCartesianEquation, getDistance, getHorizontalAngle, getIntersection, getIntersection, getIntersections, getOrigin, getParallel, getParametric, getPolarCoefficients, getPositionOnLine, getPositionOnLine, getProjectedPoint, getProjectedPoint, getSignedDistance, getSignedDistance, getSignedPolarCoefficients, getSupportLine, getSymmetric, getSymmetric, getVector, isClosed, isColinear, isColinear, isInside, isParallel, isParallel
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface math.geom2d.curve.ContinuousOrientedCurve2D
clip, getSubCurve
 
Methods inherited from interface math.geom2d.curve.ContinuousCurve2D
appendPath, getAsPolyline, getSmoothPieces, isClosed
 
Methods inherited from interface math.geom2d.curve.OrientedCurve2D
getSignedDistance, getSignedDistance, getWindingAngle, isInside
 
Methods inherited from interface math.geom2d.curve.Curve2D
getContinuousCurves, getFirstPoint, getIntersections, getLastPoint, getPoint, getPoint, getPosition, getT0, getT1, project
 
Methods inherited from interface math.geom2d.Shape2D
getBoundingBox, getDistance, getDistance, isBounded
 
Methods inherited from interface java.awt.Shape
contains, contains, contains, contains, getBounds, getBounds2D, getPathIterator, getPathIterator, intersects, intersects
 

Constructor Detail

StraightLine2D

public StraightLine2D()
Empty constructor: a straight line corresponding to horizontal axis.


StraightLine2D

public StraightLine2D(java.awt.geom.Point2D point1,
                      java.awt.geom.Point2D point2)
Define a new Straight line going through the two given points.


StraightLine2D

public StraightLine2D(java.awt.geom.Point2D point,
                      Vector2D direction)
Define a new Straight line going through the given point, and with the specified direction vector.


StraightLine2D

public StraightLine2D(java.awt.geom.Point2D point,
                      double dx,
                      double dy)
Define a new Straight line going through the given point, and with the specified direction vector.


StraightLine2D

public StraightLine2D(java.awt.geom.Point2D point,
                      double angle)
Define a new Straight line going through the given point, and with the specified direction given by angle.


StraightLine2D

public StraightLine2D(StraightObject2D obj)
Define a new Straight line at the same position and with the same direction than an other straight object (line, edge or ray).


StraightLine2D

public StraightLine2D(double xp,
                      double yp,
                      double dx,
                      double dy)
Define a new Straight line going through the point (xp, yp) and with the direction dx, dy.


StraightLine2D

public StraightLine2D(StraightObject2D line,
                      java.awt.geom.Point2D point)
Define a new Straight line, parallel to another straigth object (ray, straight line or edge), and going through the given point.


StraightLine2D

public StraightLine2D(double a,
                      double b,
                      double c)
Define a new straight line, from the coefficients of the cartesian equation. The starting point of the line is then the point of the line closest to the origin, and the direction vector has unit norm.

Method Detail

createStraightLine2D

public static final StraightLine2D createStraightLine2D(java.awt.geom.Point2D p1,
                                                        java.awt.geom.Point2D p2)

createMedian2D

public static final StraightLine2D createMedian2D(java.awt.geom.Point2D p1,
                                                  java.awt.geom.Point2D p2)
*

Parameters:
p1 - one point
p2 - another point
Returns:
the median of points p1 and p2

createStraightLine2D

public static final StraightLine2D createStraightLine2D(java.awt.geom.Point2D point,
                                                        double dx,
                                                        double dy)
Return a new Straight line going through the given point, and with the specified direction vector.


createParallelLine2D

public static final StraightLine2D createParallelLine2D(StraightObject2D line,
                                                        java.awt.geom.Point2D point)
Return a new Straight line, parallel to another straight object (ray, straight line or edge), and going through the given point.


createParallelLine2D

public static final StraightLine2D createParallelLine2D(StraightObject2D line,
                                                        double d)
Return a new Straight line, parallel to another straight object (ray, straight line or edge), and going through the given point.


createOrthogonalLine2D

public static final StraightLine2D createOrthogonalLine2D(StraightObject2D line,
                                                          Point2D point)
Return a new Straight line, parallel to another straigth object (ray, straight line or edge), and going through the given point.


createCartesianLine2D

public static final StraightLine2D createCartesianLine2D(double a,
                                                         double b,
                                                         double c)
Return a new Straight line, with the given coefficient of the cartesian equation (a*x + b*y + c = 0).


getIntersection

public static final Point2D getIntersection(java.awt.geom.Point2D p1,
                                            java.awt.geom.Point2D p2,
                                            java.awt.geom.Point2D p3,
                                            java.awt.geom.Point2D p4)
Compute the intersection point of the two (infinite) lines going through p1 and p2 for the first one, and p3 and p4 for the second one. Returns null if two lines are parallel.


getParallel

public StraightLine2D getParallel(java.awt.geom.Point2D point)
Return a new Straight line, parallel to another straigth object (ray, straight line or edge), and going through the given point.


getParallel

public StraightLine2D getParallel(double d)
Return the parallel line located at a distance d. Distance is positive in the 'right' side of the line (outside of the limiting half-plane), and negative in the 'left' of the line.


getPerpendicular

public StraightLine2D getPerpendicular(Point2D point)
Return a new Straight line, parallel to another straigth object (ray, straight line or edge), and going through the given point.

Overrides:
getPerpendicular in class StraightObject2D
Parameters:
point - the point to go through
Returns:
the perpendicular through the point

setLine

public void setLine(double x0,
                    double y0,
                    double dx,
                    double dy)

setPoints

public void setPoints(double x1,
                      double y1,
                      double x2,
                      double y2)

setLine

public void setLine(java.awt.geom.Point2D p1,
                    java.awt.geom.Point2D p2)

setCartesianEquation

public void setCartesianEquation(double a,
                                 double b,
                                 double c)

clipSmoothCurve

public CurveSet2D<SmoothCurve2D> clipSmoothCurve(SmoothCurve2D curve)
clip a continuous smooth curve by the half-plane defined by this line.


getBoundaryCurves

public java.util.Collection<ContinuousBoundary2D> getBoundaryCurves()
Description copied from interface: Boundary2D
Return the different continuous curves composing the boundary

Specified by:
getBoundaryCurves in interface Boundary2D

getReverseCurve

public StraightLine2D getReverseCurve()
Returns the straight line with same origin but with opposite direction vector.

Specified by:
getReverseCurve in interface Boundary2D
Specified by:
getReverseCurve in interface ContinuousBoundary2D
Specified by:
getReverseCurve in interface ContinuousCurve2D
Specified by:
getReverseCurve in interface ContinuousOrientedCurve2D
Specified by:
getReverseCurve in interface Curve2D
Specified by:
getReverseCurve in interface OrientedCurve2D
Specified by:
getReverseCurve in interface SmoothCurve2D
Specified by:
getReverseCurve in interface SmoothOrientedCurve2D
Overrides:
getReverseCurve in class LineArc2D

transform

public StraightLine2D transform(AffineTransform2D trans)
Returns the transformed line. The result is still a StraightLine2D.

Specified by:
transform in interface Boundary2D
Specified by:
transform in interface ContinuousBoundary2D
Specified by:
transform in interface ContinuousCurve2D
Specified by:
transform in interface ContinuousOrientedCurve2D
Specified by:
transform in interface Curve2D
Specified by:
transform in interface OrientedCurve2D
Specified by:
transform in interface SmoothCurve2D
Specified by:
transform in interface SmoothOrientedCurve2D
Specified by:
transform in interface Shape2D
Overrides:
transform in class LineArc2D
Parameters:
trans - an affine transform
Returns:
the transformed shape