2010-01-30 07:26:05 +03:00
|
|
|
#ifndef POLYSET_H_
|
|
|
|
#define POLYSET_H_
|
|
|
|
|
2013-03-28 01:50:25 +04:00
|
|
|
#include "Geometry.h"
|
2011-10-01 03:36:30 +04:00
|
|
|
#include "system-gl.h"
|
|
|
|
#include "linalg.h"
|
2013-11-24 04:04:05 +04:00
|
|
|
#include "renderer.h"
|
|
|
|
#include "Polygon2d.h"
|
2011-08-05 04:11:20 +04:00
|
|
|
#include <vector>
|
2012-02-14 04:43:38 +04:00
|
|
|
#include <string>
|
2010-01-30 07:26:05 +03:00
|
|
|
|
2013-03-28 01:50:25 +04:00
|
|
|
class PolySet : public Geometry
|
2010-01-30 07:26:05 +03:00
|
|
|
{
|
|
|
|
public:
|
2011-08-05 04:11:20 +04:00
|
|
|
typedef std::vector<Vector3d> Polygon;
|
|
|
|
std::vector<Polygon> polygons;
|
2010-01-30 07:26:05 +03:00
|
|
|
|
|
|
|
bool is2d;
|
|
|
|
|
|
|
|
PolySet();
|
2013-11-24 04:04:05 +04:00
|
|
|
PolySet(const Polygon2d &origin);
|
2013-10-31 08:45:00 +04:00
|
|
|
virtual ~PolySet();
|
2010-01-30 07:26:05 +03:00
|
|
|
|
2013-03-28 01:50:25 +04:00
|
|
|
virtual size_t memsize() const;
|
|
|
|
virtual BoundingBox getBoundingBox() const;
|
|
|
|
virtual std::string dump() const;
|
2013-10-31 08:45:00 +04:00
|
|
|
virtual unsigned int getDimension() const { return this->is2d ? 2 : 3; }
|
2013-03-28 01:50:25 +04:00
|
|
|
|
2011-09-02 00:42:46 +04:00
|
|
|
bool empty() const { return polygons.size() == 0; }
|
2010-01-30 07:26:05 +03:00
|
|
|
void append_poly();
|
2011-08-05 04:11:20 +04:00
|
|
|
void append_vertex(double x, double y, double z = 0.0);
|
2013-11-05 10:20:27 +04:00
|
|
|
void append_vertex(Vector3d v);
|
2011-08-05 04:11:20 +04:00
|
|
|
void insert_vertex(double x, double y, double z = 0.0);
|
2013-11-05 10:20:27 +04:00
|
|
|
void insert_vertex(Vector3d v);
|
2013-11-02 02:57:36 +04:00
|
|
|
void append(const PolySet &ps);
|
|
|
|
|
2013-10-31 08:45:00 +04:00
|
|
|
void render_surface(Renderer::csgmode_e csgmode, const Transform3d &m, GLint *shaderinfo = NULL) const;
|
|
|
|
void render_edges(Renderer::csgmode_e csgmode) const;
|
2013-11-24 04:04:05 +04:00
|
|
|
|
2013-12-16 03:27:25 +04:00
|
|
|
void transform(const Transform3d &mat);
|
|
|
|
|
2013-11-24 04:04:05 +04:00
|
|
|
private:
|
|
|
|
Polygon2d polygon;
|
2010-01-30 07:26:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|