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

Quick Search    Search Deep

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

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

private class Area.QuadSegment
extends Area.Segment

Quadratic Bezier curve segment Note: Most peers don't support quadratics directly, so it might make sense to represent them as cubics internally and just be done with it. I think we should be peer-agnostic, however, and stay faithful to the input geometry types as far as possible.


Field Summary
(package private)  Point2D cp
           
(package private)  Area.Segment next
           
(package private)  Area.Segment node
           
(package private)  Point2D P1
           
(package private)  Point2D P2
           
 
Constructor Summary
(package private) Area.QuadSegment(double x1, double y1, double cx, double cy, double x2, double y2)
          Constructor, takes the coordinates of the start, control, and end point, respectively.
 
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 The area formula can be derived by using Green's formula in the plane on the parametric form of the bezier.
(package private)  boolean equals(Area.Segment b)
          Compare two segments.
(package private)  Point2D evaluatePoint(double t)
          Returns a Point2D corresponding to the parametric value t of the curve
(package private)  Rectangle2D getBounds()
          Returns the bounding box of this segment
(package private)  Area.CubicSegment getCubicSegment()
          Returns a cubic segment corresponding to this curve
(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)  void insert(Area.Segment v)
          Inserts a Segment after this one
(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)  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 the PathIterator coords of a 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 quadratic-quadratic only, Quadratic-line is passed on to the LineSegment class, Quadratic-cubic is passed on to the CubicSegment class
(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

cp

Point2D cp

P1

Point2D P1

P2

Point2D P2

next

Area.Segment next

node

Area.Segment node
Constructor Detail

Area.QuadSegment

Area.QuadSegment(double x1,
                 double y1,
                 double cx,
                 double cy,
                 double x2,
                 double y2)
Constructor, takes the coordinates of the start, control, and end point, respectively.

Method Detail

clone

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


curveArea

double curveArea()
Returns twice the area of a curve, relative the P1-P2 line The area formula can be derived by using Green's formula in the plane on the parametric form of the bezier.

Specified by:
curveArea in class Area.Segment

equals

boolean equals(Area.Segment b)
Compare two segments.

Specified by:
equals in class Area.Segment

evaluatePoint

Point2D evaluatePoint(double t)
Returns a Point2D corresponding to the parametric value t of the curve


getBounds

Rectangle2D getBounds()
Returns the bounding box of this segment

Specified by:
getBounds in class Area.Segment

getCubicSegment

Area.CubicSegment getCubicSegment()
Returns a cubic segment corresponding to this curve


getMidPoint

Point2D getMidPoint()
Returns the segment's midpoint

Specified by:
getMidPoint in class Area.Segment

getType

int getType()
Returns the PathIterator type of a segment

Specified by:
getType in class Area.Segment

pathIteratorFormat

int pathIteratorFormat(double[] coords)
Returns the PathIterator coords of a segment

Specified by:
pathIteratorFormat 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

reverseCoords

void reverseCoords()
Swap start and end points

Specified by:
reverseCoords in class Area.Segment

splitIntersections

int splitIntersections(Area.Segment b)
Splits intersections into nodes, This one handles quadratic-quadratic only, Quadratic-line is passed on to the LineSegment class, Quadratic-cubic is passed on to the CubicSegment class

Specified by:
splitIntersections 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

transform

void transform(AffineTransform at)
Transforms the segment

Specified by:
transform 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