17 class __declspec(dllexport) Node {
19 Node() { coord[0] = coord[1] = coord[2] = 0.0; normal[0] = normal[1] = normal[2] = 0.0; uvpar[0] = uvpar[1] = 0.0; };
22 void setCoords(
double x,
double y,
double z) { coord[0] = x; coord[1] = y; coord[2] = z; };
23 void setNormals(
double x,
double y,
double z) { normal[0] = x; normal[1] = y; normal[2] = z; };
24 void setUVpar(
double u,
double v) { uvpar[0] = u; uvpar[1] = v; };
26 double getCoord(
int index) { assert(index >= 0 && index < 3);
return coord[index]; };
27 double getNormal(
int index) { assert(index >= 0 && index < 3);
return normal[index]; };
28 double getUVpar(
int index) { assert(index >= 0 && index < 2);
return uvpar[index]; };
30 void setX(
double x) { coord[0] = x; };
31 void setY(
double y) { coord[1] = y; };
32 void setZ(
double z) { coord[2] = z; };
34 void setNx(
double x) { normal[0] = x; };
35 void setNy(
double y) { normal[1] = y; };
36 void setNz(
double z) { normal[2] = z; };
38 void setU(
double u) { uvpar[0] = u; };
39 void setV(
double v) { uvpar[1] = v; };
47 class __declspec(dllexport) Triangle {
49 Triangle() { node[0] = node[1] = node[2] = 0; faceId = 0; };
51 virtual ~Triangle() {};
53 void setNodes(
ot::UID node1,
ot::UID node2,
ot::UID node3) { node[0] = node1; node[1] = node2; node[2] = node3; }
54 ot::UID getNode(
int index) { assert(index >= 0 && index < 3);
return node[index]; };
56 void setFaceId(
ot::UID id) { faceId = id; };
57 ot::UID getFaceId(
void) {
return faceId; };
64 class __declspec(dllexport) Point {
66 Point() { coord[0] = coord[1] = coord[2] = 0.0; };
67 Point(
const Point &other) {
if (&other !=
this) { coord[0] = other.coord[0]; coord[1] = other.coord[1]; coord[2] = other.coord[2]; } };
68 Point(
double x,
double y,
double z) { coord[0] = x; coord[1] = y; coord[2] = z; };
71 void setCoord(
double x,
double y,
double z) { coord[0] = x; coord[1] = y; coord[2] = z; };
72 double getX(
void) {
return coord[0]; };
73 double getY(
void) {
return coord[1]; };
74 double getZ(
void) {
return coord[2]; };
77 double coord[3] = {0.,0.,0.};
80 class __declspec(dllexport) Edge {
82 Edge() { npoints = 0; points =
nullptr; faceId = 0; };
83 virtual ~Edge() {
if (points !=
nullptr)
delete[] points; };
84 Edge(
const Edge &other) {
if (&other !=
this) { npoints = 0; faceId = other.faceId;
if (other.npoints > 0) { npoints = other.npoints; points =
new Point[npoints];
for (
int i = 0; i < npoints; i++) points[i] = other.points[i]; } } }
86 int getNpoints(
void) {
return npoints; };
87 Point &getPoint(
int index) {
return points[index]; };
89 void setNpoints(
int n) {
if (points !=
nullptr)
delete[] points; points =
new Point[n]; npoints = n; };
90 void setPoint(
int index,
double x,
double y,
double z) { points[index].setCoord(x, y, z); };
92 void setFaceId(
ot::UID id) { faceId = id; };
93 ot::UID getFaceId(
void) {
return faceId; };
97 Point *points =
nullptr;
101 _declspec(dllexport) bsoncxx::document::value getBSON(std::vector<Geometry::Node> &
nodes);
102 _declspec(dllexport) bsoncxx::document::value getBSON(std::list<Geometry::Triangle> &triangles);
103 _declspec(dllexport) bsoncxx::document::value getBSON(std::list<Geometry::Edge>&
edges);
104 _declspec(dllexport) bsoncxx::document::value getBSON(std::map<ot::UID, std::string>& faceNameMap);
106 _declspec(dllexport)
void readBSON(bsoncxx::document::view &nodesObj, std::vector<Geometry::Node> &
nodes);
107 _declspec(dllexport)
void readBSON(bsoncxx::document::view &trianglesObj, std::list<Geometry::Triangle> &triangles);
108 _declspec(dllexport)
void readBSON(bsoncxx::document::view& edgesObj, std::list<Geometry::Edge>&
edges);
109 _declspec(dllexport)
void readBSON(bsoncxx::document::view& faceNamesObj, std::map<ot::UID, std::string>& faceNameMap);