33 #define MIN_INERTIA (0.00001)
61 StartPoint = outline->
loop;
62 EdgePoint = StartPoint;
64 NextPoint = EdgePoint->
next;
67 if (EdgePoint->
pos.
x != NextPoint->
pos.
x ||
68 EdgePoint->
pos.
y != NextPoint->
pos.
y) {
74 MFOutline =
push(MFOutline, NewPoint);
76 EdgePoint = NextPoint;
77 }
while (EdgePoint != StartPoint);
79 if (MFOutline !=
NULL)
97 while (outline !=
NULL) {
99 if (mf_outline !=
NULL)
100 mf_outlines =
push(mf_outlines, mf_outline);
101 outline = outline->
next;
149 while (EdgePoint != Outline);
194 while (EdgePoint != Outline);
218 while (Start !=
NULL) {
274 while (Last != First);
303 while (!
PointAt(EdgePoint)->ExtremityMark)
340 }
while (EdgePoint != Outline);
378 *XScale *= OutlineStats.
Ry;
379 *YScale *= OutlineStats.
Rx;
393 OutlineStats.
x, OutlineStats.
y,
430 for (Current = Start; Current != End; Current =
NextPointAfter (Current))
431 PointAt (Current)->Direction = Direction;
433 PointAt (End)->PreviousDirection = Direction;
466 CurrentPoint =
PointAt (Current);
468 (CurrentPoint->
Point.
x - XCenter) * XScale;
470 (CurrentPoint->
Point.
y - YCenter) * YScale;
474 while (Current != First);
519 Start->
Slope = Delta.
y / Delta.
x;
522 if (Start->
Slope > MinSlope)
523 if (Start->
Slope < MaxSlope)
529 else if (Start->
Slope < -MinSlope)
530 if (Start->
Slope > -MaxSlope)
536 else if (Delta.
y > 0)
537 if (Start->
Slope < -MinSlope)
538 if (Start->
Slope > -MaxSlope)
544 else if (Start->
Slope > MinSlope)
545 if (Start->
Slope < MaxSlope)
570 OutlineStats->
x = 0.5 * OutlineStats->
My / OutlineStats->
L;
571 OutlineStats->
y = 0.5 * OutlineStats->
Mx / OutlineStats->
L;
573 OutlineStats->
Ix = (OutlineStats->
Ix / 3.0 -
574 OutlineStats->
y * OutlineStats->
Mx +
575 OutlineStats->
y * OutlineStats->
y * OutlineStats->
L);
577 OutlineStats->
Iy = (OutlineStats->
Iy / 3.0 -
578 OutlineStats->
x * OutlineStats->
My +
579 OutlineStats->
x * OutlineStats->
x * OutlineStats->
L);
582 if (OutlineStats->
Ix < 0.0)
584 if (OutlineStats->
Iy < 0.0)
587 OutlineStats->
Rx = sqrt (OutlineStats->
Ix / OutlineStats->
L);
588 OutlineStats->
Ry = sqrt (OutlineStats->
Iy / OutlineStats->
L);
590 OutlineStats->
Mx *= 0.5;
591 OutlineStats->
My *= 0.5;
608 OutlineStats->
Mx = 0.0;
609 OutlineStats->
My = 0.0;
610 OutlineStats->
L = 0.0;
611 OutlineStats->
x = 0.0;
612 OutlineStats->
y = 0.0;
613 OutlineStats->
Ix = 0.0;
614 OutlineStats->
Iy = 0.0;
615 OutlineStats->
Rx = 0.0;
616 OutlineStats->
Ry = 0.0;
637 InitialDirection =
PointAt (EdgePoint)->Direction;
643 }
while (
PointAt(EdgePoint)->Direction == InitialDirection &&
683 L = sqrt ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
684 OutlineStats->
L += L;
689 OutlineStats->
Mx += Mx2;
690 OutlineStats->
My += My2;
693 OutlineStats->
Ix += Mx2 * (y1 + y2) - L * y1 * y2;
694 OutlineStats->
Iy += My2 * (x1 + x2) - L * x1 * x2;