diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2015-12-08 02:39:54 +0300 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2015-12-08 02:39:54 +0300 |
commit | 4913e90e100c093e81dd77f31e2cf39d844b9055 (patch) | |
tree | 2cbb9ded96107eb6db6d0ffdfd12b6ae33501976 /xs/src/libslic3r/Point.cpp | |
parent | 3fac8cd77e76da982219049629f3d9190cfcfbbf (diff) |
Remove any Perl related code from libslic3r
Diffstat (limited to 'xs/src/libslic3r/Point.cpp')
-rw-r--r-- | xs/src/libslic3r/Point.cpp | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/xs/src/libslic3r/Point.cpp b/xs/src/libslic3r/Point.cpp index 51ad8b4d1..35948b7d8 100644 --- a/xs/src/libslic3r/Point.cpp +++ b/xs/src/libslic3r/Point.cpp @@ -299,46 +299,6 @@ operator*(double scalar, const Point& point2) return Point(scalar * point2.x, scalar * point2.y); } -#ifdef SLIC3RXS - -REGISTER_CLASS(Point, "Point"); - -SV* -Point::to_SV_pureperl() const { - AV* av = newAV(); - av_fill(av, 1); - av_store(av, 0, newSViv(this->x)); - av_store(av, 1, newSViv(this->y)); - return newRV_noinc((SV*)av); -} - -void -Point::from_SV(SV* point_sv) -{ - AV* point_av = (AV*)SvRV(point_sv); - // get a double from Perl and round it, otherwise - // it would get truncated - this->x = lrint(SvNV(*av_fetch(point_av, 0, 0))); - this->y = lrint(SvNV(*av_fetch(point_av, 1, 0))); -} - -void -Point::from_SV_check(SV* point_sv) -{ - if (sv_isobject(point_sv) && (SvTYPE(SvRV(point_sv)) == SVt_PVMG)) { - if (!sv_isa(point_sv, perl_class_name(this)) && !sv_isa(point_sv, perl_class_name_ref(this))) - CONFESS("Not a valid %s object (got %s)", perl_class_name(this), HvNAME(SvSTASH(SvRV(point_sv)))); - *this = *(Point*)SvIV((SV*)SvRV( point_sv )); - } else { - this->from_SV(point_sv); - } -} - - -REGISTER_CLASS(Point3, "Point3"); - -#endif - std::ostream& operator<<(std::ostream &stm, const Pointf &pointf) { @@ -386,46 +346,6 @@ Pointf::vector_to(const Pointf &point) const return Vectorf(point.x - this->x, point.y - this->y); } -#ifdef SLIC3RXS - -REGISTER_CLASS(Pointf, "Pointf"); - -SV* -Pointf::to_SV_pureperl() const { - AV* av = newAV(); - av_fill(av, 1); - av_store(av, 0, newSVnv(this->x)); - av_store(av, 1, newSVnv(this->y)); - return newRV_noinc((SV*)av); -} - -bool -Pointf::from_SV(SV* point_sv) -{ - AV* point_av = (AV*)SvRV(point_sv); - SV* sv_x = *av_fetch(point_av, 0, 0); - SV* sv_y = *av_fetch(point_av, 1, 0); - if (!looks_like_number(sv_x) || !looks_like_number(sv_y)) return false; - - this->x = SvNV(sv_x); - this->y = SvNV(sv_y); - return true; -} - -bool -Pointf::from_SV_check(SV* point_sv) -{ - if (sv_isobject(point_sv) && (SvTYPE(SvRV(point_sv)) == SVt_PVMG)) { - if (!sv_isa(point_sv, perl_class_name(this)) && !sv_isa(point_sv, perl_class_name_ref(this))) - CONFESS("Not a valid %s object (got %s)", perl_class_name(this), HvNAME(SvSTASH(SvRV(point_sv)))); - *this = *(Pointf*)SvIV((SV*)SvRV( point_sv )); - return true; - } else { - return this->from_SV(point_sv); - } -} -#endif - void Pointf3::scale(double factor) { @@ -467,8 +387,4 @@ Pointf3::vector_to(const Pointf3 &point) const return Vectorf3(point.x - this->x, point.y - this->y, point.z - this->z); } -#ifdef SLIC3RXS -REGISTER_CLASS(Pointf3, "Pointf3"); -#endif - } |