maspack.geometry
Class QuadBezierDistance2d
java.lang.Object
maspack.geometry.QuadBezierDistance2d
public class QuadBezierDistance2d
- extends java.lang.Object
Class to calculate distances between a 2D Quadratic Bezier B-spline curve
and a point in the plane.
Special thanks to Olivier Besson for providing the actual distance
calculations:
http://blog.gludion.com/2009/08/distance-to-quadratic-bezier-curve.html
Method Summary |
double |
computeDistance(Vector2d near,
Vector2d pnt,
double maxd)
|
double |
computeDistance(Vector2d near,
Vector2d pnt,
Vector4d p0,
Vector4d p1,
Vector4d p2)
This algorithim should work for 3d curves as well. |
double |
computeInteriorDistance(Vector2d near,
Vector2d pnt)
|
double |
computeMaxCurvature()
|
double |
computeMaxCurvature(Vector4d p0,
Vector4d p1,
Vector4d p2)
Computes the maximum curvature for a single Bezier segment. |
double |
getHullDistance(Point2d pnt,
Vector4d p0,
Vector4d p1,
Vector4d p2)
|
void |
setCurve(NURBSCurve2d curve)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QuadBezierDistance2d
public QuadBezierDistance2d()
QuadBezierDistance2d
public QuadBezierDistance2d(NURBSCurve2d curve)
setCurve
public void setCurve(NURBSCurve2d curve)
computeMaxCurvature
public double computeMaxCurvature()
computeDistance
public double computeDistance(Vector2d near,
Vector2d pnt,
Vector4d p0,
Vector4d p1,
Vector4d p2)
- This algorithim should work for 3d curves as well.
computeMaxCurvature
public double computeMaxCurvature(Vector4d p0,
Vector4d p1,
Vector4d p2)
- Computes the maximum curvature for a single Bezier segment.
Taken from
http://algorithmist.wordpress.com/2010/12/01/quad-bezier-curvature/
getHullDistance
public double getHullDistance(Point2d pnt,
Vector4d p0,
Vector4d p1,
Vector4d p2)
computeDistance
public double computeDistance(Vector2d near,
Vector2d pnt,
double maxd)
computeInteriorDistance
public double computeInteriorDistance(Vector2d near,
Vector2d pnt)