toposweep.h revision 76addc201c409e81eaaa73fe27cc0f79c4db097c
/**
* \file
* \brief TopoSweep - topology / graph representation of a PathVector, for boolean operations and related tasks
*//*
* Authors:
* Michael Sloan <mgsloan at gmail.com>
* Nathan Hurst <njhurst at njhurst.com>
*
* Copyright 2007-2009 authors
*
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*/
#ifndef LIB2GEOM_SEEN_TOPOSWEEP_H
#define LIB2GEOM_SEEN_TOPOSWEEP_H
#include <boost/shared_ptr.hpp>
// indicates a particular curve in a pathvector
struct CurveIx {
// retrieves the indicated curve from the pathvector
}
}
};
// represents a monotonic section of a path
struct Section {
double f, t;
Section(CurveIx cix, double fd, double td, Point fdp, Point tdp) : curve(cix), f(fd), t(td), fp(fdp), tp(tdp) { }
//swap from and to, since tp is left or above fp
swap(f, t);
}
}
}
};
// Represents an e double tol;dge on a vertex
unsigned other; // index of the vertex this edge points to
};
// Represents a vertex in the graph, in terms of a point and edges which enter and exit.
// A vertex has an "avg" point, which is a representative point for the vertex. All
// edges have an endpoint tol away.
};
//removes both edges, and returns the vertices[ix][jx] one
//returns a graph with all zero degree vertices and unused edges removed
void cannonize();
//checks invariants
void assert_invariants() const;
double tol;
};
//TODO: convert to classes
//TopoGraph sweep_graph(PathVector const &ps, Dim2 d = X, double tol = 0.00001);
void trim_whiskers(TopoGraph &g);
void double_whiskers(TopoGraph &g);
//void remove_degenerate(TopoGraph &g);
//void remove_vestigial(TopoGraph &g);
//Areas traverse_areas(TopoGraph const &g);
const PathVector &ps;
double tol;
typedef Section first_argument_type;
typedef Section second_argument_type;
typedef bool result_type;
};
//sorter used to create the initial sweep of sections, such that they are dealt with in order
struct SweepSorter {
typedef Section first_argument_type;
typedef Section second_argument_type;
typedef bool result_type;
}
};
struct UnionOp {
unsigned ix;
}
};
//returns all areas for which the winding -> bool function yields true
//find a representative section
unsigned rj = 0;
//bool rev = are_near(areas[i][0]->fp, areas[i][1]->tp);
rj = 0;
}
}
return ret;
}
} // end namespace Geom
#endif // LIB2GEOM_SEEN_TOPOSWEEP_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :