GGMultiGravity.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Bier, July 7, 1987 2:51:15 pm PDT
Contents: Performs hit testing similar to uniGravity. 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, October 13, 1987 10:29:37 am PDT
DIRECTORY
GGBasicTypes, GGInterfaceTypes;
GGMultiGravity: CEDAR DEFINITIONS =
BEGIN
AlignBag: TYPE = REF AlignBagObj;
AlignBagObj: TYPE = GGInterfaceTypes.AlignBagObj;
Caret: TYPE = GGInterfaceTypes.Caret;
FeatureCycler: TYPE = GGInterfaceTypes.FeatureCycler;
FeatureData: TYPE = GGInterfaceTypes.FeatureData;
GGData: TYPE = GGInterfaceTypes.GGData;
NearVertexEdgeAndFaces: TYPE = GGInterfaceTypes.NearVertexEdgeAndFaces;
Point: TYPE = GGBasicTypes.Point;
TriggerBag: TYPE = REF TriggerBagObj;
TriggerBagObj: TYPE = GGInterfaceTypes.TriggerBagObj;
Vector: TYPE = GGBasicTypes.Vector;
Map: PROC [testPoint: Point, t: REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData, intersections: BOOL] RETURNS [resultPoint: Point, normal: Vector, feature: FeatureData, hitData: REF ANY];
Dispatches to StrictDistance or InnerCircle as appropriate.
PointsPreferred: PROC [testPoint: Point, t: REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData, intersections: BOOL] RETURNS [resultPoint: Point, normal: Vector, feature: FeatureData, hitData: REF ANY];
LinesPreferred: PROC [testPoint: Point, t: REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData] RETURNS [resultPoint: Point, normal: Vector, feature: FeatureData, hitData: REF ANY];
Calls MultiStrictDistance and picks a single "best" feature. If there are no good features within radius t of testPoint, then resultPoint = testPoint and feature = hitData = NIL.
FacesPreferred: PROC [testPoint: Point, t: REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData] RETURNS [resultPoint: Point, normal: Vector, feature: FeatureData, hitData: REF ANY];
Calls MultiPointsPreferred and picks a single "best" feature. If there are no good features within radius t of testPoint, then resultPoint = testPoint and feature = hitData = NIL. If intersections is TRUE then compute all pair-wise intersections of gravity-active curves and count them as distinguished points.
MapCycler: PROC [testPoint: Point, t: REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData, intersections: BOOL] RETURNS [featureCycler: FeatureCycler];
PointsPreferredCycler: PROC [testPoint: Point, t: REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData, intersections: BOOL, maxDimension: [0..1] ← 1] RETURNS [featureCycler: FeatureCycler];
LinesPreferredCycler: PROC [testPoint: Point, t: REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData] RETURNS [featureCycler: FeatureCycler];
Calls MultiStrictDistance and picks a single "best" feature. If there are no good features within radius t of testPoint, then resultPoint = testPoint and feature = hitData = NIL.
FacesPreferredCycler: PROC [testPoint: Point, t: REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData] RETURNS [featureCycler: FeatureCycler];
EmptyCycler: PROC [testPoint: Point] RETURNS [featureCycler: FeatureCycler];
Calls MultiPointsPreferred and picks a single "best" feature. If there are no good features within radius t of testPoint, then resultPoint = testPoint and feature = hitData = NIL. If intersections is TRUE then compute all pair-wise intersections of gravity-active curves and count them as distinguished points.
Dispatches to StrictDistance or InnerCircle as appropriate.
FirstFeature: PROC [featureCycler: FeatureCycler] RETURNS [resultPoint: Point, normal: Vector, feature: FeatureData, hitData: REF ANY];
NextFeature: PROC [featureCycler: FeatureCycler] RETURNS [resultPoint: Point, normal: Vector, feature: FeatureData, hitData: REF ANY];
PreviousFeature: PROC [featureCycler: FeatureCycler] RETURNS [resultPoint: Point, normal: Vector, feature: FeatureData, hitData: REF ANY];
MultiMap: PUBLIC PROC [testPoint: Point, t: REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData, intersections: BOOL] RETURNS [nearVEF: NearVertexEdgeAndFaces, count: NAT];
Dispatches to MultiStrictDistance or MultiInnerCircle depending on the Gargoyle Gravity Type button in the user interface.
MultiLinesPreferred: PROC [testPoint: Point, t: REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData] RETURNS [nearVEF: NearVertexEdgeAndFaces, count: NAT];
Returns up to n closest features, their closest points, and their distances from the testpoint. Features farther than t from testPoint 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, t: REAL, alignBag: AlignBag, sceneBag: TriggerBag, ggData: GGData, intersections: BOOL] RETURNS [nearVEF: NearVertexEdgeAndFaces, count: NAT];
Returns up to n closest features, their closest points, and their distances from the testpoint. Features farther than t from testPoint 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 radius t/2 of testPoint, 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; storage pool for GGMultiGravityImpl
END.