diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2014-08-03 21:42:29 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2014-08-03 21:42:29 +0400 |
commit | 6adc3477c9d08d2cfa0e6902b3d241a9193e50d4 (patch) | |
tree | 98e1a403cec185a06501056d1811b4d39d731bf5 /xs/src/libslic3r/Surface.cpp | |
parent | b8676241e0c9f91eb9db5b6757e73edfe7f85598 (diff) |
Moved C++ code into new libslic3r directory
Diffstat (limited to 'xs/src/libslic3r/Surface.cpp')
-rw-r--r-- | xs/src/libslic3r/Surface.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/xs/src/libslic3r/Surface.cpp b/xs/src/libslic3r/Surface.cpp new file mode 100644 index 000000000..a53cb2513 --- /dev/null +++ b/xs/src/libslic3r/Surface.cpp @@ -0,0 +1,56 @@ +#include "Surface.hpp" + +namespace Slic3r { + +double +Surface::area() const +{ + return this->expolygon.area(); +} + +bool +Surface::is_solid() const +{ + return this->surface_type == stTop + || this->surface_type == stBottom + || this->surface_type == stBottomBridge + || this->surface_type == stInternalSolid; +} + +bool +Surface::is_external() const +{ + return this->surface_type == stTop + || this->surface_type == stBottom + || this->surface_type == stBottomBridge; +} + +bool +Surface::is_bottom() const +{ + return this->surface_type == stBottom + || this->surface_type == stBottomBridge; +} + +bool +Surface::is_bridge() const +{ + return this->surface_type == stBottomBridge + || this->surface_type == stInternalBridge; +} + +#ifdef SLIC3RXS + +REGISTER_CLASS(Surface, "Surface"); + +void +Surface::from_SV_check(SV* surface_sv) +{ + if (!sv_isa(surface_sv, perl_class_name(this)) && !sv_isa(surface_sv, perl_class_name_ref(this))) + CONFESS("Not a valid %s object", perl_class_name(this)); + // a XS Surface was supplied + *this = *(Surface *)SvIV((SV*)SvRV( surface_sv )); +} +#endif + +} |