mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-21 07:41:09 -06:00
New Slic3r::Point::XS class
This commit is contained in:
parent
cca25c9950
commit
c50ecfb7f8
11 changed files with 109 additions and 17 deletions
14
xs/src/Point.cpp
Normal file
14
xs/src/Point.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "myinit.h"
|
||||
#include "Point.hpp"
|
||||
|
||||
Point::Point(unsigned long x, unsigned long y) {}
|
||||
Point::~Point() {}
|
||||
|
||||
|
||||
SV*
|
||||
Point::_toPerl() {
|
||||
AV* av = newAV();
|
||||
av_fill(av, 1);
|
||||
av_store_point_xy(av, x, y);
|
||||
return (SV*)newRV_noinc((SV*)av);
|
||||
}
|
21
xs/src/Point.hpp
Normal file
21
xs/src/Point.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef slic3r_Point_hpp_
|
||||
#define slic3r_Point_hpp_
|
||||
|
||||
extern "C" {
|
||||
#include "EXTERN.h"
|
||||
#include "perl.h"
|
||||
#include "XSUB.h"
|
||||
#include "ppport.h"
|
||||
}
|
||||
|
||||
class Point
|
||||
{
|
||||
public:
|
||||
unsigned long x;
|
||||
unsigned long y;
|
||||
Point(unsigned long _x, unsigned long _y): x(_x), y(_y) {};
|
||||
~Point();
|
||||
SV* _toPerl();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1,6 @@
|
|||
#ifndef slic3r_TriangleMesh_hpp_
|
||||
#define slic3r_TriangleMesh_hpp_
|
||||
|
||||
#include <admesh/stl.h>
|
||||
|
||||
extern "C" {
|
||||
|
@ -21,4 +24,4 @@ class TriangleMesh
|
|||
stl_file stl;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
24
xs/src/ZTable.hpp
Normal file
24
xs/src/ZTable.hpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef slic3r_ZTable_hpp_
|
||||
#define slic3r_ZTable_hpp_
|
||||
|
||||
extern "C" {
|
||||
#include "EXTERN.h"
|
||||
#include "perl.h"
|
||||
#include "XSUB.h"
|
||||
#include "ppport.h"
|
||||
}
|
||||
|
||||
class ZTable
|
||||
{
|
||||
public:
|
||||
ZTable(std::vector<unsigned int>* z_array);
|
||||
std::vector<unsigned int> get_range(unsigned int min_z, unsigned int max_z);
|
||||
std::vector<unsigned int> z;
|
||||
};
|
||||
|
||||
ZTable::ZTable(std::vector<unsigned int>* ztable) :
|
||||
z(*ztable)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
|
@ -3,21 +3,8 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
////////////////
|
||||
class ZTable
|
||||
{
|
||||
public:
|
||||
ZTable(std::vector<unsigned int>* z_array);
|
||||
std::vector<unsigned int> get_range(unsigned int min_z, unsigned int max_z);
|
||||
std::vector<unsigned int> z;
|
||||
};
|
||||
|
||||
ZTable::ZTable(std::vector<unsigned int>* ztable) :
|
||||
z(*ztable)
|
||||
{
|
||||
}
|
||||
////////////////
|
||||
|
||||
#include "TriangleMesh.hpp"
|
||||
#define av_store_point_xy(AV, X, Y) \
|
||||
av_store(AV, 0, newSViv(X)); \
|
||||
av_store(AV, 1, newSViv(Y))
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue