intersect_clipper.h
Go to the documentation of this file.
64 template <typename SourceMeshType, typename TargetMeshType=SourceMeshType> class IntersectClipper
75 IntersectClipper(const SourceMeshType &s, const TargetMeshType &t):sourceMeshWrapper(s), targetMeshWrapper(t){}
102 //http://www.angusj.com/delphi/clipper/documentation/Docs/Units/ClipperLib/Types/PolyFillType.htm
135 //We must use the same max size for all the polygons, so the number we are looking for is the maximum value in the set--all the X and Y values will be converted using this value
157 // We want to move the decimal point of the floating point number so that the last digit given is before the decimal point.
158 // The alogrithm is to find the exponent (in the floating point representation) of the largest number in the polygons (either X or Y coordinate).
159 //Multiply by the power of two which is number of digits in mantissa (in this case, 53) - exponent
179 //Convert an entire polygon (specifiied as a std::vector<Wonton::Point>) to a std::vector<IntPoint>
180 static std::vector<ClipperLib::IntPoint> convertPoly2int(std::vector<Wonton::Point<2>> poly, double max_size_poly){
182 std::transform(poly.begin(), poly.end(), intpoly.begin(), [max_size_poly](Wonton::Point<2> point){
183 return ClipperLib::IntPoint(real2integer(point[0], max_size_poly), real2integer(point[1], max_size_poly));});
OutputIterator transform(InputIterator first, InputIterator last, OutputIterator result, UnaryFunction op)
Definition: portage.h:250
std::pair< double, Wonton::Point< 2 > > Moment
Alias to provide volume and centroid.
Definition: intersect_clipper.h:72
std::vector< std::vector< double > > operator()(const int cellA, const int cellB) const
Intersect two cells and return the first two moments.
Definition: intersect_clipper.h:83
2-D intersection algorithm for arbitrary convex and non-convex polyhedra
Definition: intersect_clipper.h:64
IntersectClipper(const SourceMeshType &s, const TargetMeshType &t)
Constructor taking a source mesh s and a target mesh t.
Definition: intersect_clipper.h:75
IntersectClipper & operator=(const IntersectClipper &)=delete
Assignment operator (disabled)
Definition: coredriver.h:42
std::vector< double > areaAndMomentPolygon(std::vector< Wonton::Point< 2 >> const &poly)
Return the area and moment of the polygon.
Definition: intersect_clipper.h:28
std::vector< Wonton::Point< 2 > > Poly
Alias for a collection of Points.
Definition: intersect_clipper.h:70