add stl writer to dcel
This commit is contained in:
@@ -15,6 +15,25 @@ int DECL::Face(int index){
|
|||||||
return FaceData[index];
|
return FaceData[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DECL::Write(){
|
||||||
|
int e1,e2,e3;
|
||||||
|
FILE *TRIANGLES;
|
||||||
|
TRIANGLES = fopen("triangles.stl","w");
|
||||||
|
fprintf("solid \n");
|
||||||
|
for (int idx=0; idx<TriangleCount; idx++){
|
||||||
|
e1 = object.Face(idx);
|
||||||
|
e2 = object.halfedge.next(e1);
|
||||||
|
e3 = object.halfedge.next(e2);
|
||||||
|
auto P1 = object.vertex.coords(object.halfedge.v1(e1));
|
||||||
|
auto P2 = object.vertex.coords(object.halfedge.v1(e2));
|
||||||
|
auto P3 = object.vertex.coords(object.halfedge.v1(e3));
|
||||||
|
fprintf("vertex %f %f %f\n",P1.x,P1.y.P1.z);
|
||||||
|
fprintf("vertex %f %f %f\n",P2.x,P2.y.P2.z);
|
||||||
|
fprintf("vertex %f %f %f\n",P3.x,P3.y.P3.z);
|
||||||
|
}
|
||||||
|
fclose(TRIANGLES);
|
||||||
|
}
|
||||||
|
|
||||||
void DECL::LocalIsosurface(const DoubleArray& A, double value, const int i, const int j, const int k){
|
void DECL::LocalIsosurface(const DoubleArray& A, double value, const int i, const int j, const int k){
|
||||||
Point P,Q;
|
Point P,Q;
|
||||||
Point PlaceHolder;
|
Point PlaceHolder;
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ public:
|
|||||||
Vertex vertex;
|
Vertex vertex;
|
||||||
Halfedge halfedge;
|
Halfedge halfedge;
|
||||||
void LocalIsosurface(const DoubleArray& A, double value, int i, int j, int k);
|
void LocalIsosurface(const DoubleArray& A, double value, int i, int j, int k);
|
||||||
|
void Write();
|
||||||
int Face(int index);
|
int Face(int index);
|
||||||
|
|
||||||
double origin(int edge);
|
double origin(int edge);
|
||||||
|
|||||||
Reference in New Issue
Block a user