AreaOp.java revision 2362
2362N/A * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved. 893N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 893N/A * This code is free software; you can redistribute it and/or modify it 893N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 893N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 893N/A * This code is distributed in the hope that it will be useful, but WITHOUT 893N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 893N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 893N/A * version 2 for more details (a copy is included in the LICENSE file that 893N/A * accompanied this code). 893N/A * You should have received a copy of the GNU General Public License version 893N/A * 2 along with this work; if not, write to the Free Software Foundation, 893N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 893N/A // Note: the right curves should be an empty set with this op... 893N/A // assert(e.getCurveTag() == CTAG_LEFT); 893N/A // Note: the right curves should be an empty set with this op... 893N/A // assert(e.getCurveTag() == CTAG_LEFT); 893N/A /* Constants to tag the left and right curves in the edge list */ 893N/A /* Constants to classify edges */ 893N/A /* Constants used to classify result state */ double yrange[] =
new double[
2];
// Active edges are between left (inclusive) and right (exclusive) // Prune active edges that fall off the top of the active y range // Grab a new "top of Y range" if the active edges are empty // Incorporate new active edges that enter the active y range // Sort the current active edges by their X values and // determine the maximum valid Y range where the X ordering // Note: We could start at left+1, but we need to make // sure that edgelist[left] has its equivalence set to 0. // If the curves are equal, mark them to be // deleted later if they cancel each other // out so that we avoid having extraneous // Now prune the active edge list. // For each edge in the list, determine its classification // (entering shape, exiting shape, ignore - no change) and // record the current Y range and its classification in the // Edge object for use later in constructing the new outline. // Find one of the segments in the "equal" range // with the right transition state and prefer an // edge that was either active up until ystart // or the edge that extends the furthest downward // (i.e. has the most potential for continuation) // Note: classify() must be called // on every edge we consume here. // assert(getState() == AreaOp.RSTAG_OUTSIDE); // Finally capture the bottom of the valid Y range as the top * Connect chains or links if they are the only things left... // assert(link != null && chain != null); * Connect chains or links if they close off an open area... * Connect chains or links if their successor is * between them and their potential connectee... // assert(chain != null); // assert(chain.getEtag() == link.getEtag()); * Does the position of the next edge at v1 "obstruct" the * connectivity between current edge and the potential * partner edge which is positioned at v2? * Phase tells us whether we are testing for a transition * into or out of the interior part of the resulting area. * Require 4-connected continuity if this edge and the partner * edge are both "entering into" type edges * Allow 8-connected continuity for "exiting from" type edges