DIRECTORY RVHandleUtils USING [Point, VertexHandle], ClientStateInfo USING [State, StateCombiner], IO, Imager; RCombiner: CEDAR DEFINITIONS = BEGIN OPEN RVHU: RVHandleUtils, CSI: ClientStateInfo; in, out: IO.STREAM; -- global variables for log writing OutsideCurrentTrilean: TYPE = {INTERSECTSOUTLINE, EXTERNAL, ENCLOSES}; InsideCurrentTrilean: TYPE = {INTERSECTSOUTLINE, INSINGLEPOLYGON, INMULTIPLEPOLYGONS}; LensTransitionType: TYPE = {EXTERIORTOINTERIOR, INTERIORTOEXTERIOR, INTERIORTOINTERIOR }; Combiner: PROC[ currentw, inputw: RVHU.VertexHandle, inputState: CSI.State, stateCombiner: CSI.StateCombiner ] RETURNS [combinedw: RVHU.VertexHandle]; CombineGeometry: PROC[ currentw, inputw: RVHU.VertexHandle, setIntersectionPolygonEdges: BOOL _ TRUE] RETURNS [combinedw, intersectionPolygonv, intersectionPolygonw: RVHU.VertexHandle]; CombineState: PROC[ intersectionPolygonv, intersectionPolygonw: RVHU.VertexHandle, inputState: CSI.State, stateCombiner: CSI.StateCombiner]; InputvOutsideCurrentOutline: PROC[ currentfigurecom: RVHU.Point, v1, w1, v2, w2: RVHU.VertexHandle ] RETURNS [outsideCurrentStatus: OutsideCurrentTrilean, v3, w3, v4, w4: RVHU.VertexHandle]; InputvInsideCurrentOutline: PROC[ currentfigurecom: RVHU.Point, v1, w1, v2, w2: RVHU.VertexHandle ] RETURNS [intsideCurrentStatus: InsideCurrentTrilean, v3, w3, v4, w4: RVHU.VertexHandle ]; InputIntersectsCurrent: PROC[ lensTransitionType: LensTransitionType, currentv, currentw, inputv, inputw: RVHU.VertexHandle, setIntersectionPolygonEdges: BOOL _ TRUE ] RETURNS [voutline, woutline: RVHU.VertexHandle _ NIL, intersectionPolygonv, intersectionPolygonw: RVHU.VertexHandle]; InputExternalToCurrent: PROC[ currentv, currentw, inputv, inputw: RVHU.VertexHandle, currentoutlinecom, inputfigurecom: RVHU.Point] RETURNS [combinedv, combinedw: RVHU.VertexHandle]; PolygonEnclosesPolygon : PROC[ innercom: RVHU.Point, innerv, innerw, outerv, outerw: RVHU.VertexHandle]; LensDecomposition: PROC[ firstv, v, pj, qi: RVHU.VertexHandle, lensInExterior: BOOL, setIntersectionPolygonEdges: BOOL _ TRUE] RETURNS [ returnedToFirstv: BOOL, vending, pj1ending, pjending, qi1ending, qiending: RVHU.VertexHandle]; GrowToConvexOutline: PROC[w2, v, w1: RVHU.VertexHandle, outline: BOOL _ FALSE] RETURNS [v3,w3: RVHU.VertexHandle]; InsertIntersectionPoint: PROC[pj1, pj, qi, qip1: RVHU.VertexHandle] RETURNS [vh: RVHU.VertexHandle]; JoinVerticesOnOutline: PROC[ prew2, w2, w1, forw1: RVHU.VertexHandle, setLRE: BOOL _ TRUE]; JoinVerticesInLens: PROC[ pj1, pj, qi1, qi: RVHU.VertexHandle]; SetFigureVisitedValues: PROC[v: RVHU.VertexHandle, visitedValue: BOOLEAN]; ClearIntersectPolygonFields: PROC [v, w: RVHU.VertexHandle]; END. ~RCombiner.mesa Last Edited by: Arnon, November 26, 1985 10:49:05 am PST Variables and Types 9/19/85 - we will declare the INMULTIPLEPOLYGONS case for a polygon which is contained in the closure of a single internal polygon, but which intersects its boundary? Main procedures currentw is a vertex on the (convex) outline of the current figure. inputw is a vertex on the input polygon. combinedw is a vertex on the (convex) outline of the combined figure. currentw is a vertex on the (convex) outline of the current figure. inputw is a vertex on the input polygon. combinedw is a vertex on the (convex) outline of the combined figure. [intersectionPolygonv, intersectionPolygonw] is a (directed) edge in the new (i.e. combined) geometry which is contained in the intersection polygon (of current figure and input polygon), and such that the interior of the intersection polygon lies to its left. If the intersection polygon is empty, then both intersectionPolygonv and intersectionPolygonw are set to NIL. If setIntersectionPolygonEdges, then CombineGeometry sets the intersectionPolygonEdge fields of all (directed) edges in the new (i.e. combined) geometry which are contained in the intersection polygon (of current figure and input polygon), and such that the interior of the intersection polygon lies to their left. Although this functionality is provided as an essential preprocessing step for CombineState, note that it is a purely geometrical operation. It can be undone with ClearIntersectionPolygonEdges. Combiner case analysis [intersectionPolygonv, intersectionPolygonw] is a counterclockwise oriented (directed) edge in the current (i.e. combined) geometry which is contained in the intersection polygon (of current figure and input polygon), and such that the interior of the intersection polygon lies to its left. inputState is the state of the input polygon. stateCombiner is the rule for state combination. The leftState fields of the edges of all polygons interior to the intersection polygon are set to the result of state combining inputState with the states those polygons had in the current figure. The algorithm uses Depth First Search. CombineState assumes that the intersectionPolygonEdge fields of all (directed) edges in the new (i.e. combined) geometry which are contained in the intersection polygon (of current figure and input polygon), and such that the interior of the intersection polygon lies to their left, are set. It doesn't clear them. [intersectionPolygonv, intersectionPolygonw] is a (directed) edge in the current (i.e. combined) geometry which is contained in the intersection polygon (of current figure and input polygon), and such that the interior of the intersection polygon lies to its left. The intersection polygon is followed around and the intersectionPolygonEdge fields of its edges cleared. Convex decomposers Vertex and adjacency insertion Boolean field modification Κ„˜™J™8J™—šΟk ˜ Jšœœ˜*Jšœœ˜-Jšœ˜J˜Jšœ˜—JšΟn œœ œœœœœ˜TJ˜Jšœ™šœ œœΟc#˜7J˜—š œœœœœ˜FJ˜—š œœœœœ˜VJšœ¦™¦J™—Jš œœœœœ˜Y˜J˜—šœ™J˜—šžœœœœœœ œ˜–J•commentTRUEšœ΄™΄J™—šžœœœ,œœœ9œ˜ΉJ–TRUEšœ§™§Jšœώ™ώJ™—Jš ž œœ.œœœ˜J˜šœ™J–TRUEšœ™Jšœλ™λJšœ»™»J™J˜—š žœœœœœ?œ˜ΏJ™—š žœœœœœ>œ˜½J˜—šžœœNœ,œœœœœ.œ˜J˜J–TRUEšœς™ςJ˜—š žœœ&œ2œœœ˜ΆJ˜—Jšžœœ œ(œ˜hJ˜šœ™J˜—šžœœœœœœœœ5œ˜ηJ˜—Jšžœœ œœœœœ˜rJ˜šœ™J˜—š žœœœœœ˜dJ˜—š žœœœœœ˜[J˜—Jšžœœœ˜?J˜šœ™J˜—šžœœœœ˜JJ˜—Icodešžœœœ˜<šœ˜J™——…— ’”