PEHitTest.mesa
Written by Darlene Plebon on August 15, 1983 4:21 pm
Routines for hit testing on a path segment.
DIRECTORY
Graphics USING [Box],
PETypes;
PEHitTest: CEDAR DEFINITIONS =
BEGIN OPEN PETypes;
VertexHitTest: PROCEDURE [segmentList: SegmentList, point: Point] RETURNS [hitVertex: VertexNode, hitSegment: SegmentNode];
This routine returns the vertex node in the specified segment list that is closest to the specified point along with the segment node containing that vertex. If the specified point is not within a threshold distance of any vertex, NIL is returned for the closest vertex node.
SegmentHitTest: PROCEDURE [segmentList: SegmentList, point: Point] RETURNS [hitSegment: SegmentNode, hitPoint: Point, hitT: REAL];
This routine determines whether the specified point is "close" to one of the segments in the specified segment list. This routine returns the segment that the point is closest to (or NIL if the point is close to no segment), the point on that segment to which it is closest, and the value of the parameter t at that point.
TrajectoryHitTest: PROCEDURE [trajectoryList: TrajectoryList, point: Point] RETURNS [hitTrajectory: TrajectoryNode, hitPoint: Point];
This routines determines whether the specified point is "close" to one of the trajectories in the specified trajectory list. This routine returns the trajectory that the point is closest to (or NIL if the point is close to no trajectory) and the point on that trajectory to which it is closest.
BoundingBox: PROCEDURE [segment: Segment] RETURNS [box: Graphics.Box];
This routine determines a bounding box for the specified path segment.
BoxesIntersect: PROCEDURE [box1, box2: Graphics.Box] RETURNS [boxesIntersect: BOOLEAN];
This routine determines whether two bounding boxes intersect.
END.