mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 08:41:11 -06:00
Incomplete work for porting BoundingBox to XS
This commit is contained in:
parent
3e93a14912
commit
9c0a6a79d3
17 changed files with 421 additions and 18 deletions
71
xs/src/BoundingBox.hpp
Normal file
71
xs/src/BoundingBox.hpp
Normal file
|
@ -0,0 +1,71 @@
|
|||
#ifndef slic3r_BoundingBox_hpp_
|
||||
#define slic3r_BoundingBox_hpp_
|
||||
|
||||
#include <myinit.h>
|
||||
#include "Point.hpp"
|
||||
#include "Polygon.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
typedef Point Size;
|
||||
typedef Point3 Size3;
|
||||
typedef Pointf Sizef;
|
||||
typedef Pointf3 Sizef3;
|
||||
|
||||
template <class PointClass>
|
||||
class BoundingBoxBase
|
||||
{
|
||||
public:
|
||||
PointClass min;
|
||||
PointClass max;
|
||||
|
||||
BoundingBoxBase(const std::vector<PointClass> points);
|
||||
//virtual ~BoundingBoxBase() {};
|
||||
void merge(const BoundingBoxBase &bb);
|
||||
void scale(double factor);
|
||||
};
|
||||
|
||||
template <class PointClass>
|
||||
class BoundingBox2Base : public BoundingBoxBase<PointClass>
|
||||
{
|
||||
public:
|
||||
BoundingBox2Base(const std::vector<PointClass> points) : BoundingBoxBase<PointClass>(points) {};
|
||||
//virtual ~BoundingBox2Base() {};
|
||||
PointClass size() const;
|
||||
void translate(coordf_t x, coordf_t y);
|
||||
PointClass center() const;
|
||||
};
|
||||
|
||||
template <class PointClass>
|
||||
class BoundingBox3Base : public BoundingBoxBase<PointClass>
|
||||
{
|
||||
public:
|
||||
BoundingBox3Base(const std::vector<PointClass> points);
|
||||
//virtual ~BoundingBox3Base() {};
|
||||
void merge(const BoundingBox3Base &bb);
|
||||
PointClass size() const;
|
||||
void translate(coordf_t x, coordf_t y, coordf_t z);
|
||||
PointClass center() const;
|
||||
};
|
||||
|
||||
class BoundingBox : public BoundingBox2Base<Point>
|
||||
{
|
||||
public:
|
||||
void polygon(Polygon* polygon) const;
|
||||
|
||||
BoundingBox();
|
||||
BoundingBox(const Points points) : BoundingBox2Base<Point>(points) {};
|
||||
};
|
||||
|
||||
class BoundingBoxf : public BoundingBox2Base<Pointf> {};
|
||||
class BoundingBox3 : public BoundingBox3Base<Point3> {};
|
||||
|
||||
class BoundingBoxf3 : public BoundingBox3Base<Pointf3> {
|
||||
public:
|
||||
BoundingBoxf3();
|
||||
BoundingBoxf3(const std::vector<Pointf3> points) : BoundingBox3Base<Pointf3>(points) {};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue