Skip to content
Browse files

further integrating other gts

  • Loading branch information...
1 parent beb6123 commit 673c94c80e89fed417d2c2379e8a3d0f6497633b @obviousjim committed May 23, 2012
Showing with 28 additions and 12 deletions.
  1. +1 −1 src/ofxGts.cpp
  2. +10 −2 src/ofxGtsSurface.cpp
  3. +17 −9 src/ofxGtsSurface.h
View
2 src/ofxGts.cpp
@@ -20,7 +20,7 @@ ofxGtsSurface* ofxGts::createSurface() {
ofxGtsSurface* ofxGts::createSphere(guint detail) {
ofxGtsSurface* s = createSurface();
- s->createSphere(detail);
+ s->setupSphere(detail);
return s;
}
View
12 src/ofxGtsSurface.cpp
@@ -23,6 +23,7 @@ ofxGtsSurface::ofxGtsSurface() {
,gts_vertex_class()
);
}
+
ofxGtsSurface::~ofxGtsSurface() {
{
vector<GtsVertex*>::iterator it = vertices.begin();
@@ -47,9 +48,12 @@ ofxGtsSurface::~ofxGtsSurface() {
}
}
+void ofxGtsSurface::setup(GtsSurface* s){
+ surface = s;
+}
// level: http://mathworld.wolfram.com/GeodesicDome.html
-void ofxGtsSurface::createSphere(guint level) {
+void ofxGtsSurface::setupSphere(int level) {
gts_surface_generate_sphere(surface, level);
}
@@ -71,6 +75,10 @@ GtsFace* ofxGtsSurface::createFace(GtsEdge* e1, GtsEdge* e2, GtsEdge* e3) {
return face;
}
+GtsSurface* ofxGtsSurface::getGtsSurface(){
+ return surface;
+}
+
vector<GtsVertex*> ofxGtsSurface::getFaceVertices(GtsFace* face) {
}
@@ -91,4 +99,4 @@ vector<GtsTriangle*> ofxGtsSurface::getTriangles() {
vector<GtsTriangle*> triangles;
gts_surface_foreach_face(surface, (GtsFunc) build_triangle_vector, &triangles);
return triangles;
-}
+}
View
26 src/ofxGtsSurface.h
@@ -12,11 +12,20 @@ class ofxGtsSurface {
public:
ofxGtsSurface();
~ofxGtsSurface();
+
+ void setup(GtsSurface* surface);
+ void setupSphere(int level);
+
+ void getUnion(ofxGtsSurface &source, ofxGtsSurface &result);
+ void getIntersection(ofxGtsSurface &source, ofxGtsSurface &result);
+ void getDifference(ofxGtsSurface &source, ofxGtsSurface &result);
+ void getReverseDifference(ofxGtsSurface &source, ofxGtsSurface &result);
+
GtsVertex* createVertex(float x, float y, float z);
GtsEdge* createEdge(GtsVertex* v1, GtsVertex* v2);
GtsFace* createFace(GtsEdge* e1, GtsEdge* e2, GtsEdge* e3);
- void createSphere(guint level);
- void createLayers(int w, int h);
+// void createSphere(guint level);
+// void createLayers(int w, int h);
template<typename T>
@@ -27,14 +36,16 @@ class ofxGtsSurface {
GtsSurface* getGtsSurface();
vector<GtsVertex*> getFaceVertices(GtsFace* face);
- vector<GtsVertex*> getVertices();
- vector<GtsEdge*> getEdges();
+ vector<GtsVertex*> getVertices();
+ vector<GtsEdge*> getEdges();
vector<GtsTriangle*> getTriangles();
-
- GtsSurface* surface;
+
+ protected:
+ GtsSurface* surface;
vector<GtsVertex*> vertices;
vector<GtsEdge*> edges;
vector<GtsFace*> faces;
+
};
template<typename T>
@@ -92,6 +103,3 @@ inline void ofxGtsSurface::updateVertexData(T& vd) {
}
-inline GtsSurface* ofxGtsSurface::getGtsSurface() {
- return surface;
-}

0 comments on commit 673c94c

Please sign in to comment.
Something went wrong with that request. Please try again.