Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.awt.geom
Class Area.LineSegment  view Area.LineSegment download Area.LineSegment.java

java.lang.Object
  extended byjava.awt.geom.Area.Segment
      extended byjava.awt.geom.Area.LineSegment
All Implemented Interfaces:
java.lang.Cloneable
Enclosing class:
Area

private class Area.LineSegment
extends Area.Segment


Field Summary
(package private)  Area.Segment next
           
(package private)  Area.Segment node
           
(package private)  Point2D P1
           
(package private)  Point2D P2
           
 
Constructor Summary
Area.LineSegment(double x1, double y1, double x2, double y2)
           
Area.LineSegment(Point2D p1, Point2D p2)
           
 
Method Summary
 java.lang.Object clone()
          Clones this segment
(package private)  Area.Segment cloneSegmentList()
          Clones this path
(package private)  boolean contains(double x, double y)
          Determines if this path of segments contains the point (x,y)
(package private)  int createNode(Area.Segment b, Area.Intersection i)
          Creates a node between this segment and segment b at the given intersection
protected  int createNodes(Area.Segment b, Area.Intersection[] x)
          Creates multiple nodes from a list of intersections, This must be done in the order of ascending parameters, and the parameters must be recalculated in accordance with each split.
(package private)  double curveArea()
          Returns twice the area of a curve, relative the P1-P2 line Obviously, a line does not enclose any area besides the line
(package private)  boolean equals(Area.Segment b)
          Compare two segments.
(package private)  Rectangle2D getBounds()
          Returns the bounding box of this segment
(package private)  Point2D getMidPoint()
          Returns the segment's midpoint
 Rectangle2D getPathBounds()
          Returns the bounds of this path
(package private)  double getSignedArea()
          Calculates twice the signed area of the path;
(package private)  Area.Segment getTopLeft()
          Return the segment with the top-leftmost first point
(package private)  int getType()
          Returns the PathIterator type of a segment
(package private)  boolean hasClockwiseOrientation()
          Determines the winding direction of the path By the sign of the area.
(package private)  boolean hasIntersections(Area.Segment b)
          Returns if the line has intersections.
(package private)  void insert(Area.Segment v)
          Inserts a Segment after this one
(package private)  boolean isCoLinear(Area.LineSegment b)
          Determines if two line segments are strictly colinear
(package private)  boolean isPolygonal()
          Returns if this segment path is polygonal
(package private)  boolean isSegmentOutside(java.awt.Shape shape)
          Returns if the path has a segment outside a shape
(package private)  Area.Segment lastCoLinear()
          Return the last segment colinear with this one.
(package private)  void nullNodes()
          Nulls all nodes of the path.
(package private)  boolean pathEquals(Area.Segment B)
          Determines if two paths are equal.
(package private)  int pathIteratorFormat(double[] coords)
          Returns a line segment
(package private)  int rayCrossing(double x, double y)
          Returns the number of intersections on the positive X axis, with the origin at (x,y), used for contains()-testing
(package private)  void reverseAll()
          Reverses the orientation of the whole polygon
(package private)  void reverseCoords()
          Swap start and end points
(package private)  int splitIntersections(Area.Segment b)
          Splits intersections into nodes, This one handles line-line, line-quadratic, line-cubic
(package private)  void subdivideInsert(double t)
          Subdivides the segment at parametric value t, inserting the new segment into the linked list after this, such that this becomes [0,t] and this.next becomes [t,1]
(package private)  void transform(AffineTransform at)
          Transforms the segment
(package private)  void transformSegmentList(AffineTransform at)
          Transforms each segment in the closed path
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

P1

Point2D P1

P2

Point2D P2

next

Area.Segment next

node

Area.Segment node
Constructor Detail

Area.LineSegment

public Area.LineSegment(double x1,
                        double y1,
                        double x2,
                        double y2)

Area.LineSegment

public Area.LineSegment(Point2D p1,
                        Point2D p2)
Method Detail

clone

public java.lang.Object clone()
Clones this segment


transform

void transform(AffineTransform at)
Transforms the segment

Specified by:
transform in class Area.Segment

reverseCoords

void reverseCoords()
Swap start and end points

Specified by:
reverseCoords in class Area.Segment

getMidPoint

Point2D getMidPoint()
Returns the segment's midpoint

Specified by:
getMidPoint in class Area.Segment

curveArea

double curveArea()
Returns twice the area of a curve, relative the P1-P2 line Obviously, a line does not enclose any area besides the line

Specified by:
curveArea in class Area.Segment

getType

int getType()
Returns the PathIterator type of a segment

Specified by:
getType in class Area.Segment

subdivideInsert

void subdivideInsert(double t)
Subdivides the segment at parametric value t, inserting the new segment into the linked list after this, such that this becomes [0,t] and this.next becomes [t,1]

Specified by:
subdivideInsert in class Area.Segment

isCoLinear

boolean isCoLinear(Area.LineSegment b)
Determines if two line segments are strictly colinear


lastCoLinear

Area.Segment lastCoLinear()
Return the last segment colinear with this one. Used in comparing paths.


equals

boolean equals(Area.Segment b)
Compare two segments. We must take into account that the lines may be broken into colinear subsegments and ignore them.

Specified by:
equals in class Area.Segment

pathIteratorFormat

int pathIteratorFormat(double[] coords)
Returns a line segment

Specified by:
pathIteratorFormat in class Area.Segment

hasIntersections

boolean hasIntersections(Area.Segment b)
Returns if the line has intersections.


splitIntersections

int splitIntersections(Area.Segment b)
Splits intersections into nodes, This one handles line-line, line-quadratic, line-cubic

Specified by:
splitIntersections in class Area.Segment

getBounds

Rectangle2D getBounds()
Returns the bounding box of this segment

Specified by:
getBounds in class Area.Segment

rayCrossing

int rayCrossing(double x,
                double y)
Returns the number of intersections on the positive X axis, with the origin at (x,y), used for contains()-testing

Specified by:
rayCrossing in class Area.Segment

contains

boolean contains(double x,
                 double y)
Determines if this path of segments contains the point (x,y)


nullNodes

void nullNodes()
Nulls all nodes of the path. Clean up any 'hairs'.


transformSegmentList

void transformSegmentList(AffineTransform at)
Transforms each segment in the closed path


hasClockwiseOrientation

boolean hasClockwiseOrientation()
Determines the winding direction of the path By the sign of the area.


getPathBounds

public Rectangle2D getPathBounds()
Returns the bounds of this path


getSignedArea

double getSignedArea()
Calculates twice the signed area of the path;


reverseAll

void reverseAll()
Reverses the orientation of the whole polygon


insert

void insert(Area.Segment v)
Inserts a Segment after this one


isPolygonal

boolean isPolygonal()
Returns if this segment path is polygonal


cloneSegmentList

Area.Segment cloneSegmentList()
                        throws java.lang.CloneNotSupportedException
Clones this path


createNode

int createNode(Area.Segment b,
               Area.Intersection i)
Creates a node between this segment and segment b at the given intersection


createNodes

protected int createNodes(Area.Segment b,
                          Area.Intersection[] x)
Creates multiple nodes from a list of intersections, This must be done in the order of ascending parameters, and the parameters must be recalculated in accordance with each split.


pathEquals

boolean pathEquals(Area.Segment B)
Determines if two paths are equal. Colinear line segments are ignored in the comparison.


getTopLeft

Area.Segment getTopLeft()
Return the segment with the top-leftmost first point


isSegmentOutside

boolean isSegmentOutside(java.awt.Shape shape)
Returns if the path has a segment outside a shape