Cleanup of some method signatures and of XS return types
This commit is contained in:
parent
c9cdae1a96
commit
8791f5a493
@ -29,7 +29,7 @@ use Slic3r::GUI::Tab;
|
||||
|
||||
our $have_OpenGL = eval "use Slic3r::GUI::3DScene; 1";
|
||||
our $have_LWP = eval "use LWP::UserAgent; 1";
|
||||
|
||||
$have_OpenGL = 0;
|
||||
use Wx 0.9901 qw(:bitmap :dialog :icon :id :misc :systemsettings :toplevelwindow
|
||||
:filedialog);
|
||||
use Wx::Event qw(EVT_IDLE);
|
||||
|
@ -874,8 +874,8 @@ sub schedule_background_process {
|
||||
|
||||
if (defined $self->{apply_config_timer}) {
|
||||
$self->{apply_config_timer}->Start(PROCESS_DELAY, 1); # 1 = one shot
|
||||
$self->{toolpaths2D}->reload_print;
|
||||
$self->{preview3D}->reload_print;
|
||||
$self->{toolpaths2D}->reload_print if $self->{toolpaths2D};
|
||||
$self->{preview3D}->reload_print if $self->{preview3D};
|
||||
}
|
||||
}
|
||||
|
||||
@ -954,8 +954,8 @@ sub stop_background_process {
|
||||
$self->statusbar->SetCancelCallback(undef);
|
||||
$self->statusbar->StopBusy;
|
||||
$self->statusbar->SetStatusText("");
|
||||
$self->{toolpaths2D}->reload_print;
|
||||
$self->{preview3D}->reload_print;
|
||||
$self->{toolpaths2D}->reload_print if $self->{toolpaths2D};
|
||||
$self->{preview3D}->reload_print if $self->{preview3D};
|
||||
|
||||
if ($self->{process_thread}) {
|
||||
Slic3r::debugf "Killing background process.\n";
|
||||
@ -1079,8 +1079,8 @@ sub on_process_completed {
|
||||
$self->{process_thread} = undef;
|
||||
|
||||
return if $error;
|
||||
$self->{toolpaths2D}->reload_print;
|
||||
$self->{preview3D}->reload_print;
|
||||
$self->{toolpaths2D}->reload_print if $self->{toolpaths2D};
|
||||
$self->{preview3D}->reload_print if $self->{preview3D};
|
||||
|
||||
# if we have an export filename, start a new thread for exporting G-code
|
||||
if ($self->{export_gcode_output_file}) {
|
||||
|
@ -89,8 +89,7 @@ BridgeDetector::detect_angle()
|
||||
{
|
||||
Polygons pp = this->expolygon;
|
||||
for (Polygons::const_iterator p = pp.begin(); p != pp.end(); ++p) {
|
||||
Lines lines;
|
||||
p->lines(&lines);
|
||||
Lines lines = p->lines();
|
||||
for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line)
|
||||
angles.push_back(line->direction());
|
||||
}
|
||||
|
@ -167,9 +167,11 @@ ExPolygon::medial_axis(double max_width, double min_width, Polylines* polylines)
|
||||
Slic3r::Geometry::MedialAxis ma(max_width, min_width);
|
||||
|
||||
// populate list of segments for the Voronoi diagram
|
||||
this->contour.lines(&ma.lines);
|
||||
for (Polygons::const_iterator hole = this->holes.begin(); hole != this->holes.end(); ++hole)
|
||||
hole->lines(&ma.lines);
|
||||
ma.lines = this->contour.lines();
|
||||
for (Polygons::const_iterator hole = this->holes.begin(); hole != this->holes.end(); ++hole) {
|
||||
Lines lines = hole->lines();
|
||||
ma.lines.insert(ma.lines.end(), lines.begin(), lines.end());
|
||||
}
|
||||
|
||||
// compute the Voronoi diagram
|
||||
ma.build(polylines);
|
||||
@ -384,10 +386,11 @@ ExPolygon::triangulate_p2t(Polygons* polygons) const
|
||||
Lines
|
||||
ExPolygon::lines() const
|
||||
{
|
||||
Lines lines;
|
||||
this->contour.lines(&lines);
|
||||
for (Polygons::const_iterator h = this->holes.begin(); h != this->holes.end(); ++h)
|
||||
h->lines(&lines);
|
||||
Lines lines = this->contour.lines();
|
||||
for (Polygons::const_iterator h = this->holes.begin(); h != this->holes.end(); ++h) {
|
||||
Lines hole_lines = h->lines();
|
||||
lines.insert(lines.end(), hole_lines.begin(), hole_lines.end());
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
|
@ -92,13 +92,13 @@ ExPolygonCollection::simplify(double tolerance)
|
||||
this->expolygons = expp;
|
||||
}
|
||||
|
||||
void
|
||||
ExPolygonCollection::convex_hull(Polygon* hull) const
|
||||
Polygon
|
||||
ExPolygonCollection::convex_hull() const
|
||||
{
|
||||
Points pp;
|
||||
for (ExPolygons::const_iterator it = this->expolygons.begin(); it != this->expolygons.end(); ++it)
|
||||
pp.insert(pp.end(), it->contour.points.begin(), it->contour.points.end());
|
||||
Slic3r::Geometry::convex_hull(pp, hull);
|
||||
return Slic3r::Geometry::convex_hull(pp);
|
||||
}
|
||||
|
||||
Lines
|
||||
|
@ -28,7 +28,7 @@ class ExPolygonCollection
|
||||
template <class T> bool contains(const T &item) const;
|
||||
bool contains_b(const Point &point) const;
|
||||
void simplify(double tolerance);
|
||||
void convex_hull(Polygon* hull) const;
|
||||
Polygon convex_hull() const;
|
||||
Lines lines() const;
|
||||
};
|
||||
|
||||
|
@ -25,42 +25,45 @@ sort_points (Point a, Point b)
|
||||
}
|
||||
|
||||
/* This implementation is based on Andrew's monotone chain 2D convex hull algorithm */
|
||||
void
|
||||
convex_hull(Points points, Polygon* hull)
|
||||
Polygon
|
||||
convex_hull(Points points)
|
||||
{
|
||||
assert(points.size() >= 3);
|
||||
// sort input points
|
||||
std::sort(points.begin(), points.end(), sort_points);
|
||||
|
||||
int n = points.size(), k = 0;
|
||||
hull->points.resize(2*n);
|
||||
Polygon hull;
|
||||
hull.points.resize(2*n);
|
||||
|
||||
// Build lower hull
|
||||
for (int i = 0; i < n; i++) {
|
||||
while (k >= 2 && points[i].ccw(hull->points[k-2], hull->points[k-1]) <= 0) k--;
|
||||
hull->points[k++] = points[i];
|
||||
while (k >= 2 && points[i].ccw(hull.points[k-2], hull.points[k-1]) <= 0) k--;
|
||||
hull.points[k++] = points[i];
|
||||
}
|
||||
|
||||
// Build upper hull
|
||||
for (int i = n-2, t = k+1; i >= 0; i--) {
|
||||
while (k >= t && points[i].ccw(hull->points[k-2], hull->points[k-1]) <= 0) k--;
|
||||
hull->points[k++] = points[i];
|
||||
while (k >= t && points[i].ccw(hull.points[k-2], hull.points[k-1]) <= 0) k--;
|
||||
hull.points[k++] = points[i];
|
||||
}
|
||||
|
||||
hull->points.resize(k);
|
||||
hull.points.resize(k);
|
||||
|
||||
assert( hull->points.front().coincides_with(hull->points.back()) );
|
||||
hull->points.pop_back();
|
||||
assert( hull.points.front().coincides_with(hull.points.back()) );
|
||||
hull.points.pop_back();
|
||||
|
||||
return hull;
|
||||
}
|
||||
|
||||
void
|
||||
convex_hull(const Polygons &polygons, Polygon* hull)
|
||||
Polygon
|
||||
convex_hull(const Polygons &polygons)
|
||||
{
|
||||
Points pp;
|
||||
for (Polygons::const_iterator p = polygons.begin(); p != polygons.end(); ++p) {
|
||||
pp.insert(pp.end(), p->points.begin(), p->points.end());
|
||||
}
|
||||
convex_hull(pp, hull);
|
||||
return convex_hull(pp);
|
||||
}
|
||||
|
||||
/* accepts an arrayref of points and returns a list of indices
|
||||
|
@ -11,8 +11,8 @@ using boost::polygon::voronoi_diagram;
|
||||
|
||||
namespace Slic3r { namespace Geometry {
|
||||
|
||||
void convex_hull(Points points, Polygon* hull);
|
||||
void convex_hull(const Polygons &polygons, Polygon* hull);
|
||||
Polygon convex_hull(Points points);
|
||||
Polygon convex_hull(const Polygons &polygons);
|
||||
void chained_path(const Points &points, std::vector<Points::size_type> &retval, Point start_near);
|
||||
void chained_path(const Points &points, std::vector<Points::size_type> &retval);
|
||||
template<class T> void chained_path_items(Points &points, T &items, T &retval);
|
||||
|
@ -64,10 +64,10 @@ Line::length() const
|
||||
return this->a.distance_to(this->b);
|
||||
}
|
||||
|
||||
Point*
|
||||
Point
|
||||
Line::midpoint() const
|
||||
{
|
||||
return new Point ((this->a.x + this->b.x) / 2.0, (this->a.y + this->b.y) / 2.0);
|
||||
return Point((this->a.x + this->b.x) / 2.0, (this->a.y + this->b.y) / 2.0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -26,7 +26,7 @@ class Line
|
||||
void rotate(double angle, const Point ¢er);
|
||||
void reverse();
|
||||
double length() const;
|
||||
Point* midpoint() const;
|
||||
Point midpoint() const;
|
||||
void point_at(double distance, Point* point) const;
|
||||
Point point_at(double distance) const;
|
||||
bool intersection_infinite(const Line &other, Point* point) const;
|
||||
|
@ -130,8 +130,7 @@ Model::duplicate_objects_grid(unsigned int x, unsigned int y, coordf_t distance)
|
||||
ModelObject* object = this->objects.front();
|
||||
object->clear_instances();
|
||||
|
||||
BoundingBoxf3 bb;
|
||||
object->bounding_box(&bb);
|
||||
BoundingBoxf3 bb = object->bounding_box();
|
||||
Sizef3 size = bb.size();
|
||||
|
||||
for (unsigned int x_copy = 1; x_copy <= x; ++x_copy) {
|
||||
@ -174,21 +173,20 @@ Model::add_default_instances()
|
||||
}
|
||||
|
||||
// this returns the bounding box of the *transformed* instances
|
||||
void
|
||||
Model::bounding_box(BoundingBoxf3* bb)
|
||||
BoundingBoxf3
|
||||
Model::bounding_box() const
|
||||
{
|
||||
BoundingBoxf3 bb;
|
||||
for (ModelObjectPtrs::const_iterator o = this->objects.begin(); o != this->objects.end(); ++o) {
|
||||
BoundingBoxf3 obb;
|
||||
(*o)->bounding_box(&obb);
|
||||
bb->merge(obb);
|
||||
bb.merge((*o)->bounding_box());
|
||||
}
|
||||
return bb;
|
||||
}
|
||||
|
||||
void
|
||||
Model::center_instances_around_point(const Pointf &point)
|
||||
{
|
||||
BoundingBoxf3 bb;
|
||||
this->bounding_box(&bb);
|
||||
BoundingBoxf3 bb = this->bounding_box();
|
||||
|
||||
Sizef3 size = bb.size();
|
||||
double shift_x = -bb.min.x + point.x - size.x/2;
|
||||
@ -205,8 +203,7 @@ Model::center_instances_around_point(const Pointf &point)
|
||||
void
|
||||
Model::align_instances_to_origin()
|
||||
{
|
||||
BoundingBoxf3 bb;
|
||||
this->bounding_box(&bb);
|
||||
BoundingBoxf3 bb = this->bounding_box();
|
||||
|
||||
Pointf new_center = (Pointf)bb.size();
|
||||
new_center.translate(-new_center.x/2, -new_center.y/2);
|
||||
@ -222,25 +219,25 @@ Model::translate(coordf_t x, coordf_t y, coordf_t z)
|
||||
}
|
||||
|
||||
// flattens everything to a single mesh
|
||||
void
|
||||
Model::mesh(TriangleMesh* mesh) const
|
||||
TriangleMesh
|
||||
Model::mesh() const
|
||||
{
|
||||
TriangleMesh mesh;
|
||||
for (ModelObjectPtrs::const_iterator o = this->objects.begin(); o != this->objects.end(); ++o) {
|
||||
TriangleMesh omesh;
|
||||
(*o)->mesh(&omesh);
|
||||
mesh->merge(omesh);
|
||||
mesh.merge((*o)->mesh());
|
||||
}
|
||||
return mesh;
|
||||
}
|
||||
|
||||
// flattens everything to a single mesh
|
||||
void
|
||||
Model::raw_mesh(TriangleMesh* mesh) const
|
||||
TriangleMesh
|
||||
Model::raw_mesh() const
|
||||
{
|
||||
TriangleMesh mesh;
|
||||
for (ModelObjectPtrs::const_iterator o = this->objects.begin(); o != this->objects.end(); ++o) {
|
||||
TriangleMesh omesh;
|
||||
(*o)->raw_mesh(&omesh);
|
||||
mesh->merge(omesh);
|
||||
mesh.merge((*o)->raw_mesh());
|
||||
}
|
||||
return mesh;
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
@ -393,11 +390,11 @@ ModelObject::clear_instances()
|
||||
}
|
||||
|
||||
// this returns the bounding box of the *transformed* instances
|
||||
void
|
||||
ModelObject::bounding_box(BoundingBoxf3* bb)
|
||||
BoundingBoxf3
|
||||
ModelObject::bounding_box()
|
||||
{
|
||||
if (!this->_bounding_box_valid) this->update_bounding_box();
|
||||
*bb = this->_bounding_box;
|
||||
return this->_bounding_box;
|
||||
}
|
||||
|
||||
void
|
||||
@ -409,40 +406,40 @@ ModelObject::invalidate_bounding_box()
|
||||
void
|
||||
ModelObject::update_bounding_box()
|
||||
{
|
||||
TriangleMesh mesh;
|
||||
this->mesh(&mesh);
|
||||
|
||||
mesh.bounding_box(&this->_bounding_box);
|
||||
this->_bounding_box = this->mesh().bounding_box();
|
||||
this->_bounding_box_valid = true;
|
||||
}
|
||||
|
||||
// flattens all volumes and instances into a single mesh
|
||||
void
|
||||
ModelObject::mesh(TriangleMesh* mesh) const
|
||||
TriangleMesh
|
||||
ModelObject::mesh() const
|
||||
{
|
||||
TriangleMesh raw_mesh;
|
||||
this->raw_mesh(&raw_mesh);
|
||||
|
||||
TriangleMesh mesh;
|
||||
TriangleMesh raw_mesh = this->raw_mesh();
|
||||
|
||||
for (ModelInstancePtrs::const_iterator i = this->instances.begin(); i != this->instances.end(); ++i) {
|
||||
TriangleMesh m = raw_mesh;
|
||||
(*i)->transform_mesh(&m);
|
||||
mesh->merge(m);
|
||||
mesh.merge(m);
|
||||
}
|
||||
return mesh;
|
||||
}
|
||||
|
||||
void
|
||||
ModelObject::raw_mesh(TriangleMesh* mesh) const
|
||||
TriangleMesh
|
||||
ModelObject::raw_mesh() const
|
||||
{
|
||||
TriangleMesh mesh;
|
||||
for (ModelVolumePtrs::const_iterator v = this->volumes.begin(); v != this->volumes.end(); ++v) {
|
||||
if ((*v)->modifier) continue;
|
||||
mesh->merge((*v)->mesh);
|
||||
mesh.merge((*v)->mesh);
|
||||
}
|
||||
return mesh;
|
||||
}
|
||||
|
||||
void
|
||||
ModelObject::raw_bounding_box(BoundingBoxf3* bb) const
|
||||
BoundingBoxf3
|
||||
ModelObject::raw_bounding_box() const
|
||||
{
|
||||
BoundingBoxf3 bb;
|
||||
for (ModelVolumePtrs::const_iterator v = this->volumes.begin(); v != this->volumes.end(); ++v) {
|
||||
if ((*v)->modifier) continue;
|
||||
TriangleMesh mesh = (*v)->mesh;
|
||||
@ -450,22 +447,18 @@ ModelObject::raw_bounding_box(BoundingBoxf3* bb) const
|
||||
if (this->instances.empty()) CONFESS("Can't call raw_bounding_box() with no instances");
|
||||
this->instances.front()->transform_mesh(&mesh, true);
|
||||
|
||||
BoundingBoxf3 mbb;
|
||||
mesh.bounding_box(&mbb);
|
||||
bb->merge(mbb);
|
||||
bb.merge(mesh.bounding_box());
|
||||
}
|
||||
return bb;
|
||||
}
|
||||
|
||||
// this returns the bounding box of the *transformed* given instance
|
||||
void
|
||||
ModelObject::instance_bounding_box(size_t instance_idx, BoundingBoxf3* bb) const
|
||||
BoundingBoxf3
|
||||
ModelObject::instance_bounding_box(size_t instance_idx) const
|
||||
{
|
||||
TriangleMesh mesh;
|
||||
this->raw_mesh(&mesh);
|
||||
|
||||
TriangleMesh mesh = this->raw_mesh();
|
||||
this->instances[instance_idx]->transform_mesh(&mesh);
|
||||
|
||||
mesh.bounding_box(bb);
|
||||
return mesh.bounding_box();
|
||||
}
|
||||
|
||||
void
|
||||
@ -473,12 +466,7 @@ ModelObject::center_around_origin()
|
||||
{
|
||||
// calculate the displacements needed to
|
||||
// center this object around the origin
|
||||
BoundingBoxf3 bb;
|
||||
{
|
||||
TriangleMesh mesh;
|
||||
this->raw_mesh(&mesh);
|
||||
mesh.bounding_box(&bb);
|
||||
}
|
||||
BoundingBoxf3 bb = this->raw_mesh().bounding_box();
|
||||
|
||||
// first align to origin on XYZ
|
||||
Vectorf3 vector(-bb.min.x, -bb.min.y, -bb.min.z);
|
||||
|
@ -54,12 +54,12 @@ class Model
|
||||
// void duplicate(size_t copies_num, coordf_t distance, const BoundingBox &bb);
|
||||
bool has_objects_with_no_instances() const;
|
||||
bool add_default_instances();
|
||||
void bounding_box(BoundingBoxf3* bb);
|
||||
BoundingBoxf3 bounding_box() const;
|
||||
void center_instances_around_point(const Pointf &point);
|
||||
void align_instances_to_origin();
|
||||
void translate(coordf_t x, coordf_t y, coordf_t z);
|
||||
void mesh(TriangleMesh* mesh) const;
|
||||
void raw_mesh(TriangleMesh* mesh) const;
|
||||
TriangleMesh mesh() const;
|
||||
TriangleMesh raw_mesh() const;
|
||||
// std::string get_material_name(t_model_material_id material_id);
|
||||
|
||||
|
||||
@ -118,13 +118,13 @@ class ModelObject
|
||||
void delete_last_instance();
|
||||
void clear_instances();
|
||||
|
||||
void bounding_box(BoundingBoxf3* bb);
|
||||
BoundingBoxf3 bounding_box();
|
||||
void invalidate_bounding_box();
|
||||
|
||||
void mesh(TriangleMesh* mesh) const;
|
||||
void raw_mesh(TriangleMesh* mesh) const;
|
||||
void raw_bounding_box(BoundingBoxf3* bb) const;
|
||||
void instance_bounding_box(size_t instance_idx, BoundingBoxf3* bb) const;
|
||||
TriangleMesh mesh() const;
|
||||
TriangleMesh raw_mesh() const;
|
||||
BoundingBoxf3 raw_bounding_box() const;
|
||||
BoundingBoxf3 instance_bounding_box(size_t instance_idx) const;
|
||||
void center_around_origin();
|
||||
void translate(const Vectorf3 &vector);
|
||||
void translate(coordf_t x, coordf_t y, coordf_t z);
|
||||
|
@ -82,17 +82,18 @@ MotionPlanner::get_env(size_t island_idx) const
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MotionPlanner::shortest_path(const Point &from, const Point &to, Polyline* polyline)
|
||||
Polyline
|
||||
MotionPlanner::shortest_path(const Point &from, const Point &to)
|
||||
{
|
||||
// lazy generation of configuration space
|
||||
if (!this->initialized) this->initialize();
|
||||
|
||||
// if we have an empty configuration space, return a straight move
|
||||
if (this->islands.empty()) {
|
||||
polyline->points.push_back(from);
|
||||
polyline->points.push_back(to);
|
||||
return;
|
||||
Polyline p;
|
||||
p.points.push_back(from);
|
||||
p.points.push_back(to);
|
||||
return p;
|
||||
}
|
||||
|
||||
// Are both points in the same island?
|
||||
@ -102,9 +103,10 @@ MotionPlanner::shortest_path(const Point &from, const Point &to, Polyline* polyl
|
||||
// since both points are in the same island, is a direct move possible?
|
||||
// if so, we avoid generating the visibility environment
|
||||
if (island->contains(Line(from, to))) {
|
||||
polyline->points.push_back(from);
|
||||
polyline->points.push_back(to);
|
||||
return;
|
||||
Polyline p;
|
||||
p.points.push_back(from);
|
||||
p.points.push_back(to);
|
||||
return p;
|
||||
}
|
||||
island_idx = island - this->islands.begin();
|
||||
break;
|
||||
@ -116,9 +118,10 @@ MotionPlanner::shortest_path(const Point &from, const Point &to, Polyline* polyl
|
||||
if (env.expolygons.empty()) {
|
||||
// if this environment is empty (probably because it's too small), perform straight move
|
||||
// and avoid running the algorithms on empty dataset
|
||||
polyline->points.push_back(from);
|
||||
polyline->points.push_back(to);
|
||||
return; // bye bye
|
||||
Polyline p;
|
||||
p.points.push_back(from);
|
||||
p.points.push_back(to);
|
||||
return p; // bye bye
|
||||
}
|
||||
|
||||
// Now check whether points are inside the environment.
|
||||
@ -137,10 +140,10 @@ MotionPlanner::shortest_path(const Point &from, const Point &to, Polyline* polyl
|
||||
|
||||
// perform actual path search
|
||||
MotionPlannerGraph* graph = this->init_graph(island_idx);
|
||||
graph->shortest_path(graph->find_node(inner_from), graph->find_node(inner_to), polyline);
|
||||
Polyline polyline = graph->shortest_path(graph->find_node(inner_from), graph->find_node(inner_to));
|
||||
|
||||
polyline->points.insert(polyline->points.begin(), from);
|
||||
polyline->points.push_back(to);
|
||||
polyline.points.insert(polyline.points.begin(), from);
|
||||
polyline.points.push_back(to);
|
||||
|
||||
{
|
||||
// grow our environment slightly in order for simplify_by_visibility()
|
||||
@ -149,7 +152,7 @@ MotionPlanner::shortest_path(const Point &from, const Point &to, Polyline* polyl
|
||||
offset(env, &grown_env.expolygons, +SCALED_EPSILON);
|
||||
|
||||
// remove unnecessary vertices
|
||||
polyline->simplify_by_visibility(grown_env);
|
||||
polyline.simplify_by_visibility(grown_env);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -171,6 +174,8 @@ MotionPlanner::shortest_path(const Point &from, const Point &to, Polyline* polyl
|
||||
svg.draw(*polyline, "red");
|
||||
svg.Close();
|
||||
*/
|
||||
|
||||
return polyline;
|
||||
}
|
||||
|
||||
Point
|
||||
@ -310,11 +315,11 @@ MotionPlannerGraph::find_node(const Point &point) const
|
||||
return point.nearest_point_index(this->nodes);
|
||||
}
|
||||
|
||||
void
|
||||
MotionPlannerGraph::shortest_path(size_t from, size_t to, Polyline* polyline)
|
||||
Polyline
|
||||
MotionPlannerGraph::shortest_path(size_t from, size_t to)
|
||||
{
|
||||
// this prevents a crash in case for some reason we got here with an empty adjacency list
|
||||
if (this->adjacency_list.empty()) return;
|
||||
if (this->adjacency_list.empty()) return Polyline();
|
||||
|
||||
const weight_t max_weight = std::numeric_limits<weight_t>::infinity();
|
||||
|
||||
@ -379,10 +384,12 @@ MotionPlannerGraph::shortest_path(size_t from, size_t to, Polyline* polyline)
|
||||
}
|
||||
}
|
||||
|
||||
Polyline polyline;
|
||||
for (node_t vertex = to; vertex != -1; vertex = previous[vertex])
|
||||
polyline->points.push_back(this->nodes[vertex]);
|
||||
polyline->points.push_back(this->nodes[from]);
|
||||
polyline->reverse();
|
||||
polyline.points.push_back(this->nodes[vertex]);
|
||||
polyline.points.push_back(this->nodes[from]);
|
||||
polyline.reverse();
|
||||
return polyline;
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
|
@ -21,7 +21,7 @@ class MotionPlanner
|
||||
public:
|
||||
MotionPlanner(const ExPolygons &islands);
|
||||
~MotionPlanner();
|
||||
void shortest_path(const Point &from, const Point &to, Polyline* polyline);
|
||||
Polyline shortest_path(const Point &from, const Point &to);
|
||||
size_t islands_count() const;
|
||||
|
||||
private:
|
||||
@ -58,7 +58,7 @@ class MotionPlannerGraph
|
||||
//std::map<std::pair<size_t,size_t>, double> edges;
|
||||
void add_edge(size_t from, size_t to, double weight);
|
||||
size_t find_node(const Point &point) const;
|
||||
void shortest_path(size_t from, size_t to, Polyline* polyline);
|
||||
Polyline shortest_path(size_t from, size_t to);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -83,10 +83,10 @@ MultiPoint::has_boundary_point(const Point &point) const
|
||||
return dist < SCALED_EPSILON;
|
||||
}
|
||||
|
||||
void
|
||||
MultiPoint::bounding_box(BoundingBox* bb) const
|
||||
BoundingBox
|
||||
MultiPoint::bounding_box() const
|
||||
{
|
||||
*bb = BoundingBox(this->points);
|
||||
return BoundingBox(this->points);
|
||||
}
|
||||
|
||||
Points
|
||||
|
@ -31,7 +31,7 @@ class MultiPoint
|
||||
bool is_valid() const;
|
||||
int find_point(const Point &point) const;
|
||||
bool has_boundary_point(const Point &point) const;
|
||||
void bounding_box(BoundingBox* bb) const;
|
||||
BoundingBox bounding_box() const;
|
||||
|
||||
static Points _douglas_peucker(const Points &points, const double tolerance);
|
||||
|
||||
|
@ -14,9 +14,7 @@ Polygon::operator Polygons() const
|
||||
|
||||
Polygon::operator Polyline() const
|
||||
{
|
||||
Polyline polyline;
|
||||
this->split_at_first_point(&polyline);
|
||||
return polyline;
|
||||
return this->split_at_first_point();
|
||||
}
|
||||
|
||||
Point&
|
||||
@ -41,55 +39,49 @@ Lines
|
||||
Polygon::lines() const
|
||||
{
|
||||
Lines lines;
|
||||
this->lines(&lines);
|
||||
lines.reserve(this->points.size());
|
||||
for (Points::const_iterator it = this->points.begin(); it != this->points.end()-1; ++it) {
|
||||
lines.push_back(Line(*it, *(it + 1)));
|
||||
}
|
||||
lines.push_back(Line(this->points.back(), this->points.front()));
|
||||
return lines;
|
||||
}
|
||||
|
||||
void
|
||||
Polygon::lines(Lines* lines) const
|
||||
{
|
||||
lines->reserve(lines->size() + this->points.size());
|
||||
for (Points::const_iterator it = this->points.begin(); it != this->points.end()-1; ++it) {
|
||||
lines->push_back(Line(*it, *(it + 1)));
|
||||
}
|
||||
lines->push_back(Line(this->points.back(), this->points.front()));
|
||||
}
|
||||
|
||||
void
|
||||
Polygon::split_at_vertex(const Point &point, Polyline* polyline) const
|
||||
Polyline
|
||||
Polygon::split_at_vertex(const Point &point) const
|
||||
{
|
||||
// find index of point
|
||||
for (Points::const_iterator it = this->points.begin(); it != this->points.end(); ++it) {
|
||||
if (it->coincides_with(point)) {
|
||||
this->split_at_index(it - this->points.begin(), polyline);
|
||||
return;
|
||||
return this->split_at_index(it - this->points.begin());
|
||||
}
|
||||
}
|
||||
CONFESS("Point not found");
|
||||
return Polyline();
|
||||
}
|
||||
|
||||
void
|
||||
Polygon::split_at_index(int index, Polyline* polyline) const
|
||||
{
|
||||
polyline->points.reserve(this->points.size() + 1);
|
||||
for (Points::const_iterator it = this->points.begin() + index; it != this->points.end(); ++it)
|
||||
polyline->points.push_back(*it);
|
||||
for (Points::const_iterator it = this->points.begin(); it != this->points.begin() + index + 1; ++it)
|
||||
polyline->points.push_back(*it);
|
||||
}
|
||||
|
||||
void
|
||||
Polygon::split_at_first_point(Polyline* polyline) const
|
||||
{
|
||||
this->split_at_index(0, polyline);
|
||||
}
|
||||
|
||||
void
|
||||
Polygon::equally_spaced_points(double distance, Points* points) const
|
||||
Polyline
|
||||
Polygon::split_at_index(int index) const
|
||||
{
|
||||
Polyline polyline;
|
||||
this->split_at_first_point(&polyline);
|
||||
polyline.equally_spaced_points(distance, points);
|
||||
polyline.points.reserve(this->points.size() + 1);
|
||||
for (Points::const_iterator it = this->points.begin() + index; it != this->points.end(); ++it)
|
||||
polyline.points.push_back(*it);
|
||||
for (Points::const_iterator it = this->points.begin(); it != this->points.begin() + index + 1; ++it)
|
||||
polyline.points.push_back(*it);
|
||||
return polyline;
|
||||
}
|
||||
|
||||
Polyline
|
||||
Polygon::split_at_first_point() const
|
||||
{
|
||||
return this->split_at_index(0);
|
||||
}
|
||||
|
||||
Points
|
||||
Polygon::equally_spaced_points(double distance) const
|
||||
{
|
||||
return this->split_at_first_point().equally_spaced_points(distance);
|
||||
}
|
||||
|
||||
double
|
||||
@ -203,8 +195,7 @@ Polygon::centroid() const
|
||||
double x_temp = 0;
|
||||
double y_temp = 0;
|
||||
|
||||
Polyline polyline;
|
||||
this->split_at_first_point(&polyline);
|
||||
Polyline polyline = this->split_at_first_point();
|
||||
for (Points::const_iterator point = polyline.points.begin(); point != polyline.points.end() - 1; ++point) {
|
||||
x_temp += (double)( point->x + (point+1)->x ) * ( (double)point->x*(point+1)->y - (double)(point+1)->x*point->y );
|
||||
y_temp += (double)( point->y + (point+1)->y ) * ( (double)point->x*(point+1)->y - (double)(point+1)->x*point->y );
|
||||
@ -227,55 +218,49 @@ Polygon::wkt() const
|
||||
}
|
||||
|
||||
// find all concave vertices (i.e. having an internal angle greater than the supplied angle) */
|
||||
void
|
||||
Polygon::concave_points(double angle, Points* points) const
|
||||
Points
|
||||
Polygon::concave_points(double angle) const
|
||||
{
|
||||
Points points;
|
||||
angle = 2*PI - angle;
|
||||
|
||||
// check whether first point forms a concave angle
|
||||
if (this->points.front().ccw_angle(this->points.back(), *(this->points.begin()+1)) <= angle)
|
||||
points->push_back(this->points.front());
|
||||
points.push_back(this->points.front());
|
||||
|
||||
// check whether points 1..(n-1) form concave angles
|
||||
for (Points::const_iterator p = this->points.begin()+1; p != this->points.end()-1; ++p) {
|
||||
if (p->ccw_angle(*(p-1), *(p+1)) <= angle) points->push_back(*p);
|
||||
if (p->ccw_angle(*(p-1), *(p+1)) <= angle) points.push_back(*p);
|
||||
}
|
||||
|
||||
// check whether last point forms a concave angle
|
||||
if (this->points.back().ccw_angle(*(this->points.end()-2), this->points.front()) <= angle)
|
||||
points->push_back(this->points.back());
|
||||
}
|
||||
|
||||
void
|
||||
Polygon::concave_points(Points* points) const
|
||||
{
|
||||
this->concave_points(PI, points);
|
||||
points.push_back(this->points.back());
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
// find all convex vertices (i.e. having an internal angle smaller than the supplied angle) */
|
||||
void
|
||||
Polygon::convex_points(double angle, Points* points) const
|
||||
Points
|
||||
Polygon::convex_points(double angle) const
|
||||
{
|
||||
Points points;
|
||||
angle = 2*PI - angle;
|
||||
|
||||
// check whether first point forms a convex angle
|
||||
if (this->points.front().ccw_angle(this->points.back(), *(this->points.begin()+1)) >= angle)
|
||||
points->push_back(this->points.front());
|
||||
points.push_back(this->points.front());
|
||||
|
||||
// check whether points 1..(n-1) form convex angles
|
||||
for (Points::const_iterator p = this->points.begin()+1; p != this->points.end()-1; ++p) {
|
||||
if (p->ccw_angle(*(p-1), *(p+1)) >= angle) points->push_back(*p);
|
||||
if (p->ccw_angle(*(p-1), *(p+1)) >= angle) points.push_back(*p);
|
||||
}
|
||||
|
||||
// check whether last point forms a convex angle
|
||||
if (this->points.back().ccw_angle(*(this->points.end()-2), this->points.front()) >= angle)
|
||||
points->push_back(this->points.back());
|
||||
}
|
||||
|
||||
void
|
||||
Polygon::convex_points(Points* points) const
|
||||
{
|
||||
this->convex_points(PI, points);
|
||||
points.push_back(this->points.back());
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
|
@ -24,11 +24,10 @@ class Polygon : public MultiPoint {
|
||||
explicit Polygon(const Points &points): MultiPoint(points) {};
|
||||
Point last_point() const;
|
||||
Lines lines() const;
|
||||
void lines(Lines* lines) const;
|
||||
void split_at_vertex(const Point &point, Polyline* polyline) const;
|
||||
void split_at_index(int index, Polyline* polyline) const;
|
||||
void split_at_first_point(Polyline* polyline) const;
|
||||
void equally_spaced_points(double distance, Points* points) const;
|
||||
Polyline split_at_vertex(const Point &point) const;
|
||||
Polyline split_at_index(int index) const;
|
||||
Polyline split_at_first_point() const;
|
||||
Points equally_spaced_points(double distance) const;
|
||||
double area() const;
|
||||
bool is_counter_clockwise() const;
|
||||
bool is_clockwise() const;
|
||||
@ -41,10 +40,8 @@ class Polygon : public MultiPoint {
|
||||
void triangulate_convex(Polygons* polygons) const;
|
||||
Point centroid() const;
|
||||
std::string wkt() const;
|
||||
void concave_points(double angle, Points* points) const;
|
||||
void concave_points(Points* points) const;
|
||||
void convex_points(double angle, Points* points) const;
|
||||
void convex_points(Points* points) const;
|
||||
Points concave_points(double angle = PI) const;
|
||||
Points convex_points(double angle = PI) const;
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
void from_SV_check(SV* poly_sv);
|
||||
|
@ -98,10 +98,11 @@ Polyline::extend_start(double distance)
|
||||
|
||||
/* this method returns a collection of points picked on the polygon contour
|
||||
so that they are evenly spaced according to the input distance */
|
||||
void
|
||||
Polyline::equally_spaced_points(double distance, Points* points) const
|
||||
Points
|
||||
Polyline::equally_spaced_points(double distance) const
|
||||
{
|
||||
points->push_back(this->first_point());
|
||||
Points points;
|
||||
points.push_back(this->first_point());
|
||||
double len = 0;
|
||||
|
||||
for (Points::const_iterator it = this->points.begin() + 1; it != this->points.end(); ++it) {
|
||||
@ -110,17 +111,18 @@ Polyline::equally_spaced_points(double distance, Points* points) const
|
||||
if (len < distance) continue;
|
||||
|
||||
if (len == distance) {
|
||||
points->push_back(*it);
|
||||
points.push_back(*it);
|
||||
len = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
double take = segment_length - (len - distance); // how much we take of this segment
|
||||
Line segment(*(it-1), *it);
|
||||
points->push_back(segment.point_at(take));
|
||||
points.push_back(segment.point_at(take));
|
||||
it--;
|
||||
len = -take;
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -22,7 +22,7 @@ class Polyline : public MultiPoint {
|
||||
void clip_start(double distance);
|
||||
void extend_end(double distance);
|
||||
void extend_start(double distance);
|
||||
void equally_spaced_points(double distance, Points* points) const;
|
||||
Points equally_spaced_points(double distance) const;
|
||||
void simplify(double tolerance);
|
||||
template <class T> void simplify_by_visibility(const T &area);
|
||||
void split_at(const Point &point, Polyline* p1, Polyline* p2) const;
|
||||
|
@ -358,8 +358,7 @@ Print::add_model_object(ModelObject* model_object, int idx)
|
||||
// initialize print object and store it at the given position
|
||||
PrintObject* o;
|
||||
{
|
||||
BoundingBoxf3 bb;
|
||||
model_object->raw_bounding_box(&bb);
|
||||
BoundingBoxf3 bb = model_object->raw_bounding_box();
|
||||
if (idx != -1) {
|
||||
// replacing existing object
|
||||
PrintObjectPtrs::iterator old_it = this->objects.begin() + idx;
|
||||
@ -569,14 +568,13 @@ Print::validate() const
|
||||
Polygons mesh_convex_hulls;
|
||||
for (size_t i = 0; i < this->regions.size(); ++i) {
|
||||
for (std::vector<int>::const_iterator it = object->region_volumes[i].begin(); it != object->region_volumes[i].end(); ++it) {
|
||||
Polygon hull;
|
||||
object->model_object()->volumes[*it]->mesh.convex_hull(&hull);
|
||||
Polygon hull = object->model_object()->volumes[*it]->mesh.convex_hull();
|
||||
mesh_convex_hulls.push_back(hull);
|
||||
}
|
||||
}
|
||||
|
||||
// make a single convex hull for all of them
|
||||
Slic3r::Geometry::convex_hull(mesh_convex_hulls, &convex_hull);
|
||||
convex_hull = Slic3r::Geometry::convex_hull(mesh_convex_hulls);
|
||||
}
|
||||
|
||||
// apply the same transformations we apply to the actual meshes when slicing them
|
||||
|
@ -111,7 +111,7 @@ class PrintObject
|
||||
bool delete_all_copies();
|
||||
bool set_copies(const Points &points);
|
||||
bool reload_model_instances();
|
||||
void bounding_box(BoundingBox* bb) const;
|
||||
BoundingBox bounding_box() const;
|
||||
|
||||
// adds region_id, too, if necessary
|
||||
void add_region_volume(int region_id, int volume_id);
|
||||
|
@ -110,14 +110,14 @@ PrintObject::reload_model_instances()
|
||||
return this->set_copies(copies);
|
||||
}
|
||||
|
||||
void
|
||||
PrintObject::bounding_box(BoundingBox* bb) const
|
||||
BoundingBox
|
||||
PrintObject::bounding_box() const
|
||||
{
|
||||
// since the object is aligned to origin, bounding box coincides with size
|
||||
Points pp;
|
||||
pp.push_back(Point(0,0));
|
||||
pp.push_back(this->size);
|
||||
*bb = BoundingBox(pp);
|
||||
return BoundingBox(pp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -319,8 +319,8 @@ TriangleMesh::merge(const TriangleMesh &mesh)
|
||||
}
|
||||
|
||||
/* this will return scaled ExPolygons */
|
||||
void
|
||||
TriangleMesh::horizontal_projection(ExPolygons &retval) const
|
||||
ExPolygons
|
||||
TriangleMesh::horizontal_projection() const
|
||||
{
|
||||
Polygons pp;
|
||||
pp.reserve(this->stl.stats.number_of_facets);
|
||||
@ -337,11 +337,13 @@ TriangleMesh::horizontal_projection(ExPolygons &retval) const
|
||||
|
||||
// the offset factor was tuned using groovemount.stl
|
||||
offset(pp, &pp, 0.01 / SCALING_FACTOR);
|
||||
ExPolygons retval;
|
||||
union_(pp, &retval, true);
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
TriangleMesh::convex_hull(Polygon* hull)
|
||||
Polygon
|
||||
TriangleMesh::convex_hull()
|
||||
{
|
||||
this->require_shared_vertices();
|
||||
Points pp;
|
||||
@ -350,25 +352,19 @@ TriangleMesh::convex_hull(Polygon* hull)
|
||||
stl_vertex* v = &this->stl.v_shared[i];
|
||||
pp.push_back(Point(v->x / SCALING_FACTOR, v->y / SCALING_FACTOR));
|
||||
}
|
||||
Slic3r::Geometry::convex_hull(pp, hull);
|
||||
}
|
||||
|
||||
void
|
||||
TriangleMesh::bounding_box(BoundingBoxf3* bb) const
|
||||
{
|
||||
bb->min.x = this->stl.stats.min.x;
|
||||
bb->min.y = this->stl.stats.min.y;
|
||||
bb->min.z = this->stl.stats.min.z;
|
||||
bb->max.x = this->stl.stats.max.x;
|
||||
bb->max.y = this->stl.stats.max.y;
|
||||
bb->max.z = this->stl.stats.max.z;
|
||||
return Slic3r::Geometry::convex_hull(pp);
|
||||
}
|
||||
|
||||
BoundingBoxf3
|
||||
TriangleMesh::bounding_box() const
|
||||
{
|
||||
BoundingBoxf3 bb;
|
||||
this->bounding_box(&bb);
|
||||
bb.min.x = this->stl.stats.min.x;
|
||||
bb.min.y = this->stl.stats.min.y;
|
||||
bb.min.z = this->stl.stats.min.z;
|
||||
bb.max.x = this->stl.stats.max.x;
|
||||
bb.max.y = this->stl.stats.max.y;
|
||||
bb.max.z = this->stl.stats.max.z;
|
||||
return bb;
|
||||
}
|
||||
|
||||
|
@ -42,9 +42,8 @@ class TriangleMesh
|
||||
void rotate(double angle, Point* center);
|
||||
TriangleMeshPtrs split() const;
|
||||
void merge(const TriangleMesh &mesh);
|
||||
void horizontal_projection(ExPolygons &retval) const;
|
||||
void convex_hull(Polygon* hull);
|
||||
void bounding_box(BoundingBoxf3* bb) const;
|
||||
ExPolygons horizontal_projection() const;
|
||||
Polygon convex_hull();
|
||||
BoundingBoxf3 bounding_box() const;
|
||||
void reset_repair_stats();
|
||||
bool needed_repair() const;
|
||||
|
@ -16,8 +16,7 @@
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
void offset(double delta);
|
||||
Polygon* polygon()
|
||||
%code{% RETVAL = new Polygon(); THIS->polygon(RETVAL); %};
|
||||
Clone<Polygon> polygon();
|
||||
Clone<Point> size();
|
||||
Clone<Point> center();
|
||||
Clone<Point> min_point() %code{% RETVAL = THIS->min; %};
|
||||
|
@ -26,6 +26,7 @@
|
||||
void simplify(double tolerance);
|
||||
Polygons polygons()
|
||||
%code{% RETVAL = *THIS; %};
|
||||
Clone<Polygon> convex_hull();
|
||||
%{
|
||||
|
||||
ExPolygonCollection*
|
||||
@ -76,13 +77,5 @@ ExPolygonCollection::append(...)
|
||||
THIS->expolygons.push_back(expolygon);
|
||||
}
|
||||
|
||||
Polygon*
|
||||
ExPolygonCollection::convex_hull()
|
||||
CODE:
|
||||
RETVAL = new Polygon ();
|
||||
THIS->convex_hull(RETVAL);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
||||
|
@ -15,8 +15,8 @@
|
||||
bool make_counter_clockwise();
|
||||
Clone<Point> first_point();
|
||||
Clone<Point> last_point();
|
||||
Polygon* polygon()
|
||||
%code{% RETVAL = new Polygon (*THIS); %};
|
||||
Clone<Polygon> polygon()
|
||||
%code{% RETVAL = Polygon(*THIS); %};
|
||||
void append(ExtrusionPath* path)
|
||||
%code{% THIS->paths.push_back(*path); %};
|
||||
double length();
|
||||
|
@ -29,12 +29,11 @@ directions_parallel_within(angle1, angle2, max_diff)
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Polygon*
|
||||
Clone<Polygon>
|
||||
convex_hull(points)
|
||||
Points points
|
||||
CODE:
|
||||
RETVAL = new Polygon ();
|
||||
Slic3r::Geometry::convex_hull(points, RETVAL);
|
||||
RETVAL = Slic3r::Geometry::convex_hull(points);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
|
@ -26,8 +26,8 @@
|
||||
Ref<ExtrusionEntityCollection> fills()
|
||||
%code%{ RETVAL = &THIS->fills; %};
|
||||
|
||||
Flow* flow(FlowRole role, bool bridge = false, double width = -1)
|
||||
%code%{ RETVAL = new Flow(THIS->flow(role, bridge, width)); %};
|
||||
Clone<Flow> flow(FlowRole role, bool bridge = false, double width = -1)
|
||||
%code%{ RETVAL = THIS->flow(role, bridge, width); %};
|
||||
void merge_slices();
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
bool parallel_to(double angle);
|
||||
bool parallel_to_line(Line* line)
|
||||
%code{% RETVAL = THIS->parallel_to(*line); %};
|
||||
Point* midpoint();
|
||||
Clone<Point> midpoint();
|
||||
Clone<Point> point_at(double distance);
|
||||
Clone<Point> intersection_infinite(Line* other)
|
||||
%code{%
|
||||
@ -37,8 +37,8 @@
|
||||
if (!res) CONFESS("Intersection failed");
|
||||
RETVAL = p;
|
||||
%};
|
||||
Polyline* as_polyline()
|
||||
%code{% RETVAL = new Polyline(*THIS); %};
|
||||
Clone<Polyline> as_polyline()
|
||||
%code{% RETVAL = Polyline(*THIS); %};
|
||||
Clone<Point> normal();
|
||||
Clone<Point> vector();
|
||||
%{
|
||||
|
@ -59,19 +59,13 @@
|
||||
// void duplicate(size_t copies_num, coordf_t distance, const BoundingBox &bb);
|
||||
bool has_objects_with_no_instances();
|
||||
bool add_default_instances();
|
||||
BoundingBoxf3* bounding_box()
|
||||
%code%{
|
||||
RETVAL = new BoundingBoxf3();
|
||||
THIS->bounding_box(RETVAL);
|
||||
%};
|
||||
Clone<BoundingBoxf3> bounding_box();
|
||||
void center_instances_around_point(Pointf* point)
|
||||
%code%{ THIS->center_instances_around_point(*point); %};
|
||||
void align_instances_to_origin();
|
||||
void translate(double x, double y, double z);
|
||||
TriangleMesh* mesh()
|
||||
%code%{ RETVAL = new TriangleMesh(); THIS->mesh(RETVAL); %};
|
||||
TriangleMesh* raw_mesh()
|
||||
%code%{ RETVAL = new TriangleMesh(); THIS->raw_mesh(RETVAL); %};
|
||||
Clone<TriangleMesh> mesh();
|
||||
Clone<TriangleMesh> raw_mesh();
|
||||
// void split_meshes();
|
||||
// std::string get_material_name(t_model_material_id material_id);
|
||||
|
||||
@ -119,20 +113,10 @@ ModelMaterial::attributes()
|
||||
|
||||
void invalidate_bounding_box();
|
||||
void update_bounding_box();
|
||||
TriangleMesh* mesh()
|
||||
%code%{ RETVAL = new TriangleMesh(); THIS->mesh(RETVAL); %};
|
||||
TriangleMesh* raw_mesh()
|
||||
%code%{ RETVAL = new TriangleMesh(); THIS->raw_mesh(RETVAL); %};
|
||||
BoundingBoxf3* raw_bounding_box()
|
||||
%code%{
|
||||
RETVAL = new BoundingBoxf3();
|
||||
THIS->raw_bounding_box(RETVAL);
|
||||
%};
|
||||
BoundingBoxf3* instance_bounding_box(int idx)
|
||||
%code%{
|
||||
RETVAL = new BoundingBoxf3();
|
||||
THIS->instance_bounding_box(idx, RETVAL);
|
||||
%};
|
||||
Clone<TriangleMesh> mesh();
|
||||
Clone<TriangleMesh> raw_mesh();
|
||||
Clone<BoundingBoxf3> raw_bounding_box();
|
||||
Clone<BoundingBoxf3> instance_bounding_box(int idx);
|
||||
|
||||
Ref<BoundingBoxf3> _bounding_box(BoundingBoxf3* new_bbox = NULL)
|
||||
%code{%
|
||||
@ -147,11 +131,7 @@ ModelMaterial::attributes()
|
||||
|
||||
RETVAL = &THIS->_bounding_box;
|
||||
%};
|
||||
BoundingBoxf3* bounding_box()
|
||||
%code%{
|
||||
RETVAL = new BoundingBoxf3();
|
||||
THIS->bounding_box(RETVAL);
|
||||
%};
|
||||
Clone<BoundingBoxf3> bounding_box();
|
||||
|
||||
%name{_add_volume} Ref<ModelVolume> add_volume(TriangleMesh* mesh)
|
||||
%code%{ RETVAL = THIS->add_volume(*mesh); %};
|
||||
|
@ -10,6 +10,6 @@
|
||||
~MotionPlanner();
|
||||
|
||||
int islands_count();
|
||||
Polyline* shortest_path(Point* from, Point* to)
|
||||
%code%{ RETVAL = new Polyline(); THIS->shortest_path(*from, *to, RETVAL); %};
|
||||
Clone<Polyline> shortest_path(Point* from, Point* to)
|
||||
%code%{ RETVAL = THIS->shortest_path(*from, *to); %};
|
||||
};
|
||||
|
@ -27,8 +27,8 @@
|
||||
void set_y(long val)
|
||||
%code{% THIS->y = val; %};
|
||||
int nearest_point_index(Points points);
|
||||
Point* nearest_point(Points points)
|
||||
%code{% RETVAL = new Point(); THIS->nearest_point(points, RETVAL); %};
|
||||
Clone<Point> nearest_point(Points points)
|
||||
%code{% Point p; THIS->nearest_point(points, &p); RETVAL = p; %};
|
||||
double distance_to(Point* point)
|
||||
%code{% RETVAL = THIS->distance_to(*point); %};
|
||||
double distance_to_line(Line* line)
|
||||
|
@ -19,14 +19,11 @@
|
||||
void translate(double x, double y);
|
||||
void reverse();
|
||||
Lines lines();
|
||||
Polyline* split_at_vertex(Point* point)
|
||||
%code{% RETVAL = new Polyline(); THIS->split_at_vertex(*point, RETVAL); %};
|
||||
Polyline* split_at_index(int index)
|
||||
%code{% RETVAL = new Polyline(); THIS->split_at_index(index, RETVAL); %};
|
||||
Polyline* split_at_first_point()
|
||||
%code{% RETVAL = new Polyline(); THIS->split_at_first_point(RETVAL); %};
|
||||
Points equally_spaced_points(double distance)
|
||||
%code{% THIS->equally_spaced_points(distance, &RETVAL); %};
|
||||
Clone<Polyline> split_at_vertex(Point* point)
|
||||
%code{% RETVAL = THIS->split_at_vertex(*point); %};
|
||||
Clone<Polyline> split_at_index(int index);
|
||||
Clone<Polyline> split_at_first_point();
|
||||
Points equally_spaced_points(double distance);
|
||||
double length();
|
||||
double area();
|
||||
bool is_counter_clockwise();
|
||||
@ -41,16 +38,10 @@
|
||||
Polygons triangulate_convex()
|
||||
%code{% THIS->triangulate_convex(&RETVAL); %};
|
||||
Clone<Point> centroid();
|
||||
BoundingBox* bounding_box()
|
||||
%code{%
|
||||
RETVAL = new BoundingBox();
|
||||
THIS->bounding_box(RETVAL);
|
||||
%};
|
||||
Clone<BoundingBox> bounding_box();
|
||||
std::string wkt();
|
||||
Points concave_points(double angle)
|
||||
%code{% THIS->concave_points(angle, &RETVAL); %};
|
||||
Points convex_points(double angle)
|
||||
%code{% THIS->convex_points(angle, &RETVAL); %};
|
||||
Points concave_points(double angle);
|
||||
Points convex_points(double angle);
|
||||
%{
|
||||
|
||||
Polygon*
|
||||
|
@ -23,8 +23,7 @@
|
||||
Lines lines();
|
||||
Clone<Point> first_point();
|
||||
Clone<Point> last_point();
|
||||
Points equally_spaced_points(double distance)
|
||||
%code{% THIS->equally_spaced_points(distance, &RETVAL); %};
|
||||
Points equally_spaced_points(double distance);
|
||||
double length();
|
||||
bool is_valid();
|
||||
void clip_end(double distance);
|
||||
@ -37,11 +36,7 @@
|
||||
void split_at(Point* point, Polyline* p1, Polyline* p2)
|
||||
%code{% THIS->split_at(*point, p1, p2); %};
|
||||
bool is_straight();
|
||||
BoundingBox* bounding_box()
|
||||
%code{%
|
||||
RETVAL = new BoundingBox();
|
||||
THIS->bounding_box(RETVAL);
|
||||
%};
|
||||
Clone<BoundingBox> bounding_box();
|
||||
std::string wkt();
|
||||
%{
|
||||
|
||||
|
@ -35,8 +35,8 @@ _constant()
|
||||
%code%{ RETVAL = &THIS->config; %};
|
||||
Ref<Print> print();
|
||||
|
||||
Flow* flow(FlowRole role, double layer_height, bool bridge, bool first_layer, double width, PrintObject* object)
|
||||
%code%{ RETVAL = new Flow(THIS->flow(role, layer_height, bridge, first_layer, width, *object)); %};
|
||||
Clone<Flow> flow(FlowRole role, double layer_height, bool bridge, bool first_layer, double width, PrintObject* object)
|
||||
%code%{ RETVAL = THIS->flow(role, layer_height, bridge, first_layer, width, *object); %};
|
||||
};
|
||||
|
||||
|
||||
@ -61,11 +61,7 @@ _constant()
|
||||
%code%{ RETVAL = THIS->layer_height_ranges; %};
|
||||
Ref<Point3> size()
|
||||
%code%{ RETVAL = &THIS->size; %};
|
||||
BoundingBox* bounding_box()
|
||||
%code{%
|
||||
RETVAL = new BoundingBox();
|
||||
THIS->bounding_box(RETVAL);
|
||||
%};
|
||||
Clone<BoundingBox> bounding_box();
|
||||
Ref<Point> _copies_shift()
|
||||
%code%{ RETVAL = &THIS->_copies_shift; %};
|
||||
|
||||
|
@ -31,19 +31,11 @@
|
||||
TriangleMeshPtrs split();
|
||||
void merge(TriangleMesh* mesh)
|
||||
%code{% THIS->merge(*mesh); %};
|
||||
ExPolygons horizontal_projection()
|
||||
%code{% THIS->horizontal_projection(RETVAL); %};
|
||||
BoundingBoxf3* bounding_box()
|
||||
%code{%
|
||||
RETVAL = new BoundingBoxf3();
|
||||
THIS->bounding_box(RETVAL);
|
||||
%};
|
||||
Pointf3* center()
|
||||
%code{%
|
||||
BoundingBoxf3 bb;
|
||||
THIS->bounding_box(&bb);
|
||||
RETVAL = new Pointf3(bb.center());
|
||||
%};
|
||||
ExPolygons horizontal_projection();
|
||||
Clone<Polygon> convex_hull();
|
||||
Clone<BoundingBoxf3> bounding_box();
|
||||
Clone<Pointf3> center()
|
||||
%code{% RETVAL = THIS->bounding_box().center(); %};
|
||||
int facets_count();
|
||||
void reset_repair_stats();
|
||||
%{
|
||||
@ -196,14 +188,6 @@ TriangleMesh::bb3()
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Polygon*
|
||||
TriangleMesh::convex_hull()
|
||||
CODE:
|
||||
RETVAL = new Polygon ();
|
||||
THIS->convex_hull(RETVAL);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
||||
|
||||
|
@ -454,7 +454,6 @@ T_ARRAYREF
|
||||
for (${type}::const_iterator it = $var.begin(); it != $var.end(); ++it) {
|
||||
av_store(av, i++, perl_to_SV_clone_ref(*it));
|
||||
}
|
||||
$var.clear();
|
||||
|
||||
T_ARRAYREF_PTR
|
||||
AV* av = newAV();
|
||||
|
Loading…
Reference in New Issue
Block a user