Finished porting BoundingBox to XS

evgthin
Alessandro Ranellucci 2014-01-07 12:48:09 +01:00
parent ea47f3b6e7
commit b17d06f9d1
24 changed files with 160 additions and 262 deletions

View File

@ -56,7 +56,6 @@ use Slic3r::GCode::Reader;
use Slic3r::GCode::SpiralVase;
use Slic3r::GCode::VibrationLimit;
use Slic3r::Geometry qw(PI);
use Slic3r::Geometry::BoundingBox;
use Slic3r::Geometry::Clipper;
use Slic3r::Layer;
use Slic3r::Layer::Region;

View File

@ -209,14 +209,6 @@ sub _medial_axis_voronoi {
package Slic3r::ExPolygon::Collection;
use Slic3r::Geometry qw(X1 Y1);
sub align_to_origin {
my $self = shift;
my @bb = Slic3r::Geometry::bounding_box([ map @$_, map @$_, @$self ]);
$self->translate(-$bb[X1], -$bb[Y1]);
$self;
}
sub size {
my $self = shift;
return [ Slic3r::Geometry::size_2D([ map @$_, map @$_, @$self ]) ];

View File

@ -22,8 +22,8 @@ sub infill_direction {
my (@rotate, @shift);
$rotate[0] = Slic3r::Geometry::deg2rad($self->angle);
$rotate[1] = $self->bounding_box
? $self->bounding_box->center_2D
: $surface->expolygon->bounding_box->center_2D;
? $self->bounding_box->center
: $surface->expolygon->bounding_box->center;
@shift = @{$rotate[1]};
if (defined $self->layer_id) {

View File

@ -12,7 +12,7 @@ sub process_polyline {
my $self = shift;
my ($polyline, $bounding_box) = @_;
$_->[X] += $bounding_box->center_2D->[X] for @$polyline;
$_->[X] += $bounding_box->center->[X] for @$polyline;
}
1;

View File

@ -47,8 +47,10 @@ sub fill_surface {
# extend bounding box so that our pattern will be aligned with other layers
# $bounding_box->[X1] and [Y1] represent the displacement between new bounding box offset and old one
$bounding_box->extents->[X][MIN] -= $bounding_box->x_min % $m->{hex_width};
$bounding_box->extents->[Y][MIN] -= $bounding_box->y_min % $m->{pattern_height};
$bounding_box->merge_point(Slic3r::Point->new(
$bounding_box->x_min - ($bounding_box->x_min % $m->{hex_width}),
$bounding_box->y_min - ($bounding_box->y_min % $m->{pattern_height}),
));
}
my $x = $bounding_box->x_min;

View File

@ -33,7 +33,7 @@ sub fill_surface {
(ref $self) =~ /::([^:]+)$/;
my $path = "Math::PlanePath::$1"->new;
my @n = $self->get_n($path, [ map +($_ / $distance_between_lines), @{$bounding_box->bb} ]);
my @n = $self->get_n($path, [ map +($_ / $distance_between_lines), @{$bounding_box->min_point}, @{$bounding_box->max_point} ]);
my $polyline = Slic3r::Polyline->new(
map [ map {$_*$distance_between_lines} $path->n_to_xy($_) ], @n,

View File

@ -38,8 +38,10 @@ sub fill_surface {
);
} else {
# extend bounding box so that our pattern will be aligned with other layers
$bounding_box->extents->[X][MIN] -= $bounding_box->x_min % $line_spacing;
$bounding_box->extents->[Y][MIN] -= $bounding_box->y_min % $line_spacing;
$bounding_box->merge_point(Slic3r::Point->new(
$bounding_box->x_min - ($bounding_box->x_min % $line_spacing),
$bounding_box->y_min - ($bounding_box->y_min % $line_spacing),
));
}
# generate the basic pattern

View File

@ -1,170 +0,0 @@
package Slic3r::Geometry::BoundingBox;
use Moo;
use List::Util qw(min max);
use Slic3r::Geometry qw(X Y Z MIN MAX X1 Y1 X2 Y2 Z1 Z2);
use Storable qw();
has 'extents' => (is => 'ro', required => 1);
sub clone { Storable::dclone($_[0]) }
# 2D
sub new_from_points {
my $class = shift;
my ($points) = @_;
my $bb = [ Slic3r::Geometry::bounding_box($points) ];
return $class->new(extents => [
[ $bb->[X1], $bb->[X2] ],
[ $bb->[Y1], $bb->[Y2] ],
]);
}
# 2D/3D
sub new_from_bb {
my $class = shift;
my ($bb) = @_;
return $class->new(extents => [
[ $bb->[X1], $bb->[X2] ],
[ $bb->[Y1], $bb->[Y2] ],
(@$bb == 6) ? [ $bb->[Z1], $bb->[Z2] ] : (),
]);
}
sub merge {
my $class = shift;
my (@bounding_boxes) = @_;
my $self = ref($class)
? $class
: shift @bounding_boxes;
foreach my $bounding_box (@bounding_boxes) {
for my $axis (X .. $#{$self->extents}) {
$self->extents->[$axis][MIN] = min($self->extents->[$axis][MIN], $bounding_box->extents->[$axis][MIN]);
$self->extents->[$axis][MAX] = max($self->extents->[$axis][MAX], $bounding_box->extents->[$axis][MAX]);
}
}
return $self;
}
# four-arguments 2D bb
sub bb {
my $self = shift;
my $extents = $self->extents;
return [ $extents->[X][MIN], $extents->[Y][MIN], $extents->[X][MAX], $extents->[Y][MAX] ];
}
sub polygon {
my $self = shift;
my $e = $self->extents;
return Slic3r::Polygon->new(
[ $e->[X][MIN], $e->[Y][MIN] ],
[ $e->[X][MAX], $e->[Y][MIN] ],
[ $e->[X][MAX], $e->[Y][MAX] ],
[ $e->[X][MIN], $e->[Y][MAX] ],
);
}
# note to $self
sub rotate {
die "Rotating an axis-aligned bounding box doesn't make any sense";
}
sub scale {
my $self = shift;
my ($factor) = @_;
for (@{$self->extents}) {
$_ *= $factor for @$_[MIN,MAX];
}
$self;
}
sub translate {
my $self = shift;
my @shift = @_;
for my $axis (X .. $#{$self->extents}) {
$self->extents->[$axis][MIN] += $shift[$axis];
$self->extents->[$axis][MAX] += $shift[$axis];
}
$self;
}
sub size {
my $self = shift;
my $extents = $self->extents;
return [ map $extents->[$_][MAX] - $extents->[$_][MIN], grep $extents->[$_], (X,Y,Z) ];
}
sub center {
my $self = shift;
my $extents = $self->extents;
return [ map +($extents->[$_][MAX] + $extents->[$_][MIN])/2, grep $extents->[$_], (X,Y,Z) ];
}
sub center_2D {
my $self = shift;
return Slic3r::Point->new(@{$self->center}[X,Y]);
}
sub min_point {
my $self = shift;
return Slic3r::Point->new($self->extents->[X][MIN], $self->extents->[Y][MIN]);
}
sub min_point3 {
my $self = shift;
return [ map $self->extents->[$_][MIN], (X,Y,Z) ];
}
sub vector_to_origin {
my $self = shift;
return [ map -$_, @{$self->min_point3} ];
}
sub max_point {
my $self = shift;
return Slic3r::Point->new($self->extents->[X][MAX], $self->extents->[Y][MAX]);
}
sub x_min {
my $self = shift;
return $self->extents->[X][MIN];
}
sub x_max {
my $self = shift;
return $self->extents->[X][MAX];
}
sub y_min {
my $self = shift;
return $self->extents->[Y][MIN];
}
sub y_max {
my $self = shift;
return $self->extents->[Y][MAX];
}
sub z_min {
my $self = shift;
return $self->extents->[Z][MIN];
}
sub z_max {
my $self = shift;
return $self->extents->[Z][MAX];
}
1;

View File

@ -186,8 +186,8 @@ sub _arrange {
return Slic3r::Geometry::arrange(
scalar(@$sizes), # number of parts
max(map $_->[X], @$sizes), # cell width
max(map $_->[Y], @$sizes), # cell height
max(map $_->x, @$sizes), # cell width
max(map $_->y, @$sizes), # cell height ,
$distance, # distance between cells
$bb, # bounding box of the area to fill (can be undef)
);
@ -201,28 +201,11 @@ sub has_objects_with_no_instances {
# this returns the bounding box of the *transformed* instances
sub bounding_box {
my $self = shift;
return Slic3r::Geometry::BoundingBox->merge(map $_->bounding_box, @{ $self->objects });
}
sub align_to_origin {
my $self = shift;
# calculate the displacements needed to
# have lowest value for each axis at coordinate 0
{
my $bb = $self->bounding_box;
$self->translate(map -$bb->extents->[$_][MIN], X,Y,Z);
}
# align all instances to 0,0 as well
{
my @instances = map @{$_->instances}, @{$self->objects};
my @extents = Slic3r::Geometry::bounding_box_3D([ map $_->offset, @instances ]);
foreach my $instance (@instances) {
$instance->offset->[X] -= $extents[X][MIN];
$instance->offset->[Y] -= $extents[Y][MIN];
}
}
return undef if !@{$self->objects};
my $bb = $self->objects->[0]->bounding_box;
$bb->merge($_->bounding_box) for @{$self->objects}[1..$#{$self->objects}];
return $bb;
}
# input point is expressed in unscaled coordinates
@ -234,8 +217,8 @@ sub center_instances_around_point {
my $size = $bb->size;
my @shift = (
-$bb->x_min + $point->[X] - $size->[X]/2,
-$bb->y_min + $point->[Y] - $size->[Y]/2,
-$bb->x_min + $point->[X] - $size->x/2,
-$bb->y_min + $point->[Y] - $size->y/2, #//
);
foreach my $object (@{$self->objects}) {
@ -422,17 +405,6 @@ sub instance_bounding_box {
return $mesh->bounding_box;
}
sub align_to_origin {
my $self = shift;
# calculate the displacements needed to
# have lowest value for each axis at coordinate 0
my $bb = $self->bounding_box;
my @shift = map -$bb->extents->[$_][MIN], X,Y,Z;
$self->translate(@shift);
return @shift;
}
sub center_around_origin {
my $self = shift;

View File

@ -19,7 +19,7 @@ sub wkt {
sub bounding_box {
my $self = shift;
return Slic3r::Geometry::BoundingBox->new_from_points($self);
return Slic3r::Geometry::BoundingBox->new_from_points([ @$self ]);
}
sub size {
@ -27,10 +27,4 @@ sub size {
return [ Slic3r::Geometry::size_2D($self) ];
}
sub align_to_origin {
my $self = shift;
my $bb = $self->bounding_box;
return $self->translate(-$bb->x_min, -$bb->y_min);
}
1;

View File

@ -260,7 +260,7 @@ sub validate {
{
my @object_height = ();
foreach my $object (@{$self->objects}) {
my $height = $object->size->[Z];
my $height = $object->size->z;
push @object_height, $height for @{$object->copies};
}
@object_height = sort { $a <=> $b } @object_height;

View File

@ -34,7 +34,11 @@ sub BUILD {
map @$_,
grep defined $_,
@{$self->region_volumes};
my $bb = Slic3r::Geometry::BoundingBox->merge(map $_->bounding_box, @meshes);
my $bb = @meshes
? $meshes[0]->bounding_box
: Slic3r::Geometry::BoundingBoxf3->new;
$bb->merge($_->bounding_box) for @meshes[1..$#meshes];
# Translate meshes so that our toolpath generation algorithms work with smaller
# XY coordinates; this translation is an optimization and not strictly required.
@ -103,7 +107,10 @@ sub bounding_box {
my $self = shift;
# since the object is aligned to origin, bounding box coincides with size
return Slic3r::Geometry::BoundingBox->new_from_points([ map Slic3r::Point->new(@$_[X,Y]), [0,0], $self->size ]);
return Slic3r::Geometry::BoundingBox->new_from_points([
Slic3r::Point->new(0,0),
map Slic3r::Point->new($_->x, $_->y), $self->size #))
]);
}
# this should be idempotent
@ -126,7 +133,7 @@ sub slice {
}
# loop until we have at least one layer and the max slice_z reaches the object height
my $max_z = unscale $self->size->[Z];
my $max_z = unscale($self->size->z);
while (!@{$self->layers} || ($slice_z - $height) <= $max_z) {
# assign the default height to the layer according to the general settings
$height = ($id == 0)

View File

@ -146,7 +146,7 @@ my $polygons = [
{
my $bb = Slic3r::Geometry::BoundingBox->new_from_points([ map Slic3r::Point->new(@$_), [0, 1], [10, 2], [20, 2] ]);
$bb->scale(2);
is_deeply $bb->extents, [ [0,40], [2,4] ], 'bounding box is scaled correctly';
is_deeply [ $bb->min_point->pp, $bb->max_point->pp ], [ [0,2], [40,4] ], 'bounding box is scaled correctly';
}
#==========================================================

View File

@ -25,7 +25,7 @@ use Slic3r::Test;
}
});
my $bb = Slic3r::Geometry::BoundingBox->new_from_points(\@extrusion_points);
my $center = $bb->center_2D;
my $center = $bb->center;
ok abs(unscale($center->[X]) - $config->print_center->[X]) < epsilon, 'print is centered around print_center (X)';
ok abs(unscale($center->[Y]) - $config->print_center->[Y]) < epsilon, 'print is centered around print_center (Y)';
}

View File

@ -6,23 +6,30 @@ namespace Slic3r {
template <class PointClass>
BoundingBoxBase<PointClass>::BoundingBoxBase(const std::vector<PointClass> points)
{
for (typename std::vector<PointClass>::const_iterator it = points.begin(); it != points.end(); ++it) {
typename std::vector<PointClass>::const_iterator it = points.begin();
this->min.x = this->max.x = it->x;
this->min.y = this->max.y = it->y;
for (++it; it != points.end(); ++it) {
this->min.x = std::min(it->x, this->min.x);
this->min.y = std::min(it->y, this->min.y);
this->max.x = std::max(it->x, this->max.x);
this->max.y = std::max(it->y, this->max.y);
}
}
template BoundingBoxBase<Point>::BoundingBoxBase(const std::vector<Point> points);
template <class PointClass>
BoundingBox3Base<PointClass>::BoundingBox3Base(const std::vector<PointClass> points)
: BoundingBoxBase<PointClass>(points)
{
for (typename std::vector<PointClass>::const_iterator it = points.begin(); it != points.end(); ++it) {
typename std::vector<PointClass>::const_iterator it = points.begin();
this->min.z = this->max.z = it->z;
for (++it; it != points.end(); ++it) {
this->min.z = std::min(it->z, this->min.z);
this->max.z = std::max(it->z, this->max.z);
}
}
template BoundingBox3Base<Pointf3>::BoundingBox3Base(const std::vector<Pointf3> points);
void
BoundingBox::polygon(Polygon* polygon) const
@ -45,6 +52,18 @@ BoundingBoxBase<PointClass>::scale(double factor)
this->min.scale(factor);
this->max.scale(factor);
}
template void BoundingBoxBase<Point>::scale(double factor);
template void BoundingBoxBase<Pointf3>::scale(double factor);
template <class PointClass> void
BoundingBoxBase<PointClass>::merge(const PointClass &point)
{
this->min.x = std::min(point.x, this->min.x);
this->min.y = std::min(point.y, this->min.y);
this->max.x = std::max(point.x, this->max.x);
this->max.y = std::max(point.y, this->max.y);
}
template void BoundingBoxBase<Point>::merge(const Point &point);
template <class PointClass> void
BoundingBoxBase<PointClass>::merge(const BoundingBoxBase<PointClass> &bb)
@ -54,6 +73,16 @@ BoundingBoxBase<PointClass>::merge(const BoundingBoxBase<PointClass> &bb)
this->max.x = std::max(bb.max.x, this->max.x);
this->max.y = std::max(bb.max.y, this->max.y);
}
template void BoundingBoxBase<Point>::merge(const BoundingBoxBase<Point> &bb);
template <class PointClass> void
BoundingBox3Base<PointClass>::merge(const PointClass &point)
{
BoundingBoxBase<PointClass>::merge(point);
this->min.z = std::min(point.z, this->min.z);
this->max.z = std::max(point.z, this->max.z);
}
template void BoundingBox3Base<Pointf3>::merge(const Pointf3 &point);
template <class PointClass> void
BoundingBox3Base<PointClass>::merge(const BoundingBox3Base<PointClass> &bb)
@ -62,25 +91,29 @@ BoundingBox3Base<PointClass>::merge(const BoundingBox3Base<PointClass> &bb)
this->min.z = std::min(bb.min.z, this->min.z);
this->max.z = std::max(bb.max.z, this->max.z);
}
template void BoundingBox3Base<Pointf3>::merge(const BoundingBox3Base<Pointf3> &bb);
template <class PointClass> PointClass
BoundingBox2Base<PointClass>::size() const
BoundingBoxBase<PointClass>::size() const
{
return PointClass(this->max.x - this->min.x, this->max.y - this->min.y);
}
template Point BoundingBoxBase<Point>::size() const;
template <class PointClass> PointClass
BoundingBox3Base<PointClass>::size() const
{
return PointClass(this->max.x - this->min.x, this->max.y - this->min.y, this->max.z - this->min.z);
}
template Pointf3 BoundingBox3Base<Pointf3>::size() const;
template <class PointClass> void
BoundingBox2Base<PointClass>::translate(coordf_t x, coordf_t y)
BoundingBoxBase<PointClass>::translate(coordf_t x, coordf_t y)
{
this->min.translate(x, y);
this->max.translate(x, y);
}
template void BoundingBoxBase<Point>::translate(coordf_t x, coordf_t y);
template <class PointClass> void
BoundingBox3Base<PointClass>::translate(coordf_t x, coordf_t y, coordf_t z)
@ -88,24 +121,27 @@ BoundingBox3Base<PointClass>::translate(coordf_t x, coordf_t y, coordf_t z)
this->min.translate(x, y, z);
this->max.translate(x, y, z);
}
template void BoundingBox3Base<Pointf3>::translate(coordf_t x, coordf_t y, coordf_t z);
template <class PointClass> PointClass
BoundingBox2Base<PointClass>::center() const
BoundingBoxBase<PointClass>::center() const
{
return PointClass(
(this->max.x - this->min.x)/2,
(this->max.y - this->min.y)/2
(this->max.x + this->min.x)/2,
(this->max.y + this->min.y)/2
);
}
template Point BoundingBoxBase<Point>::center() const;
template <class PointClass> PointClass
BoundingBox3Base<PointClass>::center() const
{
return PointClass(
(this->max.x - this->min.x)/2,
(this->max.y - this->min.y)/2,
(this->max.z - this->min.z)/2
(this->max.x + this->min.x)/2,
(this->max.y + this->min.y)/2,
(this->max.z + this->min.z)/2
);
}
template Pointf3 BoundingBox3Base<Pointf3>::center() const;
}

View File

@ -19,18 +19,11 @@ class BoundingBoxBase
PointClass min;
PointClass max;
BoundingBoxBase();
BoundingBoxBase() {};
BoundingBoxBase(const std::vector<PointClass> points);
void merge(const PointClass &point);
void merge(const BoundingBoxBase<PointClass> &bb);
void scale(double factor);
};
template <class PointClass>
class BoundingBox2Base : public BoundingBoxBase<PointClass>
{
public:
BoundingBox2Base();
BoundingBox2Base(const std::vector<PointClass> points) : BoundingBoxBase<PointClass>(points) {};
PointClass size() const;
void translate(coordf_t x, coordf_t y);
PointClass center() const;
@ -40,25 +33,28 @@ template <class PointClass>
class BoundingBox3Base : public BoundingBoxBase<PointClass>
{
public:
BoundingBox3Base();
BoundingBox3Base() {};
BoundingBox3Base(const std::vector<PointClass> points);
void merge(const PointClass &point);
void merge(const BoundingBox3Base<PointClass> &bb);
PointClass size() const;
void translate(coordf_t x, coordf_t y, coordf_t z);
PointClass center() const;
};
class BoundingBox : public BoundingBox2Base<Point>
class BoundingBox : public BoundingBoxBase<Point>
{
public:
void polygon(Polygon* polygon) const;
BoundingBox() {};
BoundingBox(const Points points) : BoundingBox2Base<Point>(points) {};
BoundingBox(const Points points) : BoundingBoxBase<Point>(points) {};
};
class BoundingBoxf : public BoundingBox2Base<Pointf> {};
/*
class BoundingBoxf : public BoundingBoxBase<Pointf> {};
class BoundingBox3 : public BoundingBox3Base<Point3> {};
*/
class BoundingBoxf3 : public BoundingBox3Base<Pointf3> {
public:

View File

@ -77,7 +77,6 @@ class ModelObject
void raw_mesh(TriangleMesh* mesh) const;
void mesh(TriangleMesh* mesh) const;
void instance_bounding_box(size_t instance_idx, BoundingBox* bb) const;
void align_to_origin();
void center_around_origin();
void translate(coordf_t x, coordf_t y, coordf_t z);
size_t materials_count() const;

View File

@ -193,4 +193,32 @@ Pointf::from_SV(SV* point_sv)
}
#endif
void
Pointf::scale(double factor)
{
this->x *= factor;
this->y *= factor;
}
void
Pointf::translate(double x, double y)
{
this->x += x;
this->y += y;
}
void
Pointf3::scale(double factor)
{
Pointf::scale(factor);
this->z *= factor;
}
void
Pointf3::translate(double x, double y, double z)
{
Pointf::translate(x, y);
this->z += z;
}
}

View File

@ -57,6 +57,8 @@ class Pointf
coordf_t x;
coordf_t y;
explicit Pointf(coordf_t _x = 0, coordf_t _y = 0): x(_x), y(_y) {};
void scale(double factor);
void translate(double x, double y);
#ifdef SLIC3RXS
void from_SV(SV* point_sv);
@ -69,6 +71,8 @@ class Pointf3 : public Pointf
public:
coordf_t z;
explicit Pointf3(coordf_t _x = 0, coordf_t _y = 0, coordf_t _z = 0): Pointf(_x, _y), z(_z) {};
void scale(double factor);
void translate(double x, double y, double z);
};
}

View File

@ -12,7 +12,7 @@ use Test::More tests => 3;
Slic3r::Point->new(500, -600),
);
my $bb = Slic3r::Geometry::BoundingBox->new_from_points(\@points);
isa_ok $flow, 'Slic3r::Geometry::BoundingBox', 'new_from_points';
isa_ok $bb, 'Slic3r::Geometry::BoundingBox', 'new_from_points';
is_deeply $bb->min_point->pp, [100,-600], 'min_point';
is_deeply $bb->max_point->pp, [500,200], 'max_point';
}

View File

@ -11,6 +11,7 @@
BoundingBox* clone()
%code{% const char* CLASS = "Slic3r::Geometry::BoundingBox"; RETVAL = new BoundingBox(*THIS); %};
void merge(BoundingBox* bb) %code{% THIS->merge(*bb); %};
void merge_point(Point* point) %code{% THIS->merge(*point); %};
void scale(double factor);
void translate(double x, double y);
Polygon* polygon()
@ -31,7 +32,7 @@
%{
BoundingBox*
BoundingBox::new_from_points(CLASS, points)
new_from_points(CLASS, points)
char* CLASS
Points points
CODE:
@ -41,3 +42,22 @@ BoundingBox::new_from_points(CLASS, points)
%}
};
%name{Slic3r::Geometry::BoundingBoxf3} class BoundingBoxf3 {
~BoundingBoxf3();
BoundingBoxf3* clone()
%code{% const char* CLASS = "Slic3r::Geometry::BoundingBoxf3"; RETVAL = new BoundingBoxf3(*THIS); %};
void merge(BoundingBoxf3* bb) %code{% THIS->merge(*bb); %};
void scale(double factor);
void translate(double x, double y, double z);
Pointf3* size()
%code{% const char* CLASS = "Slic3r::Pointf3"; RETVAL = new Pointf3(THIS->size()); %};
Pointf3* center()
%code{% const char* CLASS = "Slic3r::Pointf3"; RETVAL = new Pointf3(THIS->center()); %};
double x_min() %code{% RETVAL = THIS->min.x; %};
double x_max() %code{% RETVAL = THIS->max.x; %};
double y_min() %code{% RETVAL = THIS->min.y; %};
double y_max() %code{% RETVAL = THIS->max.y; %};
double z_min() %code{% RETVAL = THIS->min.z; %};
double z_max() %code{% RETVAL = THIS->max.z; %};
};

View File

@ -49,3 +49,16 @@ Point::coincides_with(point_sv)
%}
};
%name{Slic3r::Pointf3} class Pointf3 {
Pointf3(double _x = 0, double _y = 0, double _z = 0);
~Pointf3();
Pointf3* clone()
%code{% const char* CLASS = "Slic3r::Pointf3"; RETVAL = new Pointf3(*THIS); %};
double x()
%code{% RETVAL = THIS->x; %};
double y()
%code{% RETVAL = THIS->y; %};
double z()
%code{% RETVAL = THIS->z; %};
};

View File

@ -11,6 +11,7 @@ FullPrintConfig* O_OBJECT
ZTable* O_OBJECT
TriangleMesh* O_OBJECT
Point* O_OBJECT
Pointf3* O_OBJECT
Line* O_OBJECT
Polyline* O_OBJECT
PolylineCollection* O_OBJECT
@ -34,6 +35,7 @@ ClipperLib::PolyFillType T_UV
# we return these types whenever we want the items to be cloned
Points T_ARRAYREF
Pointfs T_ARRAYREF
Lines T_ARRAYREF
Polygons T_ARRAYREF
Polylines T_ARRAYREF

View File

@ -8,6 +8,7 @@
%typemap{SV*};
%typemap{AV*};
%typemap{Point*};
%typemap{Pointf3*};
%typemap{BoundingBox*};
%typemap{BoundingBoxf3*};
%typemap{DynamicPrintConfig*};
@ -25,6 +26,7 @@
%typemap{ExtrusionPath*};
%typemap{ExtrusionLoop*};
%typemap{Points};
%typemap{Pointfs};
%typemap{Lines};
%typemap{Polygons};
%typemap{Polylines};