PotentialKnots.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Maureen Stone May 26, 1985 10:54:42 pm PDT
Doug Wyatt, September 5, 1985 2:35:55 pm PDT
DIRECTORY
LSPiece USING [Metrics],
FitState USING [Handle],
Complex USING [VEC],
Highlight USING [Context],
Cubic USING [Bezier];
PotentialKnots: CEDAR DEFINITIONS = {
DynPoly:
PROC [state: FitState.Handle, penalty, lineLength, maxAngle:
REAL];
finds potential knots by fitting a polygon using DynFit. IF two adjacent lines are each longer than lineLength AND the turning angle is >= maxAngle THEN force a corner at the intersection
QuickPoly:
PROC [state: FitState.Handle, highlight: Highlight.Context ←
NIL];
HVExtremes:
PROC [state: FitState.Handle, forceKnot:
BOOLEAN ←
FALSE];
Finds the horizontal and vertical extremes in a set of samples and puts a joint and tangent there.
FindCorners:
PROC [state: FitState.Handle, minK:
REAL, forceKnot:
BOOLEAN ←
FALSE];
Takes local curvatures. Defines as a corner any value with K>=minK.
FindInflections:
PROC [state: FitState.Handle, flat:
REAL, forceKnot:
BOOLEAN ←
FALSE];
Takes local curvatures. Looks for zero crossing or flat spots within tol. Zero crossing and center of flat spots get potential knots. Note that this will find the center of lines also.
FindDeltaKs:
PROC [state: FitState.Handle, minDK:
REAL, forceKnot:
BOOLEAN ←
FALSE];
Takes local curvatures. Mark as a potential knot any place the change in curvature is greater than minDK. Set tangents using QuickTangent algorithm
Find90:
PROC [state: FitState.Handle, long, tol:
REAL, forceKnot:
BOOLEAN ←
FALSE, highlight: Highlight.Context ←
NIL];
IF two flat lines (flat within tol) less than long meet at a corner, mark it. Assumes flat lines are horizontal or vertical (only cases that will in practice pass the flatness test for small values of minFlat)
HVLines:
PUBLIC PROC [state: FitState.Handle, long, tol:
REAL, forceKnot:
BOOLEAN ←
FALSE, highlight: Highlight.Context ←
NIL];
HVTangents:
PROC [state: FitState.Handle, tol:
REAL, forceKnot:
BOOLEAN ←
FALSE];
Run this after setting the tangents to "true" the nearly horizontal and vertical tangents. tol=(small) positive angle in degrees.
NearlyEqual:
PUBLIC PROC [state: FitState.Handle, tol:
REAL];
Run this to make nearly equal left and right tangents the same. tol=angle.
ForceCorners:
PUBLIC
PROC [state: FitState.Handle, angle:
REAL];
Run this to force joints whose internal angle is less than angle.
QuickTangents:
PROC [state: FitState.Handle, maxAngle:
REAL, setCorners:
BOOLEAN ←
FALSE];
computes tangents at node points by differencing neighbors. If angle (in degrees) is greater than maximum angle the tangents are left unset or is set to the line to the nearest neighbor depending on setCorners.
SquareTangents:
PROC [state: FitState.Handle, maxAngle:
REAL, setCorners:
BOOLEAN ←
FALSE];
Same as above but weights by the square of the distances
CircleTangents:
PROC [state: FitState.Handle, maxAngle:
REAL];
computes tangents at node points by finding a circle through 3 adjacent nodes. Ignore joints where angle between neighbors is greater than maxAngle.
Progress:
TYPE = PROC[tangent: Complex.
VEC, cubic: Cubic.Bezier]
RETURNS [stop:
BOOLEAN];
CubicTangents:
PROC [state: FitState.Handle, metrics: LSPiece.Metrics, progress: Progress
← NIL];
Sets tangents at nodes by fitting a cubic between neighboring nodes
}.