|
JHotDraw 7.5.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jhotdraw.geom.Bezier
public class Bezier
Provides algorithms for fitting Bezier curves to a set of digitized points.
Source:
Phoenix: An Interactive Curve Design System Based on the Automatic Fitting
of Hand-Sketched Curves.
© Copyright by Philip J. Schneider 1988.
A thesis submitted in partial fulfillment of the requirements for the degree
of Master of Science, University of Washington.
http://autotrace.sourceforge.net/Interactive_Curve_Design.ps.gz
Method Summary | |
---|---|
static java.util.ArrayList<java.lang.Integer> |
findCorners(java.util.List<java.awt.geom.Point2D.Double> digitizedPoints,
double minAngle,
double minDistance)
Finds corners in the provided point list, and returns their indices. |
static BezierPath |
fitBezierPath(BezierPath digitizedPoints,
double error)
Fits a bezier path to the specified list of digitized points. |
static BezierPath |
fitBezierPath(java.util.List<java.awt.geom.Point2D.Double> digitizedPoints,
double error)
Fits a bezier path to the specified list of digitized points. |
static BezierPath |
fitBezierPath(java.awt.geom.Point2D.Double[] digitizedPoints,
double error)
Fits a bezier path to the specified list of digitized points. |
static void |
main(java.lang.String[] args)
|
static java.util.ArrayList<java.awt.geom.Point2D.Double> |
reduceNoise(java.util.List<java.awt.geom.Point2D.Double> digitizedPoints,
double weight)
Reduces noise from the digitized points, by applying an approximation of a gaussian filter to the data. |
static java.util.ArrayList<java.awt.geom.Point2D.Double> |
removeClosePoints(java.util.List<java.awt.geom.Point2D.Double> digitizedPoints,
double minDistance)
Removes points which are closer together than the specified minimal distance. |
static java.util.ArrayList<java.util.ArrayList<java.awt.geom.Point2D.Double>> |
splitAtCorners(java.util.List<java.awt.geom.Point2D.Double> digitizedPoints,
double maxAngle,
double minDistance)
Splits the digitized points into multiple segments at each corner point. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void main(java.lang.String[] args)
public static BezierPath fitBezierPath(java.awt.geom.Point2D.Double[] digitizedPoints, double error)
This is a convenience method for calling fitCubicSegments(List
digitizedPoints
- digited points.error
- the maximal allowed error between the bezier path and the
digitized points.
public static BezierPath fitBezierPath(java.util.List<java.awt.geom.Point2D.Double> digitizedPoints, double error)
digitizedPoints
- digited points.error
- the maximal allowed error between the bezier path and the
digitized points.public static BezierPath fitBezierPath(BezierPath digitizedPoints, double error)
This is a convenience method for calling fitCubicSegments(List
digitizedPoints
- digited points.error
- the maximal allowed error between the bezier path and the
digitized points.
public static java.util.ArrayList<java.awt.geom.Point2D.Double> removeClosePoints(java.util.List<java.awt.geom.Point2D.Double> digitizedPoints, double minDistance)
The minimal distance should be chosen dependent on the size and resolution of the display device, and on the sampling rate. A good value for mouse input on a display with 100% Zoom factor is 2.
The purpose of this method, is to remove points, which add no additional information about the shape of the curve from the list of digitized points.
The cleaned up set of digitized points gives better results, when used
as input for method splitAtCorners(java.util.List
.
digitizedPoints
- Digitized pointsminDistance
- minimal distance between two points. If minDistance is
0, this method only removes sequences of coincident points.
public static java.util.ArrayList<java.util.ArrayList<java.awt.geom.Point2D.Double>> splitAtCorners(java.util.List<java.awt.geom.Point2D.Double> digitizedPoints, double maxAngle, double minDistance)
Corner points are both contained as the last point of a segment and the first point of a subsequent segment.
digitizedPoints
- Digitized pointsmaxAngle
- maximal angle in radians between the current point and its
predecessor and successor up to which the point does not break the
digitized list into segments. Recommended value 44° = 44 * 180d / Math.PI
public static java.util.ArrayList<java.lang.Integer> findCorners(java.util.List<java.awt.geom.Point2D.Double> digitizedPoints, double minAngle, double minDistance)
digitizedPoints
- List of digitized points.minAngle
- Minimal angle for corner pointsminDistance
- Minimal distance between a point and adjacent points
for corner detection
public static java.util.ArrayList<java.awt.geom.Point2D.Double> reduceNoise(java.util.List<java.awt.geom.Point2D.Double> digitizedPoints, double weight)
The filter does the following for each point P, with weight 0.5:
x[i] = 0.5*x[i] + 0.25*x[i-1] + 0.25*x[i+1]; y[i] = 0.5*y[i] + 0.25*y[i-1] + 0.25*y[i+1];
digitizedPoints
- Digitized pointsweight
- Weight of the current point
|
Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project. Some rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |