|
Chapter: 1. Source code download,
2. Test results, 3. Test item and method,
4. Test code
1. Source code download
=>
NormalLines.zip,
ShortestNormalLines.zip
2. Test results
return=>page top
|
Figure1 Normal lines from a point to curves(NormalLines)
The normal Lines to a curve from a point are generally multiple,
so we distinguish the lines by their colors such as red, magenta, green
and so on. |
|
Figure2 Shotest normal lines from a point to curves(ShortestNormalLines)
The calculation of the shortest noramal line to a curve from a point is
equal to that of the closest point on the curve from the point. |
: Similar test =>
DrawTop test command
3. Test item and method
return=>page top
The methods to calculate the normal lines from a given point to a curve
are Curve2DUtil.getNormalLines and Curve2DUtil.getShortestNormalLine.
These methods are used for shape selection operation with clicking the mouse, so the processing speed is important for real-time
operation. Of course, the reliability is also important.
public static CurvePT[] getNormalLines(Point2D point, Curve2D curve)
Parameters:
point - The given point.
curve - The Curve2D object of the (parametric) curve.
Returns:
The array of the CurvePT objects representing the points on the curve. If the normal lines to the
curve are found, the getNormalLines method returns the array of the points (stored
in the CurvePT objects) which are the endpoints of the lines and lying on the curve,
otherwise retunets the array of 0-length
4. Test code
return=>page top
4.1 Classes Overview
4.1.1 NormalLines
Class
|
Description
|
NormalLines
|
public class NormalLines extends JFrame
Creates and assembles the objects of the Jframe, JScrollPane, JViewport
and the Panel.
|
NormalLinesPanel |
public class NormalLinesPanel extends JPanel
Draws curves and normal lines on this panel.
|
TestCase |
public class TestCase
=> TestCase of the RegionHitTest.
|
TestCurve |
public class TestCurve
=> TestCurve of the RegionHitTest.
|
Parametric Curves |
Segment2D,
Curve2D,
Rectangle2DE,
RoundRectangle2DE,
Ellipse2DE,
Line2DE,
Polyline2DE,
CubicCurve2DE, GeneralCurve2DE, FergusonCurve2D |
Geometric Library |
Curve2DUtil.getNormalLines,
Curve2DUtil.getShortestNormalLine,
CurvePT,
Matrix,
Matrix2D
|
4.1.2 ShortestNormalLines
4.2 Specifications
return=>page top
4.2.1 public class NormalLinesPanel extends JPanel
Method
|
Description
|
createTestCase |
public void createTestCase()
Creates TastCase objects.
|
paint |
public void paint(Graphics g)
Draws the curves and the normal lines on this object shown as Figure1.
The calculation of the normal lines from a given point to a curves is performed
by Curve2DUtil.getNormalLines method.
|
4.2.2 public class ShortestNormalLinesPanel extends JPanel
Method
|
Description
|
createTestCase |
public void createTestCase()
Creates TastCase objects.
|
paint |
public void paint(Graphics g)
Draws the curves and the normal lines on this object shown as Figure2.
The calculation of the shortest normal lines from a given point to a curves is performed by the
Curve2DUtil.getShortestNormalLine method.
|
|