-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
PolySet.h
48 lines (38 loc) · 1.38 KB
/
PolySet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include "Geometry.h"
#include "linalg.h"
#include "GeometryUtils.h"
#include "Polygon2d.h"
#include "boost-utils.h"
#include <vector>
#include <string>
class PolySetBuilder;
class PolySet : public Geometry
{
friend class PolySetBuilder;
public:
VISITABLE_GEOMETRY();
PolygonIndices indices;
std::vector<Vector3d> vertices;
PolySet(unsigned int dim, boost::tribool convex = unknown);
size_t memsize() const override;
BoundingBox getBoundingBox() const override;
std::string dump() const override;
unsigned int getDimension() const override { return dim_; }
bool isEmpty() const override { return indices.empty(); }
std::unique_ptr<Geometry> copy() const override;
void quantizeVertices(std::vector<Vector3d> *pPointsOut = nullptr);
size_t numFacets() const override { return indices.size(); }
void transform(const Transform3d& mat) override;
void resize(const Vector3d& newsize, const Eigen::Matrix<bool, 3, 1>& autosize) override;
bool isConvex() const;
boost::tribool convexValue() const { return convex_; }
bool isTriangular() const { return is_triangular_; }
void setTriangular(bool triangular) { is_triangular_ = triangular; }
static std::unique_ptr<PolySet> createEmpty() { return std::make_unique<PolySet>(3); }
private:
bool is_triangular_ = false;
unsigned int dim_;
mutable boost::tribool convex_;
mutable BoundingBox bbox_;
};