public class NearestPointPathConstructor
extends org.freehep.graphicsio.QuadToCubicPathConstructor
Constructor and Description |
---|
NearestPointPathConstructor(Point2D arbitraryPoint)
Creates a path constructor with given arbitrary point
|
Modifier and Type | Method and Description |
---|---|
void |
closePath(double x0,
double y0)
Closes the current path, called from addPath.
|
void |
cubic(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
Adds a cubic bezier to the path, called from addPath.
|
double |
distanceSq()
Returns squared distance from the arbitrary point to the nearest point on
path.
|
Point2D |
getNearestPoint()
Returns nearest point on path, nearest to the given arbitrary point, or
null if path is empty.
|
void |
line(double x,
double y)
Adds a line to the path, called from addPath.
|
protected void |
pointFound(Point2D nearestPoint,
double distanceSq,
boolean closer)
Called when a closer or equal point is found, so that the subclass can
use this to track some other information, such as keeping a reference to
the closest object(s).
|
public NearestPointPathConstructor(Point2D arbitraryPoint)
public void line(double x, double y) throws IOException
line
in interface org.freehep.graphicsio.PathConstructor
line
in class org.freehep.graphicsio.QuadToCubicPathConstructor
IOException
public void cubic(double x1, double y1, double x2, double y2, double x3, double y3) throws IOException
cubic
in interface org.freehep.graphicsio.PathConstructor
cubic
in class org.freehep.graphicsio.QuadToCubicPathConstructor
IOException
public void closePath(double x0, double y0) throws IOException
closePath
in interface org.freehep.graphicsio.PathConstructor
closePath
in class org.freehep.graphicsio.QuadToCubicPathConstructor
IOException
public Point2D getNearestPoint()
public double distanceSq()
protected void pointFound(Point2D nearestPoint, double distanceSq, boolean closer)
Copyright © 1996-2014 FreeHEP. All Rights Reserved.