com.itextpdf.text.pdf.parser
Class BezierCurve

java.lang.Object
  extended by com.itextpdf.text.pdf.parser.BezierCurve
All Implemented Interfaces:
Shape

public class BezierCurve
extends Object
implements Shape

Represents a Bezier curve.

Since:
5.5.6

Field Summary
static double curveCollinearityEpsilon
          If the distance between a point and a line is less than this constant, then we consider the point lies on the line.
static double distanceToleranceManhattan
          The Manhattan distance is used in the case when either the line ((x1, y1), (x4, y4)) passes through both (x2, y2) and (x3, y3) or (x1, y1) = (x4, y4).
static double distanceToleranceSquare
          In the case when neither the line ((x1, y1), (x4, y4)) passes through both (x2, y2) and (x3, y3) nor (x1, y1) = (x4, y4) we use the square of the sum of the distances mentioned below in compare to this field as the criterion of good approximation. 1.
 
Constructor Summary
BezierCurve(List<Point2D> controlPoints)
          Constructs new bezier curve.
 
Method Summary
 List<Point2D> getBasePoints()
          Treat base points as the points which are enough to construct a shape.
 List<Point2D> getPiecewiseLinearApproximation()
          You can adjust precision of the approximation by varying the following parameters: curveCollinearityEpsilon, distanceToleranceSquare, distanceToleranceManhattan
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

curveCollinearityEpsilon

public static double curveCollinearityEpsilon
If the distance between a point and a line is less than this constant, then we consider the point lies on the line.


distanceToleranceSquare

public static double distanceToleranceSquare
In the case when neither the line ((x1, y1), (x4, y4)) passes through both (x2, y2) and (x3, y3) nor (x1, y1) = (x4, y4) we use the square of the sum of the distances mentioned below in compare to this field as the criterion of good approximation. 1. The distance between the line and (x2, y2) 2. The distance between the line and (x3, y3)


distanceToleranceManhattan

public static double distanceToleranceManhattan
The Manhattan distance is used in the case when either the line ((x1, y1), (x4, y4)) passes through both (x2, y2) and (x3, y3) or (x1, y1) = (x4, y4). The essential observation is that when the curve is a uniform speed straight line from end to end, the control points are evenly spaced from beginning to end. Our measure of how far we deviate from that ideal uses distance of the middle controls: point 2 should be halfway between points 1 and 3; point 3 should be halfway between points 2 and 4.

Constructor Detail

BezierCurve

public BezierCurve(List<Point2D> controlPoints)
Constructs new bezier curve.

Parameters:
controlPoints - Curve's control points.
Method Detail

getBasePoints

public List<Point2D> getBasePoints()
Treat base points as the points which are enough to construct a shape. E.g. for a bezier curve they are control points, for a line segment - the start and the end points of the segment.

Specified by:
getBasePoints in interface Shape
Returns:
Ordered List consisting of shape's base points.

getPiecewiseLinearApproximation

public List<Point2D> getPiecewiseLinearApproximation()
You can adjust precision of the approximation by varying the following parameters: curveCollinearityEpsilon, distanceToleranceSquare, distanceToleranceManhattan

Returns:
List containing points of piecewise linear approximation for this bezier curve.
Since:
5.5.6


Copyright © 2015. All Rights Reserved.