parent
836dd98113
commit
d903af5373
7 changed files with 12 additions and 18 deletions
|
@ -105,10 +105,10 @@ public:
|
||||||
// Height of the extrusion, used for visualization purposed.
|
// Height of the extrusion, used for visualization purposed.
|
||||||
float height;
|
float height;
|
||||||
|
|
||||||
ExtrusionPath(ExtrusionRole role) : m_role(role), mm3_per_mm(-1), width(-1), height(-1) {};
|
ExtrusionPath(ExtrusionRole role) : mm3_per_mm(-1), width(-1), height(-1), m_role(role) {};
|
||||||
ExtrusionPath(ExtrusionRole role, double mm3_per_mm, float width, float height) : m_role(role), mm3_per_mm(mm3_per_mm), width(width), height(height) {};
|
ExtrusionPath(ExtrusionRole role, double mm3_per_mm, float width, float height) : mm3_per_mm(mm3_per_mm), width(width), height(height), m_role(role) {};
|
||||||
ExtrusionPath(const ExtrusionPath &rhs) : m_role(rhs.m_role), mm3_per_mm(rhs.mm3_per_mm), width(rhs.width), height(rhs.height), polyline(rhs.polyline) {}
|
ExtrusionPath(const ExtrusionPath &rhs) : polyline(rhs.polyline), mm3_per_mm(rhs.mm3_per_mm), width(rhs.width), height(rhs.height), m_role(rhs.m_role) {}
|
||||||
ExtrusionPath(ExtrusionPath &&rhs) : m_role(rhs.m_role), mm3_per_mm(rhs.mm3_per_mm), width(rhs.width), height(rhs.height), polyline(std::move(rhs.polyline)) {}
|
ExtrusionPath(ExtrusionPath &&rhs) : polyline(std::move(rhs.polyline)), mm3_per_mm(rhs.mm3_per_mm), width(rhs.width), height(rhs.height), m_role(rhs.m_role) {}
|
||||||
// ExtrusionPath(ExtrusionRole role, const Flow &flow) : m_role(role), mm3_per_mm(flow.mm3_per_mm()), width(flow.width), height(flow.height) {};
|
// ExtrusionPath(ExtrusionRole role, const Flow &flow) : m_role(role), mm3_per_mm(flow.mm3_per_mm()), width(flow.width), height(flow.height) {};
|
||||||
|
|
||||||
ExtrusionPath& operator=(const ExtrusionPath &rhs) { this->m_role = rhs.m_role; this->mm3_per_mm = rhs.mm3_per_mm; this->width = rhs.width; this->height = rhs.height; this->polyline = rhs.polyline; return *this; }
|
ExtrusionPath& operator=(const ExtrusionPath &rhs) { this->m_role = rhs.m_role; this->mm3_per_mm = rhs.mm3_per_mm; this->width = rhs.width; this->height = rhs.height; this->polyline = rhs.polyline; return *this; }
|
||||||
|
|
|
@ -48,8 +48,8 @@ static inline bool is_ccw(const Polygon &poly)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// 1) Find the lowest lexicographical point.
|
// 1) Find the lowest lexicographical point.
|
||||||
int imin = 0;
|
unsigned int imin = 0;
|
||||||
for (int i = 1; i < poly.points.size(); ++ i) {
|
for (unsigned int i = 1; i < poly.points.size(); ++ i) {
|
||||||
const Point &pmin = poly.points[imin];
|
const Point &pmin = poly.points[imin];
|
||||||
const Point &p = poly.points[i];
|
const Point &p = poly.points[i];
|
||||||
if (p.x < pmin.x || (p.x == pmin.x && p.y < pmin.y))
|
if (p.x < pmin.x || (p.x == pmin.x && p.y < pmin.y))
|
||||||
|
@ -134,7 +134,7 @@ class MedialAxis {
|
||||||
double max_width;
|
double max_width;
|
||||||
double min_width;
|
double min_width;
|
||||||
MedialAxis(double _max_width, double _min_width, const ExPolygon* _expolygon = NULL)
|
MedialAxis(double _max_width, double _min_width, const ExPolygon* _expolygon = NULL)
|
||||||
: max_width(_max_width), min_width(_min_width), expolygon(_expolygon) {};
|
: expolygon(_expolygon), max_width(_max_width), min_width(_min_width) {};
|
||||||
void build(ThickPolylines* polylines);
|
void build(ThickPolylines* polylines);
|
||||||
void build(Polylines* polylines);
|
void build(Polylines* polylines);
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class ThickLine : public Line
|
||||||
coordf_t a_width, b_width;
|
coordf_t a_width, b_width;
|
||||||
|
|
||||||
ThickLine() : a_width(0), b_width(0) {};
|
ThickLine() : a_width(0), b_width(0) {};
|
||||||
ThickLine(Point _a, Point _b) : a_width(0), b_width(0), Line(_a, _b) {};
|
ThickLine(Point _a, Point _b) : Line(_a, _b), a_width(0), b_width(0) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Linef
|
class Linef
|
||||||
|
|
|
@ -130,7 +130,7 @@ public:
|
||||||
void print_info() const;
|
void print_info() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ModelObject(Model *model) : m_model(model), m_bounding_box_valid(false), layer_height_profile_valid(false) {}
|
ModelObject(Model *model) : layer_height_profile_valid(false), m_model(model), m_bounding_box_valid(false) {}
|
||||||
ModelObject(Model *model, const ModelObject &other, bool copy_volumes = true);
|
ModelObject(Model *model, const ModelObject &other, bool copy_volumes = true);
|
||||||
ModelObject& operator= (ModelObject other);
|
ModelObject& operator= (ModelObject other);
|
||||||
void swap(ModelObject &other);
|
void swap(ModelObject &other);
|
||||||
|
|
|
@ -146,7 +146,7 @@ public:
|
||||||
BoundingBox bounding_box() const { return BoundingBox(Point(0,0), this->size); }
|
BoundingBox bounding_box() const { return BoundingBox(Point(0,0), this->size); }
|
||||||
|
|
||||||
// adds region_id, too, if necessary
|
// adds region_id, too, if necessary
|
||||||
void add_region_volume(int region_id, int volume_id) {
|
void add_region_volume(unsigned int region_id, int volume_id) {
|
||||||
if (region_id >= region_volumes.size())
|
if (region_id >= region_volumes.size())
|
||||||
region_volumes.resize(region_id + 1);
|
region_volumes.resize(region_id + 1);
|
||||||
region_volumes[region_id].push_back(volume_id);
|
region_volumes[region_id].push_back(volume_id);
|
||||||
|
|
|
@ -414,14 +414,12 @@ static void thick_lines_to_indexed_vertex_array(
|
||||||
Line prev_line;
|
Line prev_line;
|
||||||
// right, left, top, bottom
|
// right, left, top, bottom
|
||||||
int idx_prev[4] = { -1, -1, -1, -1 };
|
int idx_prev[4] = { -1, -1, -1, -1 };
|
||||||
double width_prev = 0.;
|
|
||||||
double bottom_z_prev = 0.;
|
double bottom_z_prev = 0.;
|
||||||
Pointf b1_prev;
|
Pointf b1_prev;
|
||||||
Pointf b2_prev;
|
Pointf b2_prev;
|
||||||
Vectorf v_prev;
|
Vectorf v_prev;
|
||||||
int idx_initial[4] = { -1, -1, -1, -1 };
|
int idx_initial[4] = { -1, -1, -1, -1 };
|
||||||
double width_initial = 0.;
|
double width_initial = 0.;
|
||||||
double bottom_z_initial = 0.;
|
|
||||||
|
|
||||||
// loop once more in case of closed loops
|
// loop once more in case of closed loops
|
||||||
size_t lines_end = closed ? (lines.size() + 1) : lines.size();
|
size_t lines_end = closed ? (lines.size() + 1) : lines.size();
|
||||||
|
@ -459,9 +457,7 @@ static void thick_lines_to_indexed_vertex_array(
|
||||||
int idx_b[4];
|
int idx_b[4];
|
||||||
int idx_last = int(volume.vertices_and_normals_interleaved.size() / 6);
|
int idx_last = int(volume.vertices_and_normals_interleaved.size() / 6);
|
||||||
|
|
||||||
bool width_different = width_prev != width;
|
|
||||||
bool bottom_z_different = bottom_z_prev != bottom_z;
|
bool bottom_z_different = bottom_z_prev != bottom_z;
|
||||||
width_prev = width;
|
|
||||||
bottom_z_prev = bottom_z;
|
bottom_z_prev = bottom_z;
|
||||||
|
|
||||||
// Share top / bottom vertices if possible.
|
// Share top / bottom vertices if possible.
|
||||||
|
@ -486,7 +482,6 @@ static void thick_lines_to_indexed_vertex_array(
|
||||||
if (ii == 0) {
|
if (ii == 0) {
|
||||||
// Start of the 1st line segment.
|
// Start of the 1st line segment.
|
||||||
width_initial = width;
|
width_initial = width;
|
||||||
bottom_z_initial = bottom_z;
|
|
||||||
memcpy(idx_initial, idx_a, sizeof(int) * 4);
|
memcpy(idx_initial, idx_a, sizeof(int) * 4);
|
||||||
} else {
|
} else {
|
||||||
// Continuing a previous segment.
|
// Continuing a previous segment.
|
||||||
|
@ -579,7 +574,6 @@ static void thick_lines_to_indexed_vertex_array(
|
||||||
|
|
||||||
prev_line = line;
|
prev_line = line;
|
||||||
memcpy(idx_prev, idx_b, 4 * sizeof(int));
|
memcpy(idx_prev, idx_b, 4 * sizeof(int));
|
||||||
width_prev = width;
|
|
||||||
bottom_z_prev = bottom_z;
|
bottom_z_prev = bottom_z;
|
||||||
b1_prev = b1;
|
b1_prev = b1;
|
||||||
b2_prev = b2;
|
b2_prev = b2;
|
||||||
|
|
|
@ -207,8 +207,8 @@ public:
|
||||||
drag_group_id(-1),
|
drag_group_id(-1),
|
||||||
selected(false),
|
selected(false),
|
||||||
hover(false),
|
hover(false),
|
||||||
qverts_range(0, size_t(-1)),
|
tverts_range(0, size_t(-1)),
|
||||||
tverts_range(0, size_t(-1))
|
qverts_range(0, size_t(-1))
|
||||||
{
|
{
|
||||||
color[0] = r;
|
color[0] = r;
|
||||||
color[1] = g;
|
color[1] = g;
|
||||||
|
|
Loading…
Reference in a new issue