ProGAL.geom2d
Class Line

java.lang.Object
  extended by ProGAL.geom2d.Line
All Implemented Interfaces:
Shape

public class Line
extends java.lang.Object
implements Shape


Constructor Summary
Line(double a, double b, double c)
          creates a line ax + by + c = 0
Line(LineSegment seg)
          creates a line through a given segment
Line(Point p, Point q)
          creates a line through 2 given points
Line(Point p, Vector n)
          creates a line through a given point and with a given normal vector
 
Method Summary
static boolean areParallel(Line l1, Line l2)
           
 Point getCenter()
          Get the geometric center of the shape.
 Vector getDirection()
           
 double getDistance(Point q)
          returns the distance of the point q to the line
static Point getIntersection(Line l1, Line l2)
           
 Point getPoint(double d)
          returns the point on the line at distance d from the line-defining point p
 double getSlope()
           
 double intersectionParameter(Line l)
           
 boolean isParallelWith(Line l)
           
 boolean isVertical()
           
 double projectionParameter(Point q)
           
 Point projectPoint(Point q)
           
 void toConsole()
           
 void toConsole(java.lang.String name)
           
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Line

public Line(Point p,
            Vector n)
creates a line through a given point and with a given normal vector


Line

public Line(Point p,
            Point q)
creates a line through 2 given points


Line

public Line(LineSegment seg)
creates a line through a given segment


Line

public Line(double a,
            double b,
            double c)
creates a line ax + by + c = 0

Method Detail

getDirection

public Vector getDirection()

getSlope

public double getSlope()

isVertical

public boolean isVertical()

isParallelWith

public boolean isParallelWith(Line l)

areParallel

public static boolean areParallel(Line l1,
                                  Line l2)

projectPoint

public Point projectPoint(Point q)

projectionParameter

public double projectionParameter(Point q)

getIntersection

public static Point getIntersection(Line l1,
                                    Line l2)

toString

public java.lang.String toString(java.lang.String name)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toConsole

public void toConsole(java.lang.String name)

toConsole

public void toConsole()

getPoint

public Point getPoint(double d)
returns the point on the line at distance d from the line-defining point p


getDistance

public double getDistance(Point q)
returns the distance of the point q to the line


intersectionParameter

public double intersectionParameter(Line l)

getCenter

public Point getCenter()
Description copied from interface: Shape
Get the geometric center of the shape. The center of a shape can be interpreted in many ways (center of mass, circumcenter, inscribed center etc.). No strict requirement is given here, but typically the circumcenter should be supplied. This method is most prominently used to find the average center-position of a collection of shapes such that scene-viewers can be centered on the scene.

Specified by:
getCenter in interface Shape