New coverage detection for bridges. Includes implementation of ExPolygon::get_trapezoids()

This commit is contained in:
Alessandro Ranellucci
2014-04-24 13:43:24 +02:00
parent d458a7c4d2
commit 6201aacf88
21 changed files with 358 additions and 27 deletions

View File

@@ -4,7 +4,6 @@
#include <myinit.h>
#include <vector>
#include <math.h>
#include <boost/polygon/polygon.hpp>
#include <string>
namespace Slic3r {
@@ -27,7 +26,7 @@ class Point
std::string wkt() const;
void scale(double factor);
void translate(double x, double y);
void rotate(double angle, Point* center);
void rotate(double angle, const Point &center);
bool coincides_with(const Point &point) const;
bool coincides_with(const Point* point) const;
int nearest_point_index(Points &points) const;
@@ -83,7 +82,21 @@ class Pointf3 : public Pointf
}
// start Boost
#include <boost/polygon/polygon.hpp>
namespace boost { namespace polygon {
template <>
struct geometry_concept<coord_t> { typedef coordinate_concept type; };
template <>
struct coordinate_traits<coord_t> {
typedef coord_t coordinate_type;
typedef long double area_type;
typedef long long manhattan_area_type;
typedef unsigned long long unsigned_area_type;
typedef long long coordinate_difference;
typedef long double coordinate_distance;
};
template <>
struct geometry_concept<Point> { typedef point_concept type; };
@@ -95,6 +108,23 @@ namespace boost { namespace polygon {
return (orient == HORIZONTAL) ? point.x : point.y;
}
};
template <>
struct point_mutable_traits<Point> {
typedef coord_t coordinate_type;
static inline void set(Point& point, orientation_2d orient, coord_t value) {
if (orient == HORIZONTAL)
point.x = value;
else
point.y = value;
}
static inline Point construct(coord_t x_value, coord_t y_value) {
Point retval;
retval.x = x_value;
retval.y = y_value;
return retval;
}
};
} }
// end Boost