path-intersection.h revision 76addc201c409e81eaaa73fe27cc0f79c4db097c
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * \brief Path intersection
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * Copyright ?-? authors
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * This library is free software; you can redistribute it and/or
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * modify it either under the terms of the GNU Lesser General Public
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * License version 2.1 as published by the Free Software Foundation
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * (the "LGPL") or, at your option, under the terms of the Mozilla
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * Public License Version 1.1 (the "MPL"). If you do not alter this
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * notice, a recipient may use your version of this file under either
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * the MPL or the LGPL.
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * You should have received a copy of the LGPL along with this library
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * in the file COPYING-LGPL-2.1; if not, write to the Free Software
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * You should have received a copy of the MPL along with this library
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * in the file COPYING-MPL-1.1
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * The contents of this file are subject to the Mozilla Public License
475f79972f5d3572c0a3c98161ce8e406dd8b3daJohan Engelen * Version 1.1 (the "License"); you may not use this file except in
475f79972f5d3572c0a3c98161ce8e406dd8b3daJohan Engelen * compliance with the License. You may obtain a copy of the License at
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * OF ANY KIND, either express or implied. See the LGPL or the MPL for
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen * the specific language governing rights and limitations.
d2218db71152598971a13b08777cc0589d7f2592Johan Engeleninline bool contains(Path const & p, Point const &i, bool evenodd = true) {
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen return (evenodd ? winding(p, i) % 2 : winding(p, i)) != 0;
d2218db71152598971a13b08777cc0589d7f2592Johan EngelenCrossings curve_sweep(Path const &a, Path const &b) {
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen std::vector<Rect> bounds_a = bounds(a), bounds_b = bounds(b);
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen std::vector<std::vector<unsigned> > ixs = sweep_bounds(bounds_a, bounds_b);
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen for(unsigned i = 0; i < a.size(); i++) {
d2218db71152598971a13b08777cc0589d7f2592Johan Engelen for(std::vector<unsigned>::iterator jp = ixs[i].begin(); jp != ixs[i].end(); ++jp) {
return ret;
CrossingSet crossings(PathVector const &a, PathVector const &b) { return Crosser<Path>::crossings(a, b); }
Crossings crossings(Path const &a, Path const &b) { return crossings(PathVector(a), PathVector(b))[0]; }
return c.crossings(a, b);
return c.crossings(a, b);
return c.crossings(a, b);