mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	
		
			
				
	
	
		
			82 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			82 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
%module{Slic3r::XS};
 | 
						|
 | 
						|
%{
 | 
						|
#include <myinit.h>
 | 
						|
#include "ExPolygonCollection.hpp"
 | 
						|
%}
 | 
						|
 | 
						|
%name{Slic3r::ExPolygon::Collection} class ExPolygonCollection {
 | 
						|
    ~ExPolygonCollection();
 | 
						|
    ExPolygonCollection* clone()
 | 
						|
        %code{% const char* CLASS = "Slic3r::ExPolygon::Collection"; RETVAL = new ExPolygonCollection(*THIS); %};
 | 
						|
    void clear()
 | 
						|
        %code{% THIS->expolygons.clear(); %};
 | 
						|
    void scale(double factor);
 | 
						|
    void translate(double x, double y);
 | 
						|
    void rotate(double angle, Point* center);
 | 
						|
    int count()
 | 
						|
        %code{% RETVAL = THIS->expolygons.size(); %};
 | 
						|
    bool contains_point(Point* point);
 | 
						|
    void simplify(double tolerance);
 | 
						|
%{
 | 
						|
 | 
						|
ExPolygonCollection*
 | 
						|
ExPolygonCollection::new(...)
 | 
						|
    CODE:
 | 
						|
        RETVAL = new ExPolygonCollection ();
 | 
						|
        // ST(0) is class name, others are expolygons
 | 
						|
        RETVAL->expolygons.resize(items-1);
 | 
						|
        for (unsigned int i = 1; i < items; i++) {
 | 
						|
            // Note: a COPY of the input is stored
 | 
						|
            RETVAL->expolygons[i-1].from_SV_check(ST(i));
 | 
						|
        }
 | 
						|
    OUTPUT:
 | 
						|
        RETVAL
 | 
						|
 | 
						|
SV*
 | 
						|
ExPolygonCollection::arrayref()
 | 
						|
    CODE:
 | 
						|
        AV* av = newAV();
 | 
						|
        av_fill(av, THIS->expolygons.size()-1);
 | 
						|
        int i = 0;
 | 
						|
        for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
 | 
						|
            av_store(av, i++, (*it).to_SV_ref());
 | 
						|
        }
 | 
						|
        RETVAL = newRV_noinc((SV*)av);
 | 
						|
    OUTPUT:
 | 
						|
        RETVAL
 | 
						|
 | 
						|
SV*
 | 
						|
ExPolygonCollection::pp()
 | 
						|
    CODE:
 | 
						|
        AV* av = newAV();
 | 
						|
        av_fill(av, THIS->expolygons.size()-1);
 | 
						|
        int i = 0;
 | 
						|
        for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
 | 
						|
            av_store(av, i++, (*it).to_SV_pureperl());
 | 
						|
        }
 | 
						|
        RETVAL = newRV_noinc((SV*)av);
 | 
						|
    OUTPUT:
 | 
						|
        RETVAL
 | 
						|
 | 
						|
void
 | 
						|
ExPolygonCollection::append(...)
 | 
						|
    CODE:
 | 
						|
        for (unsigned int i = 1; i < items; i++) {
 | 
						|
            ExPolygon expolygon;
 | 
						|
            expolygon.from_SV_check( ST(i) );
 | 
						|
            THIS->expolygons.push_back(expolygon);
 | 
						|
        }
 | 
						|
 | 
						|
Polygon*
 | 
						|
ExPolygonCollection::convex_hull()
 | 
						|
    PREINIT:
 | 
						|
        const char* CLASS = "Slic3r::Polygon";
 | 
						|
    CODE:
 | 
						|
        RETVAL = new Polygon ();
 | 
						|
        THIS->convex_hull(RETVAL);
 | 
						|
    OUTPUT:
 | 
						|
        RETVAL
 | 
						|
 | 
						|
%}
 | 
						|
};
 |