cynosurex.graphics2D
Class Line2D

java.lang.Object
  extended by cynosurex.graphics2D.Line2D
All Implemented Interfaces:
cynosurex.internal.AuthorCommon, cynosurex.internal.CommonInterface, cynosurex.internal.CompanyCommon

public class Line2D
extends java.lang.Object
implements cynosurex.internal.CommonInterface

A line represented in 2D coordination space, e.g. (x, y).


Field Summary
protected  Point2D p1
           
protected  Point2D p2
           
 
Fields inherited from interface cynosurex.internal.CommonInterface
copyright, copyrightYears, notice, program, version
 
Fields inherited from interface cynosurex.internal.AuthorCommon
author, copyrightSymbol, noticeMsg, rights
 
Fields inherited from interface cynosurex.internal.CompanyCommon
company, email, website
 
Constructor Summary
Line2D(double x1, double y1, double x2, double y2)
          Constructs and initializes a Line2D from the specified point coordinates.
Line2D(Point2D p1, Point2D p2)
          Constructs and initializes a Line2D from the specified points.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Checks whether two pointers are equal.
 Point2D getMidpoint()
          Returns the midpoint of the line
 double getSlope()
          Returns the slope of the line.
 Point2D getXIntercept()
          Returns the x-intercept of the line.
 Point2D getYIntercept()
          Returns the y-intercept of the line.
 int hashCode()
          Returns the hashcode for this Line2D.
 java.lang.String toString()
          Returns the String representation of this Point's coordinates.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

p1

protected Point2D p1

p2

protected Point2D p2
Constructor Detail

Line2D

public Line2D(double x1,
              double y1,
              double x2,
              double y2)
Constructs and initializes a Line2D from the specified point coordinates.

Parameters:
x1 - the x coordinate of the first point
y1 - the y coordinate of the first point
x2 - the x coordinate of the second point
y2 - the y coordinate of the second point

Line2D

public Line2D(Point2D p1,
              Point2D p2)
Constructs and initializes a Line2D from the specified points.

Parameters:
p1 - the first point
p2 - the second point
Method Detail

equals

public boolean equals(java.lang.Object obj)
Checks whether two pointers are equal.

Overrides:
equals in class java.lang.Object

getMidpoint

public Point2D getMidpoint()
Returns the midpoint of the line


getSlope

public double getSlope()
Returns the slope of the line.


getXIntercept

public Point2D getXIntercept()
Returns the x-intercept of the line.


getYIntercept

public Point2D getYIntercept()
Returns the y-intercept of the line.


hashCode

public int hashCode()
Returns the hashcode for this Line2D.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns the String representation of this Point's coordinates.

Overrides:
toString in class java.lang.Object