GGMultiGravity.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Bier, April 27, 1987 2:30:33 pm PDT
Contents: Performs hit testing similar to GGGravity. Instead of returning a single nearest feature, we return the N (or fewer) nearest features which are within a given tolerance distance from the test point. The algorithm used is described in [Cyan]<Gargoyle>Documentation>MultiGravity.tioga.
Pier, November 21, 1986 10:40:42 am PST
DIRECTORY
GGBasicTypes, GGInterfaceTypes;
GGMultiGravity: CEDAR DEFINITIONS =
BEGIN
Caret: TYPE = GGInterfaceTypes.Caret;
FeatureData: TYPE = GGInterfaceTypes.FeatureData;
GGData: TYPE = GGInterfaceTypes.GGData;
TriggerBag: TYPE = REF TriggerBagObj;
TriggerBagObj: TYPE = GGInterfaceTypes.TriggerBagObj;
AlignBag: TYPE = REF AlignBagObj;
AlignBagObj: TYPE = GGInterfaceTypes.AlignBagObj;
NearFeatures: TYPE = REF NearFeaturesObj;
NearFeaturesObj:
TYPE =
RECORD [
features: SEQUENCE len: NAT OF FeatureData];
NearPoints: TYPE = REF NearPointsObj;
NearPointsObj:
TYPE =
RECORD [
points: SEQUENCE len: NAT OF Point];
NearDistances: TYPE = REF NearDistancesObj;
NearDistancesObj:
TYPE =
RECORD [
distances: SEQUENCE len: NAT OF REAL];
Point: TYPE = GGBasicTypes.Point;
Map:
PROC [testPoint: Point, criticalR:
REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData, useAlignBag:
BOOL]
RETURNS [resultPoint: Point, feature: FeatureData, hitData:
REF
ANY];
Dispatches to StrictDistance or InnerCircle as appropriate.
StrictDistance:
PROC [testPoint: Point, criticalR:
REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData]
RETURNS [resultPoint: Point, feature: FeatureData, hitData:
REF
ANY];
Calls MultiStrictDistance and picks a single "best" feature.
PointsPreferred:
PROC [testPoint: Point, criticalR:
REAL, innerR:
REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData, useAlignBag:
BOOL]
RETURNS [resultPoint: Point, feature: FeatureData, hitData:
REF
ANY];
Calls MultiPointsPreferred and picks a single "best" feature.
GoodPoint: TYPE = REF GoodPointObj;
GoodPointObj:
TYPE =
RECORD [
dist: REAL,
point: Point,
featureData: FeatureData, -- this point
hitData: REF ANY -- a description of this point
];
NearPointsAndCurves: TYPE = REF NearPointsAndCurvesObj;
NearPointsAndCurvesObj:
TYPE =
RECORD [
things: SEQUENCE len: NAT OF GoodPoint];
The REF ANY is either a GoodCurve or a GoodPoint
MultiMap:
PUBLIC
PROC [testPoint: Point, criticalR:
REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData, useAlignBag:
BOOL]
RETURNS [nearPointsAndCurves: NearPointsAndCurves, count:
NAT];
Dispatches to MultiStrictDistance or MultiInnerCircle depending on the Gargoyle Gravity Type button in the user interface.
MultiStrictDistance:
PROC [testPoint: Point, criticalR:
REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData]
RETURNS [nearPointsAndCurves: NearPointsAndCurves, count:
NAT];
Returns up to n closest features, their closest points, and their distances from the testpoint. Features outside of the critical radius, criticalR, may or may not be included. The results will be located in features[0] .. features[count-1], points[0] .. points[count-1], and distances[0] .. distances[count-1].
MultiPointsPreferred
:
PROC [testPoint: Point, criticalR:
REAL, innerR:
REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData, useAlignBag:
BOOL]
RETURNS [nearPointsAndCurves: NearPointsAndCurves, count:
NAT];
Returns up to n closest features, their closest points, and their distances from the testpoint. Features outside of the critical radius, criticalR, may or may not be included. The results will be located in features[0] .. features[count-1], points[0] .. points[count-1], and distances[0] .. distances[count-1]. If any points are within the critical radius criticalR, then only points (e.g. vertices, control points, and intersection points) will be mentioned. Otherwise, "features" will consist of a mixture of points and curves.
NewMultiGravityPool: PROC [] RETURNS [REF]; -- stored in GGData; temporary storage pool used by GGMultiGravityImpl
END.