Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added img

  • Loading branch information...
commit d58912870a538462e4a18c6f877ebf3ce5c207f6 2 parents 1f0e42e + 7bbb948
Progga authored
View
2  CMakeLists.txt
@@ -53,6 +53,6 @@ ELSEIF(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++0x -stdlib=libc++ -g -Wall")
ENDIF()
-add_executable(PointMesh ./src/Grid3D.cpp ./src/RayCaster.cpp ./src/normal.cpp ./src/Grid.cpp ./src/domain.cpp ./src/limitedPriorityQueue.cpp ./src/hyperRegion.cpp ./src/hyperSphere.cpp ./src/node.cpp ./src/tree.cpp ./src/TokenizedFile.cpp ./src/vertex.cpp ./src/GLWidget.cpp ./src/offLoader.cpp ./src/main.cpp ${MOCFILES} ${headers} )
+add_executable(PointMesh ./src/Grid3D.cpp ./src/MarchingCube.cpp ./src/RayCaster.cpp ./src/normal.cpp ./src/Grid.cpp ./src/domain.cpp ./src/limitedPriorityQueue.cpp ./src/hyperRegion.cpp ./src/hyperSphere.cpp ./src/node.cpp ./src/tree.cpp ./src/TokenizedFile.cpp ./src/vertex.cpp ./src/GLWidget.cpp ./src/offLoader.cpp ./src/main.cpp ${MOCFILES} ${headers} )
target_link_libraries(PointMesh ${Boost_LIBRARIES} ${GLUT_LIBRARY} ${QT_LIBRARIES} ${OPENGL_LIBRARIES} )
View
BIN  doc/Th1/images/bspline2.JPG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  doc/Th1/images/grad1_7knoten.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  doc/Th1/images/grad1_knoten5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  doc/Th1/images/normalKnots.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  doc/Th1/images/shiftKnots.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  doc/Th3/cg_HA3.pdf
Binary file not shown
View
21 doc/Th3/cg_HA3.tex
@@ -69,7 +69,25 @@ \section*{Aufgabe #1}
\task{1}
-Die Funktion darf keine unendlich dünnen Stellen haben. An jedem Punkt muss eindeutig sein, ob dieser sich innerhalb oder außerhalb des Körpers befindet.
+Um eine implizite Fl"ache $S$ zu beschreiben ist durch die folgende Funktion $F$ definiert.
+
+\formel{$F:\mathbb{R}^3 \to \mathbb{R}$}
+
+Nach Konvention werden alle negativen Werte innerhalb der Fl"ache angenommen.
+
+\formel{$f(x,y,z) < 0$}
+
+Alle Werte die positiv sind und gr"o{\ss}er als 0 werden au§erhalb der Fl"ache angenommen.
+
+\formel{$f(x,y,z) > 0$}
+
+Und alle Werte die genau 0 ergeben liegen demnach genau auf der Oberfl"ache.
+
+\formel{$f(x,y,z) = 0$}
+
+Eine weitere Eigenschaft der impliziten Funktion ist, dass die beschriebene Fl"ache keine L"ocher hat solange die Funktion kontinuierlich ist. Au{\ss}erdem muss die Eigenschaft erf"ullt sein, dass die Funktion sich nicht selbst schneiden kann.\\
+\\
+Eine der gerbr"auchlichste Form der impliziten Funktion ist die \emph{signed distance function}. Bei dieser Funktion wird jedem Punkt im 3dimensionalen Raum ein vorzeichenbehafteter Abstand $d(x)$ zugewiesen. Der absolute Betrag $|d(x)|$ misst den Abstand von $x$ zur Fl"ache $S$. Das Vorzeichen gibt dabei an, ob sich der Punkt innerhalb oder au{\ss}erhalb der Fl"ache befindet.
\task{2}
@@ -107,4 +125,5 @@ \section*{Aufgabe #1}
\image{0.25}{marchingfail.png}
Die rote Linie verdeutlicht ein durch Marching Cubes erzeugtes Face.
+
\end{document}
View
BIN  doc/Th3/marchingfail.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
9 doc/camReadMe.txt
@@ -0,0 +1,9 @@
+Mouse left: Rotate camera
+Mouse middle: Move along cam gradient
+Mouse right: Move along eye-axis
+Mouse wheel: Zoom (fovy, not same as Mouse right!)
+
+WASD: = Mouse middle
+Arrow keys: Rotate mesh (not camera!)
+
+C: Reset
View
5 include/GLWidget.hpp
@@ -7,6 +7,7 @@
#include "vertex.hpp"
#include "tree.hpp"
#include "Grid3D.hpp"
+#include "MarchingCube.hpp"
class GLWidget : public QGLWidget {
@@ -14,7 +15,7 @@ class GLWidget : public QGLWidget {
public:
GLWidget(QWidget *parent = NULL);
- void setFilename(const std::string& fileName);
+ void setFilename(const std::string& fileName,float scale);
public slots:
void sigShowKDTree(bool show);
@@ -46,9 +47,11 @@ public slots:
VertexList vertices;
KDTree tree;
Grid3D grid;
+ MarchingCubes marchingCubes;
size_t m_k;
size_t m_n;
size_t m_m;
+ float m_scale;
private:
bool showTree;
View
25 include/Grid.hpp
@@ -24,12 +24,26 @@ class Grid
void setRadius(const float radius);
void reapproximateWLS();
size_t m_k;
+ size_t getDimX() {return m_dimX;};
+ size_t getDimY() {return m_dimY;};
+
protected:
float getWendland(const float distance) const;
float m_radius;
+ size_t m_dimX;
+ size_t m_dimY;
+ float m_h;
+ KDTree m_tree;
std::vector<Eigen::VectorXf> m_coefficients;
+ float m_MinX;
+ float m_MinY;
+ float m_MinZ;
+ float m_MaxX;
+ float m_MaxY;
+ float m_MaxZ;
+
private:
VertexPtr getByDeCasteljau(const float weight, const size_t iteration,
@@ -38,22 +52,11 @@ class Grid
void drawQuads();
void resetBaseVertices();
- float m_MinX;
- float m_MinY;
- float m_MinZ;
- float m_MaxX;
- float m_MaxY;
- float m_MaxZ;
VertexList m_vertices;
VertexList m_interpolVertices;
std::vector<vec3f> m_quadNormals;
- KDTree m_tree;
- size_t m_dimX;
- size_t m_dimY;
-
- float m_h;
bool m_showQuads;
bool m_showTriangles;
View
27 include/Grid3D.hpp
@@ -13,6 +13,8 @@
#include "tree.hpp"
#include "vertex.hpp"
+#define OUTOFRANGE_DISTANCE 100000
+
class Grid3D : public Grid
{
public:
@@ -21,28 +23,29 @@ class Grid3D : public Grid
virtual ~Grid3D() {};
virtual void approximateWLS(VertexList& resultList);
- virtual void draw();
- virtual double getImplicitFunctionValue(float x,float y,float z);
+ virtual void draw(bool useAlpha);
+ virtual double getInterpolatedFunctionValue(float x,float y,float z,int valueType);
+ virtual double getImplicitFunctionValueWorldCoordinates(float x,float y,float z,int valueType);
+
+ int getIndex(int idX,int idY,int idZ);
+ VertexPtr getVertex(int idX,int idY,int idZ);
+ double getVertexValue(int idX,int idY,int idZ,int valueType);
+ NormalPtr interpolateNormal(VertexList vrtxList) const;
+ size_t getDimZ() {return m_dimZ;};
+
protected:
void generateVertices();
+ size_t m_dimZ;
+ bool m_interpolate;
+
private:
unsigned int factorial(const int num);
- KDTree m_tree;
KDTree m_fullTree;
- size_t m_dimX;
- size_t m_dimY;
- size_t m_dimZ;
float m_diagLength;
- float m_MinX;
- float m_MinY;
- float m_MinZ;
- float m_MaxX;
- float m_MaxY;
- float m_MaxZ;
VertexList m_GridVertices;
VertexList m_generatedPoints;
View
49 include/MarchingCube.hpp
@@ -0,0 +1,49 @@
+#ifndef MARCHINGCUBE_HPP_4GH0L5D6
+#define MARCHINGCUBE_HPP_4GH0L5D6
+
+#include "Grid3D.hpp"
+#include <vector>
+
+typedef char int8;
+typedef std::pair<VertexPtr, VertexPtr> Edge;
+class Cube
+{
+public:
+ //Cube Numbering as described in http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/
+ Cube(VertexPtr vrtx0, VertexPtr vrtx1, VertexPtr vrtx2, VertexPtr vrtx3,
+ VertexPtr vrtx4, VertexPtr vrtx5, VertexPtr vrtx6, VertexPtr vrtx7);
+ virtual ~Cube();
+
+ VertexList m_vertices;
+ std::vector<Edge> m_Edges;
+
+ int getIndex();
+ VertexList getTriangles();
+ VertexPtr getInterpolatedVertex(const Edge& edge);
+};
+
+class MarchingCubes
+{
+public:
+ MarchingCubes();
+ MarchingCubes (const Grid3D& grid, const size_t dimX, const size_t dimY,
+ const size_t dimZ);
+ virtual ~MarchingCubes ();
+
+ void march();
+ void draw();
+
+protected:
+
+private:
+ Grid3D m_Grid;
+ size_t m_dimX;
+ size_t m_dimY;
+ size_t m_dimZ;
+
+ VertexList m_triangles;
+};
+
+
+#endif /* end of include guard: MARCHINGCUBE_HPP_4GH0L5D6 */
+
View
12 include/RayCaster.hpp
@@ -12,6 +12,13 @@
#include <GL/glut.h>
#endif
+#define RC
+
+#define RC_FIRSTTOUCH 1
+#define RC_TRANSPARENT 2
+#define RC_FAKEFRESNEL 3
+
+
class RayCaster {
public:
@@ -20,14 +27,13 @@ class RayCaster {
};
~RayCaster() {
-
+
}
- vec3f m_rays[];
float * m_colors;
void refreshViewport();
- void cast(Grid3D grid,float eyeX,float eyeY,float eyeZ);
+ void cast(Grid3D * grid,int type,float eyeX,float eyeY,float eyeZ,float scale);
private:
bool initialized;
View
4 include/offLoader.hpp
@@ -13,12 +13,12 @@ class OffLoader
public:
OffLoader();
virtual ~OffLoader();
- virtual VertexList readOff(const std::string& fileName);
+ virtual VertexList readOff(const std::string& fileName,float scale);
protected:
bool parseFirstLine(Tokens tokens);
bool parseSecondLine(Tokens tokens);
- const VertexPtr parseVertex(const Tokens& tokens) const;
+ const VertexPtr parseVertex(const Tokens& tokens,float scale) const;
private:
unsigned int m_NumVertices;
View
12 include/vertex.hpp
@@ -19,6 +19,7 @@ class Vertex: public vec3f
public:
/** Default constructor */
Vertex(const vec3f pos);
+ Vertex(const vec3f pos, NormalPtr normal);
Vertex(const float x, const float y, const float z);
Vertex(const float x, const float y, const float z, NormalPtr normal);
Vertex(const float x, const float y, const float z, const vec3f color);
@@ -27,18 +28,21 @@ class Vertex: public vec3f
Vertex(const float x, const float y, const float z, const vec3f color, float w);
virtual ~Vertex();
- void draw() const;
- void highlight(const vec3f color = vec3f(1.0, 0.0, 0.0));
+ void draw(bool useAlpha) const;
+ void draw() const {draw(false);}
+ void highlight(const vec3f color = vec3f(0.6, 0.5, 0.4));
void resetColor();
- const float& getFunValue() const { return m_W; };
+ const double& getFunValue() const { return m_W; };
void setFunValue(float val) { m_W = val; };
NormalPtr getNormal() const { return m_NormalPtr; }
+ void setNormal(NormalPtr normal){ m_NormalPtr = normal; };
protected:
vec3f m_Color;
+
NormalPtr m_NormalPtr;
//Function Value
- float m_W;
+ double m_W;
private:
Vertex() {};
};
View
1,066 meshes/cat.off
@@ -0,0 +1,1066 @@
+NOFF
+366 698 0
+0 0 0 -0.112399 0.0705785 0.991153
+-1 -60 10 -0.0675599 0.302474 0.95076
+-44 -34 -10 -0.448639 0.0196008 0.893498
+-70 -71 -33 -0.681706 -0.243201 0.690022
+-83 -9 -32 -0.60181 0.0129209 0.798535
+-35 24 -9 -0.375424 0.0643947 0.924613
+-73 55 -36 -0.687808 0.263184 0.676501
+4 52 0 0.0422686 -0.125681 0.99117
+76 0 -8 0.361515 0.0959772 0.927413
+-57 -95 0 -0.949771 -0.0628724 0.306565
+-47 -115 29 -0.906164 0.00580494 0.422887
+-7 -112 46 0.0737245 0.468756 0.880246
+-10 -140 58 0.100212 0.0475667 0.993828
+-32 -146 49 -0.80589 -0.273481 0.525119
+51 -93 -3 0.611361 -0.106147 0.784201
+23 -131 34 0.715987 0.00460851 0.698098
+-11 -176 47 -0.189967 -0.770751 0.608157
+33 -155 2 0.816728 -0.529541 0.229221
+14 -170 28 0.663145 -0.6241 0.413204
+-10 -184 9 -0.396233 -0.911527 0.110081
+2 -181 -28 0.223314 -0.957994 -0.179939
+54 -135 -37 0.679613 -0.662891 0.314169
+19 -160 -80 0.201319 -0.979199 -0.0252974
+-18 -176 -30 -0.700282 -0.705145 -0.111248
+-29 -154 -73 -0.503659 -0.852504 0.139872
+-29 -113 -30 -0.819668 -0.544965 0.176514
+97 -53 -20 0.580704 -0.207576 0.787207
+101 -101 -53 0.639943 -0.515893 0.569497
+-31 -160 -146 -0.194516 -0.980208 -0.0368238
+-101 -132 -146 -0.599073 -0.800547 0.0153905
+-115 -116 -109 -0.719085 -0.639363 0.272273
+-117 -90 -86 -0.767002 -0.342882 0.542346
+-113 -50 -71 -0.79208 -0.177988 0.583892
+-124 -15 -71 -0.835983 -0.048947 0.546568
+-124 21 -81 -0.838671 0.137577 0.526975
+-128 50 -96 -0.834874 0.268052 0.480763
+-124 89 -122 -0.748451 0.602348 0.277485
+-30 106 -41 -0.854856 0.510059 0.0951912
+-61 131 -110 -0.524932 0.803545 0.280647
+-15 156 -106 -0.213889 0.976452 -0.0281475
+-20 166 -61 -0.518341 0.841656 -0.15145
+-23 167 -25 -0.470375 0.881757 0.0353736
+-27 162 9 -0.436116 0.875692 0.207282
+-34 147 38 -0.373697 0.543561 0.751593
+-46 120 34 -0.757579 0.0393699 0.651555
+-54 99 15 -0.907085 -0.0485207 0.418141
+-62 78 -7 -0.916597 -0.063855 0.39468
+-18 100 28 0.132593 -0.375362 0.917345
+5 122 20 0.634113 0.100828 0.766639
+40 102 -15 0.578464 0.271172 0.769314
+2 149 7 0.606975 0.652427 0.453784
+19 154 -61 0.377734 0.924754 0.0463325
+91 93 -43 0.584178 0.488724 0.647985
+38 138 -44 0.579801 0.715931 0.388939
+-146 -26 -137 -0.977602 -0.0614095 0.201302
+-128 -93 -117 -0.913449 -0.334119 0.232328
+-140 -52 -166 -0.902989 -0.370511 0.21756
+-153 -29 -168 -0.939997 -0.0385325 0.338999
+-140 8 -172 -0.970366 0.164378 0.177115
+-140 42 -126 -0.958495 0.116549 0.260198
+-135 72 -140 -0.905458 0.403599 0.131352
+-128 84 -160 -0.793715 0.6046 -0.0668997
+-100 106 -210 -0.55658 0.774632 -0.300273
+-71 129 -174 -0.439374 0.8914 -0.111156
+-149 44 -159 -0.99642 0.0845424 0.000411905
+-140 43 -192 -0.989519 0.129413 0.0640625
+-147 38 -221 -0.884372 0.458589 0.0870754
+-142 44 -235 -0.730778 0.619722 -0.286197
+-162 -33 -187 -0.829225 -0.0506099 0.556619
+-170 -14 -200 -0.843034 0.27712 0.460975
+-168 0 -215 -0.848789 0.46522 0.251254
+-136 -96 -150 -0.899873 -0.432677 -0.054941
+-95 -134 -201 -0.508127 -0.827381 -0.239264
+-128 -83 -181 -0.867684 -0.497108 0.00286548
+-136 -84 -206 -0.720239 -0.662969 0.204272
+-161 -57 -203 -0.726953 -0.59612 0.340853
+-182 -33 -219 -0.984609 -0.10322 0.141036
+-174 -51 -231 -0.903631 -0.42796 -0.0173479
+-172 -31 -251 -0.932258 -0.0864121 -0.351324
+-177 -12 -236 -0.959876 0.242666 -0.140542
+-120 -99 -240 -0.459873 -0.818658 -0.34397
+-164 -70 -250 -0.759788 -0.616389 -0.20685
+-141 -68 -277 -0.369047 -0.59056 -0.717665
+-161 -55 -268 -0.779101 -0.316842 -0.540938
+-31 -145 -213 -0.227376 -0.901943 -0.367149
+-40 -86 -292 -0.655548 -0.599526 -0.459158
+9 -145 -240 -0.446627 -0.891082 -0.0806021
+-90 -75 -284 -0.221584 -0.577407 -0.785813
+-49 -33 -308 -0.684193 0.0130958 -0.729183
+14 -157 -270 -0.709557 -0.612987 0.347527
+-27 -104 -319 -0.937248 -0.332984 0.10338
+-39 -37 -370 -0.969685 0.222062 0.101976
+-170 4 -245 -0.893942 0.42215 -0.150523
+-157 24 -241 -0.808493 0.5751 -0.124892
+-152 -33 -287 -0.531971 -0.081435 -0.842838
+-167 -9 -269 -0.839522 0.177603 -0.513478
+-147 19 -274 -0.540188 0.529711 -0.653913
+-95 37 -286 -0.332836 0.436576 -0.835836
+-81 16 -296 -0.20508 0.208833 -0.956206
+-20 12 -327 -0.797934 0.442896 -0.408834
+-25 47 -298 -0.440728 0.51755 -0.733417
+37 74 -356 -0.518615 0.852585 -0.0643304
+43 84 -305 -0.299552 0.90899 -0.289837
+-1 90 -271 -0.174978 0.782478 -0.597587
+-40 99 -258 -0.158243 0.748876 -0.64354
+-101 69 -263 -0.480823 0.584158 -0.653888
+-34 133 -204 -0.12061 0.918172 -0.377377
+45 131 -197 0.152738 0.953147 -0.261115
+85 130 -101 0.504178 0.857797 0.0999446
+147 -1 -51 0.704131 0.0479382 0.70845
+166 -90 -115 0.692648 -0.486586 0.532422
+130 -130 -140 0.405168 -0.8364 0.369154
+90 -140 -118 0.332826 -0.928574 0.16425
+62 -159 -197 -0.069589 -0.975635 0.208071
+123 -159 -193 0.109784 -0.81361 0.570952
+71 -174 -224 -0.328842 -0.801668 0.49919
+188 -108 -163 0.690307 -0.509823 0.513378
+-32 -134 -352 -0.934215 -0.153257 0.322111
+6 -178 -302 -0.74376 -0.425876 0.51522
+-21 -239 -384 -0.773634 -0.387542 0.501299
+-47 -245 -440 -0.92576 -0.182774 0.331002
+-59 -192 -486 -0.981884 0.0790635 0.172201
+-87 -72 -528 -0.994453 0.0852589 0.0615965
+-47 3 -452 -0.862056 0.480204 0.16206
+-67 -136 -524 -0.879395 -0.45758 0.131475
+-59 -152 -551 -0.981455 -0.187265 0.0409691
+-69 -138 -588 -0.834009 -0.538213 -0.121468
+-59 -166 -518 -0.980539 0.172168 0.0943435
+-38 16 -542 -0.684686 0.708645 -0.170374
+-18 42 -472 -0.645274 0.763919 0.0071148
+158 106 -364 0.124732 0.98679 0.103381
+118 103 -304 0.0353786 0.999224 -0.0173047
+85 109 -254 0.131481 0.975556 -0.176077
+38 67 -532 -0.389221 0.868109 -0.308049
+88 100 -426 -0.278595 0.960404 -0.00292429
+138 99 -525 -0.0929333 0.970789 -0.221206
+204 103 -446 0.326043 0.945326 0.00741697
+57 7 -638 -0.333767 0.91278 -0.235443
+-44 -73 -873 -0.957724 0.00626003 0.287621
+-76 -59 -630 -0.958661 0.259198 -0.117409
+-20 3 -640 -0.424394 0.892849 -0.150696
+138 76 -617 -0.207134 0.943289 -0.259424
+131 50 -704 -0.193025 0.966393 -0.16978
+67 -2 -723 -0.350893 0.936378 -0.00833653
+-13 -3 -717 -0.342189 0.93954 0.0130804
+54 12 -904 -0.15497 0.912455 0.378696
+-36 0 -909 -0.824489 0.420095 0.379129
+-10 19 -900 -0.281896 0.862049 0.421197
+-57 41 -952 -0.806148 0.429888 0.406598
+-17 66 -949 -0.185257 0.876686 0.443961
+113 38 -901 -0.122651 0.937235 0.326415
+142 34 -904 0.427281 0.873919 0.231725
+169 15 -908 0.766396 0.63409 0.102799
+202 12 -779 0.671873 0.702545 -0.234558
+191 -33 -910 0.940342 -0.20446 -0.271942
+174 36 -958 0.909125 0.349268 -0.226944
+263 -41 -689 0.93696 -0.00968614 -0.349303
+221 33 -693 0.565898 0.760428 -0.318604
+240 51 -618 0.588769 0.751766 -0.296983
+236 83 -518 0.511757 0.845919 -0.150084
+290 16 -517 0.942311 0.319218 -0.100749
+281 -25 -621 0.963647 0.121526 -0.23794
+278 -93 -566 0.979643 -0.0722915 -0.187282
+46 57 -957 -0.0995355 0.879891 0.464635
+46 62 -977 -0.128884 0.969204 0.209838
+-60 46 -976 -0.871638 0.474893 0.121339
+-18 70 -980 -0.189416 0.97303 0.131662
+155 75 -123 0.726003 0.644421 0.240085
+185 69 -185 0.625716 0.738616 0.250849
+213 65 -241 0.618774 0.745712 0.247046
+241 58 -290 0.683897 0.684968 0.251204
+274 48 -368 0.809569 0.568828 0.145028
+283 36 -425 0.890697 0.454163 0.0198396
+254 -111 -630 0.945275 -0.0740578 -0.317758
+205 -94 -744 0.898344 -0.22539 -0.377064
+76 -201 -254 -0.432503 -0.597861 0.67491
+130 -189 -228 0.0503013 -0.665193 0.744975
+70 -268 -299 -0.49807 -0.46758 0.730271
+132 -272 -283 0.0533969 -0.573967 0.817136
+59 -340 -350 -0.533397 -0.482625 0.694666
+-46 -296 -476 -0.870913 -0.29391 0.393861
+-77 -318 -577 -0.762328 -0.215446 0.610277
+-85 -279 -578 -0.797643 0.0196584 0.602809
+-85 -245 -589 -0.845189 0.308882 0.436174
+-81 -217 -617 -0.7709 0.578345 0.266889
+-72 -198 -652 -0.729783 0.681232 0.0577849
+-12 -121 -847 -0.971351 -0.0879116 0.220792
+-33 -62 -978 -0.822586 0.441656 -0.358179
+-48 -50 -916 -0.88433 0.455979 0.100222
+-84 -71 -911 -0.702432 0.607504 0.370847
+-97 -80 -947 -0.782901 0.592399 -0.190076
+-68 -94 -988 -0.59094 0.53754 -0.601532
+-92 -133 -982 -0.82342 0.382728 -0.418925
+-109 -133 -938 -0.893002 0.449941 0.0100025
+-129 -269 -610 -0.735169 0.272349 0.620768
+-122 -219 -664 -0.620452 0.744556 0.246324
+-102 -206 -759 -0.527173 0.84608 -0.0789698
+-54 -188 -769 -0.683595 0.725613 -0.078636
+-46 -194 -863 -0.697931 0.582724 0.416323
+-99 -227 -871 -0.642956 0.619884 0.449834
+-111 -156 -901 -0.608043 0.443309 0.658605
+-89 -119 -901 -0.646592 0.277947 0.710397
+-151 -181 -945 -0.744393 0.662679 -0.0820727
+-145 -188 -908 -0.643018 0.503647 0.576947
+-187 -240 -914 -0.717928 0.366105 0.592069
+-190 -226 -951 -0.828385 0.545337 -0.128006
+-167 -225 -984 -0.708016 0.547189 -0.446427
+-123 -176 -982 -0.692464 0.609348 -0.386249
+-158 -302 -886 -0.829721 0.263858 0.491877
+-207 -285 -922 -0.793437 0.19709 0.575859
+-154 -269 -803 -0.889385 0.443056 -0.112674
+-154 -244 -706 -0.843906 0.534767 0.0429782
+-172 -302 -690 -0.969895 0.181789 0.162039
+-170 -377 -820 -0.998404 -0.0563449 -0.00382766
+-164 -360 -664 -0.894791 -0.175035 0.410746
+-176 -364 -725 -0.991732 -0.113456 0.0599564
+-171 -352 -890 -0.859471 0.077667 0.505249
+-143 -482 -755 -0.859479 -0.485378 0.160326
+-139 -491 -835 -0.8702 -0.489976 0.0517167
+-145 -485 -889 -0.810694 -0.395667 0.431536
+-169 -400 -892 -0.861511 -0.163457 0.480709
+-224 -351 -928 -0.871073 0.0351173 0.489897
+-222 -411 -934 -0.878604 -0.179405 0.442571
+-200 -474 -932 -0.810543 -0.343804 0.474151
+-147 -561 -933 -0.676052 -0.641014 0.363393
+-122 -379 -614 -0.596263 -0.292669 0.74754
+-110 -460 -657 -0.638244 -0.498258 0.586842
+-59 -419 -608 -0.618235 -0.419451 0.664715
+-21 -378 -496 -0.808968 -0.38455 0.444626
+26 -518 -559 -0.560844 -0.64927 0.513715
+-49 -474 -633 -0.602555 -0.441579 0.664783
+45 -415 -422 -0.556992 -0.558738 0.614468
+-67 -528 -681 -0.596322 -0.639978 0.484591
+-7 -549 -637 -0.541952 -0.714635 0.442249
+-62 -574 -763 -0.592238 -0.79044 0.156395
+62 -595 -668 -0.109152 -0.929228 0.353017
+77 -542 -559 -0.0992894 -0.857164 0.505382
+92 -492 -484 -0.091187 -0.800053 0.592959
+108 -428 -408 -0.0459588 -0.707993 0.704722
+121 -352 -340 0.0111275 -0.608781 0.793261
+-214 -276 -952 -0.941187 0.330367 -0.0708851
+-201 -279 -984 -0.854989 0.352557 -0.380391
+-216 -348 -982 -0.887635 0.0827783 -0.453048
+-227 -351 -960 -0.981208 0.0663539 -0.181182
+-224 -411 -962 -0.947414 -0.181956 -0.263248
+-206 -410 -986 -0.782594 -0.184307 -0.594625
+-205 -474 -961 -0.896488 -0.376322 -0.233861
+-183 -469 -990 -0.702351 -0.328686 -0.631402
+-176 -525 -963 -0.785349 -0.540406 -0.301973
+-127 -545 -989 -0.495155 -0.573127 -0.652952
+-146 -559 -961 -0.599716 -0.710441 -0.368258
+-59 -600 -978 -0.408559 -0.909113 -0.0811981
+22 -635 -937 -0.0868128 -0.977457 -0.192461
+-82 -611 -921 -0.512107 -0.852183 0.107377
+51 -637 -910 0.0715076 -0.996171 -0.0502992
+18 -628 -844 -0.244496 -0.951301 0.187746
+-81 -576 -878 -0.722958 -0.66464 0.188643
+-37 -628 -899 -0.375446 -0.922226 0.0924095
+82 -629 -856 0.145569 -0.98658 0.0739535
+134 -615 -863 0.323558 -0.945437 -0.038208
+97 -627 -911 0.312797 -0.933584 -0.174865
+69 -626 -939 0.214581 -0.912939 -0.347128
+103 -620 -792 0.150669 -0.977161 0.149849
+43 -620 -773 -0.150079 -0.965768 0.211585
+147 -566 -634 0.336787 -0.854185 0.39616
+27 -622 -964 6.02849e-06 -0.897481 -0.441054
+154 -535 -576 0.414725 -0.806966 0.420486
+169 -484 -504 0.50864 -0.731075 0.454769
+153 63 -963 0.603081 0.783009 0.152284
+148 65 -980 0.609139 0.766459 -0.203692
+158 -26 -971 0.808479 -0.267943 -0.523992
+202 -10 -138 0.886173 0.0836006 0.45575
+176 -6 -88 0.840861 0.0525697 0.538692
+233 -13 -196 0.87486 0.133957 0.465484
+252 -19 -236 0.909583 0.198062 0.36528
+277 -33 -298 0.954994 0.101396 0.278758
+129 84 -81 0.70481 0.557018 0.439288
+296 -53 -410 0.998846 0.0219803 0.0426933
+294 -68 -472 0.99726 -0.0285176 -0.0682589
+205 -41 -847 0.936189 -0.207736 -0.283541
+146 -89 -878 0.913618 -0.269298 -0.304601
+226 -42 -783 0.938564 -0.0774067 -0.336313
+131 -72 -972 0.912072 -0.291988 -0.287868
+101 81 -953 -0.034693 0.919445 0.391685
+103 85 -978 0.0470217 0.985755 0.161482
+142 -459 -450 0.257137 -0.753485 0.605095
+186 -417 -429 0.566524 -0.634164 0.526201
+156 -388 -378 0.295022 -0.653513 0.697052
+197 -341 -363 0.564229 -0.535179 0.628672
+202 -258 -305 0.549709 -0.507977 0.663158
+207 -152 -226 0.585156 -0.507547 0.632446
+251 -70 -230 0.838102 -0.158425 0.522002
+257 -101 -257 0.867033 -0.240567 0.436327
+261 -149 -299 0.866795 -0.290151 0.40556
+263 -214 -351 0.870757 -0.314342 0.378117
+261 -300 -421 0.878837 -0.356521 0.317078
+249 -374 -491 0.862853 -0.42189 0.278377
+221 -464 -582 0.68048 -0.574781 0.454504
+196 -515 -615 0.586828 -0.690778 0.422445
+163 -575 -670 0.425558 -0.843224 0.328441
+-164 -46 -194 -0.789235 -0.373287 0.487612
+289 -95 -365 0.980379 -0.0931116 0.173745
+290 -152 -424 0.990974 -0.111791 0.0739818
+287 -232 -502 0.994037 -0.105147 0.02889
+281 -229 -569 0.992066 0.0197443 -0.124161
+277 -302 -570 0.960465 -0.0508331 0.273722
+267 -211 -650 0.925117 0.376282 -0.0507014
+278 -262 -600 0.963254 0.217177 0.158038
+258 -394 -562 0.831384 -0.35107 0.430755
+315 -295 -640 0.92209 0.25949 0.287079
+311 -374 -621 0.898713 -0.131265 0.418431
+199 -172 -785 0.805989 0.488147 -0.334804
+236 -182 -719 0.838987 0.465891 -0.281152
+166 -172 -865 0.84899 0.508472 -0.143774
+294 -430 -624 0.788782 -0.426341 0.442783
+323 -391 -690 0.978154 -0.187751 0.0892367
+294 -477 -713 0.880754 -0.446175 0.158746
+248 -522 -670 0.588657 -0.706904 0.392135
+188 -596 -771 0.427819 -0.890256 0.156254
+248 -553 -777 0.688462 -0.72281 0.0597075
+275 -516 -739 0.793702 -0.593084 0.135235
+284 -221 -701 0.732485 0.680774 0.00356658
+315 -274 -726 0.930891 0.350453 -0.103073
+327 -329 -698 0.997728 0.0667479 0.00912559
+240 -196 -764 0.638742 0.739614 -0.212083
+290 -246 -765 0.801707 0.530264 -0.275835
+237 -215 -818 0.678026 0.653604 -0.336277
+200 -185 -825 0.608815 0.745003 -0.272608
+218 -214 -851 0.691176 0.617601 -0.375293
+204 -211 -874 0.733254 0.658011 0.171348
+143 -128 -915 0.861131 0.504265 0.0645814
+275 -265 -824 0.794246 0.440306 -0.418692
+245 -270 -875 0.909273 0.414363 -0.0390519
+267 -345 -888 0.962728 0.14533 -0.228107
+306 -316 -799 0.919598 0.210193 -0.331902
+314 -382 -794 0.967466 0.0402379 -0.24978
+313 -431 -801 0.97623 -0.130475 -0.173064
+296 -487 -824 0.911529 -0.386661 -0.14003
+254 -538 -846 0.731082 -0.672454 -0.115434
+272 -428 -900 0.965683 0.00767827 -0.259611
+269 -492 -901 0.927778 -0.249369 -0.277565
+246 -532 -917 0.77003 -0.595746 -0.228343
+197 -568 -954 0.604274 -0.769197 -0.207822
+163 -593 -933 0.464179 -0.866159 -0.185218
+207 -570 -900 0.604134 -0.783774 -0.143943
+148 -604 -909 0.42074 -0.895561 -0.144737
+169 -598 -885 0.462002 -0.874358 -0.148503
+136 -602 -947 0.380273 -0.905303 -0.18926
+101 -616 -944 0.293255 -0.946354 -0.135706
+226 -569 -807 0.616008 -0.7851 -0.0644314
+193 -589 -855 0.541588 -0.83381 -0.106973
+157 -610 -830 0.340956 -0.939754 -0.0247244
+128 -109 -983 0.83472 0.54983 -0.0305004
+167 -119 -982 0.206236 0.940188 0.271133
+188 -142 -926 0.283643 0.786526 0.548565
+196 -123 -977 0.147545 0.927877 0.342454
+216 -143 -935 0.378387 0.742737 0.552417
+254 -231 -918 0.902887 0.264848 0.338601
+240 -154 -943 0.696652 0.531121 0.482272
+227 -135 -971 0.486715 0.838054 0.246525
+259 -176 -968 0.861629 0.230012 0.452427
+263 -241 -965 0.973518 0.0741941 0.216237
+262 -310 -966 0.998208 0.0591884 0.00883716
+264 -372 -962 0.99618 0.0275044 -0.0828822
+262 -444 -961 0.977209 -0.089986 -0.192265
+248 -502 -964 0.86795 -0.398594 -0.296286
+3 2 1 0
+3 2 4 3
+3 0 4 2
+3 5 4 0
+3 6 4 5
+3 5 7 6
+3 0 7 5
+3 0 1 8
+3 3 9 1
+3 10 1 9
+3 11 1 10
+3 12 11 10
+3 10 13 12
+3 14 1 11
+3 11 15 14
+3 12 15 11
+3 16 15 12
+3 12 13 16
+3 17 14 15
+3 15 18 17
+3 16 18 15
+3 19 18 16
+3 20 18 19
+3 17 18 20
+3 20 21 17
+3 22 21 20
+3 23 22 20
+3 20 19 23
+3 24 22 23
+3 23 25 24
+3 19 25 23
+3 16 25 19
+3 13 25 16
+3 10 25 13
+3 9 25 10
+3 3 25 9
+3 14 8 1
+3 27 26 14
+3 24 28 22
+3 30 29 24
+3 24 31 30
+3 25 31 24
+3 32 31 3
+3 21 14 17
+3 27 14 21
+3 33 32 4
+3 4 34 33
+3 6 34 4
+3 35 34 6
+3 6 36 35
+3 37 36 6
+3 38 36 37
+3 37 39 38
+3 40 39 37
+3 37 41 40
+3 42 41 37
+3 37 43 42
+3 44 43 37
+3 37 45 44
+3 37 46 45
+3 6 46 37
+3 7 46 6
+3 45 46 7
+3 7 47 45
+3 48 47 7
+3 43 47 48
+3 44 47 43
+3 7 49 48
+3 50 43 48
+3 42 43 50
+3 50 41 42
+3 51 41 50
+3 40 41 51
+3 51 39 40
+3 53 49 52
+3 53 50 48
+3 48 49 53
+3 53 51 50
+3 8 52 49
+3 49 7 8
+3 32 33 54
+3 54 31 32
+3 55 31 54
+3 54 56 55
+3 57 56 54
+3 54 58 57
+3 59 58 54
+3 54 34 59
+3 33 34 54
+3 59 34 35
+3 35 36 59
+3 60 59 36
+3 36 61 60
+3 62 61 36
+3 36 63 62
+3 38 63 36
+3 39 63 38
+3 64 60 61
+3 61 65 64
+3 66 65 61
+3 61 67 66
+3 62 67 61
+3 58 59 64
+3 68 57 58
+3 58 69 68
+3 70 69 58
+3 58 66 70
+3 65 66 58
+3 64 65 58
+3 30 31 55
+3 55 29 30
+3 71 29 55
+3 55 56 71
+3 60 64 59
+3 47 44 45
+3 28 24 29
+3 29 72 28
+3 73 72 29
+3 29 71 73
+3 73 71 56
+3 56 74 73
+3 75 74 56
+3 57 68 56
+3 77 75 76
+3 76 78 77
+3 79 78 76
+3 76 70 79
+3 69 70 76
+3 76 68 69
+3 72 73 74
+3 74 80 72
+3 81 80 74
+3 74 75 81
+3 82 80 81
+3 81 83 82
+3 78 83 81
+3 81 77 78
+3 75 77 81
+3 84 28 72
+3 72 85 84
+3 80 85 72
+3 86 28 84
+3 84 85 86
+3 85 80 87
+3 87 88 85
+3 82 88 87
+3 87 80 82
+3 89 86 85
+3 85 90 89
+3 91 90 85
+3 92 79 70
+3 70 93 92
+3 66 93 70
+3 67 93 66
+3 94 83 78
+3 78 95 94
+3 92 95 78
+3 78 79 92
+3 96 92 93
+3 67 96 93
+3 96 95 92
+3 94 95 96
+3 96 97 94
+3 67 97 96
+3 82 83 94
+3 94 88 82
+3 98 88 94
+3 94 97 98
+3 99 91 88
+3 88 100 99
+3 98 100 88
+3 101 99 100
+3 100 102 101
+3 103 102 100
+3 100 104 103
+3 97 104 100
+3 98 97 100
+3 67 62 105
+3 105 97 67
+3 104 97 105
+3 105 62 104
+3 106 62 63
+3 63 39 106
+3 104 62 106
+3 107 103 104
+3 104 106 107
+3 107 106 39
+3 51 107 39
+3 108 107 51
+3 109 52 8
+3 8 26 109
+3 27 110 109
+3 109 26 27
+3 111 110 27
+3 27 21 111
+3 112 111 21
+3 21 22 112
+3 113 111 112
+3 112 22 113
+3 28 113 22
+3 114 111 113
+3 113 115 114
+3 89 115 113
+3 113 86 89
+3 28 86 113
+3 114 116 111
+3 116 110 111
+3 89 90 117
+3 117 118 89
+3 119 118 117
+3 117 121 120
+3 90 91 117
+3 91 122 117
+3 123 122 91
+3 91 101 123
+3 122 124 117
+3 124 125 117
+3 126 125 124
+3 124 122 126
+3 125 127 117
+3 127 121 117
+3 120 119 117
+3 91 99 101
+3 123 128 122
+3 123 101 129
+3 131 130 101
+3 102 132 131
+3 131 101 102
+3 101 134 133
+3 130 134 101
+3 135 134 130
+3 130 136 135
+3 135 133 134
+3 137 133 135
+3 107 132 102
+3 139 138 126
+3 122 139 126
+3 128 139 122
+3 140 139 128
+3 133 137 128
+3 141 137 135
+3 142 137 141
+3 143 137 142
+3 144 137 143
+3 143 145 144
+3 142 145 143
+3 137 140 128
+3 144 140 137
+3 144 139 140
+3 146 139 144
+3 144 147 146
+3 145 147 144
+3 146 149 148
+3 147 149 146
+3 142 150 145
+3 151 150 142
+3 142 152 151
+3 153 152 142
+3 154 152 153
+3 151 152 155
+3 157 156 153
+3 153 142 157
+3 158 156 157
+3 157 142 158
+3 141 158 142
+3 159 158 141
+3 160 158 159
+3 161 158 160
+3 160 162 161
+3 161 156 158
+3 135 159 141
+3 136 159 135
+3 138 139 146
+3 164 149 163
+3 166 165 149
+3 164 166 149
+3 108 132 107
+3 168 132 167
+3 169 132 168
+3 169 131 132
+3 170 131 169
+3 130 131 170
+3 170 171 130
+3 171 136 130
+3 172 136 171
+3 159 136 172
+3 172 160 159
+3 161 162 173
+3 173 156 161
+3 174 156 173
+3 175 89 118
+3 115 89 175
+3 175 114 115
+3 176 114 175
+3 119 175 118
+3 177 175 119
+3 176 175 177
+3 177 178 176
+3 180 179 177
+3 177 119 180
+3 119 120 180
+3 180 182 181
+3 183 182 180
+3 180 120 183
+3 120 121 183
+3 121 184 183
+3 127 185 121
+3 125 185 127
+3 121 185 184
+3 125 186 185
+3 189 188 187
+3 187 191 190
+3 191 192 190
+3 193 189 190
+3 148 165 188
+3 186 138 189
+3 189 187 190
+3 182 194 181
+3 183 194 182
+3 195 194 183
+3 183 184 195
+3 184 185 195
+3 196 195 185
+3 185 197 196
+3 186 197 185
+3 198 197 186
+3 196 197 198
+3 198 199 196
+3 201 200 198
+3 198 189 201
+3 186 189 198
+3 189 193 201
+3 193 200 201
+3 202 200 193
+3 203 200 202
+3 202 204 203
+3 205 204 202
+3 202 206 205
+3 207 206 202
+3 202 193 207
+3 190 192 193
+3 192 207 193
+3 200 199 198
+3 203 199 200
+3 204 199 203
+3 208 199 204
+3 204 209 208
+3 210 196 199
+3 211 196 210
+3 195 196 211
+3 211 194 195
+3 213 212 211
+3 211 210 213
+3 212 194 211
+3 214 194 212
+3 212 215 214
+3 208 210 199
+3 213 210 208
+3 208 216 213
+3 213 215 212
+3 217 215 213
+3 213 218 217
+3 219 218 213
+3 213 220 219
+3 216 220 213
+3 208 221 216
+3 209 221 208
+3 221 220 216
+3 222 220 221
+3 223 220 222
+3 219 220 223
+3 223 224 219
+3 214 225 194
+3 226 225 214
+3 217 226 214
+3 214 215 217
+3 225 181 194
+3 227 181 225
+3 225 226 227
+3 228 179 180
+3 180 181 228
+3 227 228 181
+3 229 228 227
+3 227 230 229
+3 231 179 228
+3 228 229 231
+3 230 227 226
+3 226 232 230
+3 217 232 226
+3 233 229 230
+3 230 232 233
+3 217 234 232
+3 234 235 232
+3 235 233 232
+3 236 229 235
+3 237 229 236
+3 231 229 237
+3 237 238 231
+3 239 231 238
+3 179 231 239
+3 178 177 179
+3 179 239 178
+3 206 240 205
+3 241 240 206
+3 242 240 241
+3 243 240 242
+3 242 244 243
+3 245 244 242
+3 247 246 244
+3 244 245 247
+3 248 246 247
+3 247 249 248
+3 249 250 248
+3 252 250 251
+3 204 205 240
+3 240 209 204
+3 221 209 240
+3 240 243 221
+3 243 244 221
+3 244 222 221
+3 223 222 244
+3 244 246 223
+3 223 246 248
+3 248 224 223
+3 250 224 248
+3 253 224 250
+3 252 254 253
+3 234 217 218
+3 218 255 234
+3 219 256 218
+3 257 256 219
+3 219 253 257
+3 256 255 218
+3 257 255 256
+3 254 255 257
+3 259 258 254
+3 254 260 259
+3 261 260 254
+3 254 252 261
+3 258 259 262
+3 255 254 258
+3 258 262 255
+3 255 263 234
+3 262 263 255
+3 264 235 262
+3 263 235 234
+3 252 265 261
+3 250 249 251
+3 265 252 251
+3 266 235 264
+3 233 235 229
+3 235 266 236
+3 266 237 236
+3 267 237 266
+3 103 107 102
+3 126 138 186
+3 186 125 126
+3 129 128 123
+3 129 133 128
+3 101 133 129
+3 3 1 2
+3 32 3 4
+3 263 262 235
+3 224 253 219
+3 253 254 257
+3 252 253 250
+3 155 269 268
+3 155 270 269
+3 272 271 167
+3 168 167 271
+3 271 273 168
+3 273 169 168
+3 274 169 273
+3 170 169 274
+3 274 275 170
+3 109 110 272
+3 167 132 108
+3 52 108 53
+3 53 108 51
+3 276 167 108
+3 167 276 272
+3 272 276 109
+3 276 108 52
+3 275 171 170
+3 277 171 275
+3 172 171 277
+3 277 278 172
+3 278 160 172
+3 162 160 278
+3 279 154 153
+3 145 149 147
+3 174 280 279
+3 281 279 153
+3 153 156 281
+3 174 281 156
+3 174 279 281
+3 154 270 155
+3 155 152 154
+3 280 154 279
+3 280 282 154
+3 282 270 154
+3 155 268 151
+3 149 165 148
+3 163 149 145
+3 284 164 283
+3 283 164 163
+3 283 163 145
+3 145 150 283
+3 283 150 151
+3 151 268 283
+3 268 269 283
+3 269 284 283
+3 267 285 237
+3 286 285 267
+3 238 285 286
+3 237 285 238
+3 286 287 238
+3 288 287 286
+3 239 287 288
+3 238 287 239
+3 288 178 239
+3 289 178 288
+3 290 178 289
+3 176 178 290
+3 290 116 176
+3 116 114 176
+3 290 273 116
+3 291 273 290
+3 290 292 291
+3 116 272 110
+3 271 272 116
+3 116 273 271
+3 293 292 290
+3 290 294 293
+3 289 294 290
+3 288 294 289
+3 295 294 288
+3 288 296 295
+3 286 296 288
+3 267 296 286
+3 297 296 267
+3 267 298 297
+3 299 298 264
+3 264 262 299
+3 266 298 267
+3 264 298 266
+3 8 7 0
+3 14 26 8
+3 31 25 3
+3 276 52 109
+3 91 85 88
+3 300 75 56
+3 76 75 300
+3 300 56 68
+3 68 76 300
+3 274 273 291
+3 292 275 274
+3 274 291 292
+3 275 292 301
+3 301 277 275
+3 278 277 301
+3 301 302 278
+3 294 302 301
+3 301 293 294
+3 293 301 292
+3 303 162 302
+3 302 294 303
+3 295 303 294
+3 304 162 303
+3 303 305 304
+3 295 305 303
+3 296 305 295
+3 173 162 304
+3 304 306 173
+3 307 306 304
+3 304 305 307
+3 308 305 296
+3 296 297 308
+3 309 307 305
+3 305 310 309
+3 308 310 305
+3 309 306 307
+3 311 174 173
+3 173 312 311
+3 306 312 173
+3 313 280 174
+3 174 311 313
+3 162 278 302
+3 314 310 308
+3 315 310 314
+3 314 316 315
+3 317 316 314
+3 314 297 317
+3 308 297 314
+3 317 297 298
+3 298 318 317
+3 299 318 298
+3 318 319 317
+3 146 148 188
+3 146 188 138
+3 138 188 189
+3 187 188 165
+3 299 262 318
+3 320 316 317
+3 317 319 320
+3 306 309 321
+3 322 321 309
+3 309 323 322
+3 310 323 309
+3 315 323 310
+3 324 311 312
+3 306 324 312
+3 321 324 306
+3 325 324 321
+3 326 324 325
+3 322 325 321
+3 327 313 311
+3 324 326 327
+3 327 311 324
+3 326 313 327
+3 328 313 326
+3 329 313 328
+3 330 313 329
+3 280 313 330
+3 322 331 325
+3 331 328 326
+3 326 325 331
+3 332 328 331
+3 331 333 332
+3 334 333 331
+3 331 322 334
+3 323 334 322
+3 335 334 323
+3 323 315 335
+3 336 335 315
+3 315 316 336
+3 337 336 316
+3 316 320 337
+3 319 337 320
+3 338 337 319
+3 339 334 335
+3 339 335 336
+3 336 340 339
+3 337 340 336
+3 341 340 337
+3 338 341 337
+3 339 333 334
+3 344 343 342
+3 345 343 344
+3 344 346 345
+3 259 345 346
+3 260 345 259
+3 261 345 260
+3 347 343 345
+3 342 343 347
+3 345 348 347
+3 265 348 261
+3 348 345 261
+3 349 338 319
+3 350 338 349
+3 349 318 350
+3 319 318 349
+3 351 318 262
+3 350 318 351
+3 351 259 350
+3 262 259 351
+3 346 350 259
+3 344 350 346
+3 350 344 338
+3 341 338 344
+3 344 342 341
+3 328 332 329
+3 330 282 280
+3 352 282 330
+3 330 353 352
+3 354 353 330
+3 355 353 354
+3 329 354 330
+3 329 356 354
+3 329 332 356
+3 357 356 332
+3 358 356 357
+3 359 356 358
+3 355 354 356
+3 359 355 356
+3 360 359 358
+3 361 360 358
+3 358 357 361
+3 362 361 357
+3 357 333 362
+3 332 333 357
+3 339 364 363
+3 363 362 333
+3 333 339 363
+3 339 340 364
+3 340 365 364
+3 340 341 365
+3 341 342 365
View
12 meshes/minimal.off
@@ -1,12 +0,0 @@
-OFF
-9 0 0
-1.0 1.0 1.0
-1.0 -1.0 -0.5
--1.0 1.0 1.0
--1.0 -1.0 1.0
-0.0 0.0 -1.0
-1.0 0.0 0.0
--1.0 0.0 0.0
-0.0 1.0 0.0
-0.0 -1.0 0.0
-
View
134 src/GLWidget.cpp
@@ -14,6 +14,7 @@
#include "offLoader.hpp"
#include "stopwatch.hpp"
#include "RayCaster.hpp"
+#include "MarchingCube.hpp"
#define SHIFT_SPEED 0.05f
@@ -25,8 +26,9 @@ GLWidget::GLWidget(QWidget *parent) :
m_k = 1;
}
-void GLWidget::setFilename(const std::string& fileName) {
+void GLWidget::setFilename(const std::string& fileName,float scale) {
m_fileName = fileName;
+ m_scale = scale;
}
QPoint lastPos;
@@ -48,17 +50,24 @@ GLfloat modelOffsetX = 0.0f;
GLfloat modelOffsetY = 0.0f;
GLfloat modelOffsetZ = 0.0f;
GLfloat screenRatio;
+bool useAlpha = false;
+bool drawCloud = true;
-//sry that its global, but so many other variables are global as well ^^
RayCaster rayCaster;
-bool doRayCasting = false;
+int doRayCasting = -1;
+bool locRepaint = false;
unsigned int kNearest = 50;
float radius = 40;
size_t vrtxID = 0;
vec3f highlightColor(0.0, 1.0, 0.0);
+int idI = 0;
+int idJ = 0;
+int idK = 0;
+
void GLWidget::initializeGL() {
+
glDisable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
glEnable(GL_COLOR_MATERIAL);
@@ -86,16 +95,15 @@ void GLWidget::initializeGL() {
OffLoader loader;
Stopwatch readTimer("ParseFile");
- vertices = loader.readOff(m_fileName);
+ vertices = loader.readOff(m_fileName,m_scale);
readTimer.stop();
Stopwatch treeTimer("GenTree");
tree = KDTree(vertices, 2);
treeTimer.stop();
- grid = Grid3D(tree, 10,10,10);
+ grid = Grid3D(tree, 28,28,28);
+ marchingCubes = MarchingCubes(grid, 28, 28, 28);
m_m = 5;
m_n = 5;
-
-
}
void GLWidget::resizeGL(int w, int h) {
@@ -114,6 +122,11 @@ void GLWidget::resizeGL(int w, int h) {
void GLWidget::paintGL() {
+ if(locRepaint)
+ return;
+
+ //grid.getVertex(idI,idJ,idK)->m_Color = vec3f(1,1,0);
+
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(1,0,0);
@@ -125,16 +138,16 @@ void GLWidget::paintGL() {
if(camDistance<0.02f)
camDistance = 0.02f;
- if(camDistance>100)
- camDistance = 100;
+ if(camDistance>10000)
+ camDistance = 10000;
if(camBeta>3.1f/2)
camBeta = 3.1f/2;
if(camBeta<-3.1f/2)
camBeta = -3.1f/2;
- if(scale < 0.05f)
- scale = 0.05f;
+ if(scale < 0.005f)
+ scale = 0.005f;
if(scale > 30)
scale = 30;
@@ -142,7 +155,7 @@ void GLWidget::paintGL() {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
float uZoom = zoom*zoom;
- gluPerspective(1+uZoom*60, screenRatio, 0.1f, 1000.0f);
+ gluPerspective(1+uZoom*70, screenRatio, 0.1f, 1000.0f);
//Camera position/angle
@@ -164,11 +177,13 @@ void GLWidget::paintGL() {
);
//Call ray casting
- if(doRayCasting) {
+ if(doRayCasting>0) {
- rayCaster.cast(grid,eyeX,eyeY,eyeZ);
+ locRepaint = true;
+ rayCaster.cast(&grid,doRayCasting,eyeX,eyeY,eyeZ,scale);
glEnable(GL_LIGHTING);
- doRayCasting = false;
+ doRayCasting = -1;
+ locRepaint = true;
return;
}
@@ -176,40 +191,41 @@ void GLWidget::paintGL() {
glRotatef(rotationY, 0.0, 1.0, 0.0);
glRotatef(rotationZ, 0.0, 0.0, 1.0);
glTranslatef(modelOffsetX, modelOffsetY, modelOffsetZ);
+
glScalef(scale,scale,scale);
+
+
+
// if (showTree)
// {
// tree.draw();
// }
- grid.draw();
+ grid.draw(useAlpha);
//glScalef(20, 20, 20);
+ marchingCubes.draw();
+
glDisable(GL_LIGHTING);
- /*
- glColor3f(1.0f, 0.0f, 0.0f);
- glPointSize(3);
- glBegin(GL_POINTS);
- for(auto vertex : vertices)
- {
- vertex->draw();
- }
- glEnd();
- */
-
- /*
- glColor3f(0.0f, 1.0f, 0.0f);
- glBegin(GL_LINES);
- for (size_t i = 0; i < vertices.size(); i++)
- {
- VertexPtr vertex = vertices.at(i);
- NormalPtr normal = vertex->getNormal();
- //normal->flip();
-
- glVertex3fv((*vertex)._v);
- glVertex3fv(((*normal) / -30 + (*vertex))._v);
- }
- glEnd();
- */
+ if(drawCloud) {
+ glColor3f(1.0f, 0.0f, 0.0f);
+ glPointSize(3);
+ glBegin(GL_POINTS);
+ for(VertexPtr vertex : vertices)
+ {
+ vertex->draw();
+ }
+ glEnd();
+
+ glColor3f(0.0f, 1.0f, 0.0f);
+ glBegin(GL_LINES);
+ for (VertexPtr vertex : vertices)
+ {
+ NormalPtr normal = vertex->getNormal();
+ glVertex3fv((*vertex)._v);
+ glVertex3fv(((*normal) / -30 + (*vertex))._v);
+ }
+ glEnd();
+ }
glEnable(GL_LIGHTING);
@@ -245,17 +261,20 @@ void GLWidget::mouseMoveEvent(QMouseEvent *event) {
GLfloat dy = (GLfloat)(event->y() - lastPos.y()) / height();
if (event->buttons() & Qt::LeftButton) {
+ locRepaint = false;
camAlpha += 4 * dx;
camBeta += 3 * dy;
updateGL();
}
if (event->buttons() & Qt::RightButton) {
+ locRepaint = false;
camDistance += 3.5f * dy;
updateGL();
}
if (event->buttons() & Qt::MiddleButton) {
+ locRepaint = false;
camShift(dx,dy);
updateGL();
}
@@ -264,12 +283,14 @@ void GLWidget::mouseMoveEvent(QMouseEvent *event) {
}
void GLWidget::wheelEvent(QWheelEvent* event){
+ locRepaint = false;
//positionZ += event->delta()/100.0;
zoom -= event->delta()*0.00015f;
updateGL();
}
void GLWidget::keyPressEvent(QKeyEvent* event) {
+
switch(event->key()) {
case Qt::Key_Escape:
break;
@@ -314,6 +335,18 @@ void GLWidget::keyPressEvent(QKeyEvent* event) {
camShift(-SHIFT_SPEED,0);
updateGL();
break;
+ case Qt::Key_I:
+ idI++;
+ updateGL();
+ break;
+ case Qt::Key_J:
+ idJ++;
+ updateGL();
+ break;
+ case Qt::Key_K:
+ idK++;
+ updateGL();
+ break;
case Qt::Key_Q:
camShiftZ(-SHIFT_SPEED);
updateGL();
@@ -322,6 +355,14 @@ void GLWidget::keyPressEvent(QKeyEvent* event) {
camShiftZ(SHIFT_SPEED);
updateGL();
break;
+ case Qt::Key_L:
+ useAlpha ^= 1;
+ updateGL();
+ break;
+ case Qt::Key_O:
+ drawCloud ^= 1;
+ updateGL();
+ break;
case Qt::Key_C:
positionX = 0;
positionY = 0;
@@ -340,12 +381,19 @@ void GLWidget::keyPressEvent(QKeyEvent* event) {
updateGL();
break;
case Qt::Key_R:
- doRayCasting = true;
+ doRayCasting = RC_FIRSTTOUCH;
+ updateGL();
+ break;
+ case Qt::Key_T:
+ doRayCasting = RC_TRANSPARENT;
updateGL();
+ break;
default:
event->ignore();
- break;
+ return;
}
+
+ //locRepaint = false;
}
void GLWidget::sigShowKDTree(bool show) {
View
5 src/Grid.cpp
@@ -17,14 +17,14 @@ using namespace Eigen;
Grid::Grid (KDTree tree, const size_t dim_x, const size_t dim_y):
m_tree(tree), m_dimX(dim_x), m_dimY(dim_y), m_showQuads(false)
{
- resetBaseVertices();
+ //resetBaseVertices();
//TODO Use GUI
//repeatedApproximation(2);
m_radius = 0.3;
m_k = 1;
m_h = 0.2;
- approximateWLS(m_vertices);
+ //approximateWLS(m_vertices);
//approximateTensor(4);
//toggleQuads();
}
@@ -230,6 +230,7 @@ void Grid::repeatedApproximation(const size_t k){
approximateWLS(m_interpolVertices);
}
+#include <iomanip>
float Grid::getWendland(const float distance) const{
//(1 - d/h)^4 * (4d/h +1)
View
276 src/Grid3D.cpp
@@ -16,25 +16,30 @@
#include "Grid3D.hpp"
#include <math.h>
+#include <float.h>
+#include <iomanip>
+
+#define DIM_BIAS 0.4f
using namespace Eigen;
-Grid3D::Grid3D(KDTree tree, const size_t dim_x, const size_t dim_y, const size_t dim_z)
- : m_tree(tree), m_dimX(dim_x), m_dimY(dim_y), m_dimZ(dim_z)
+Grid3D::Grid3D(KDTree tree, const size_t dim_x, const size_t dim_y, const size_t dim_z):
+ Grid(tree, dim_x, dim_y),
+ m_dimZ(dim_z)
{
- m_radius = 0.03;
+ m_interpolate = false;
const VertexList& minm_vertices = m_tree.getMinVertices();
const VertexList& maxm_vertices = m_tree.getMaxVertices();
// slightly bigger bounding box
- m_MinX = (*minm_vertices.at(0))[0] - 0.01;
- m_MinY = (*minm_vertices.at(1))[1] - 0.01;
- m_MinZ = (*minm_vertices.at(2))[2] - 0.01;
+ m_MinX = (*minm_vertices.at(0))[0] - DIM_BIAS;
+ m_MinY = (*minm_vertices.at(1))[1] - DIM_BIAS;
+ m_MinZ = (*minm_vertices.at(2))[2] - DIM_BIAS;
- m_MaxX = (*maxm_vertices.at(0))[0] + 0.01;
- m_MaxY = (*maxm_vertices.at(1))[1] + 0.01;
- m_MaxZ = (*maxm_vertices.at(2))[2] + 0.01;
+ m_MaxX = (*maxm_vertices.at(0))[0] + DIM_BIAS;
+ m_MaxY = (*maxm_vertices.at(1))[1] + DIM_BIAS;
+ m_MaxZ = (*maxm_vertices.at(2))[2] + DIM_BIAS;
m_diagLength = sqrt(pow((m_MaxX-m_MinX), 2) +
pow((m_MaxY-m_MinY),2) +
@@ -44,10 +49,20 @@ Grid3D::Grid3D(KDTree tree, const size_t dim_x, const size_t dim_y, const size_t
float stepY = abs(m_MaxY - m_MinY) / dim_y;
float stepZ = abs(m_MaxZ - m_MinZ) / dim_z;
+
+
+ m_radius = (stepX + stepY + stepZ) / 3.0;
+ //std::cout << "StepX: " << std::setprecision(5) << stepX << "\n";
+ std::cout << "Diagonal: " << std::setprecision(5) << m_diagLength << "\n";
+
float xPos = m_MinX;
float yPos = m_MinY;
float zPos = m_MinZ;
+ std::cout << "xPos: " << xPos << "\n";
+ std::cout << "yPos: " << yPos << "\n";
+ std::cout << "zPos: " << zPos << "\n";
+
vec3f color(0.2, 0.8, 0.5);
for (size_t z = 0; z <= m_dimZ; z++)
@@ -56,7 +71,8 @@ Grid3D::Grid3D(KDTree tree, const size_t dim_x, const size_t dim_y, const size_t
{
for (size_t x = 0; x <= m_dimX; x++)
{
- m_GridVertices.push_back(VertexPtr(new Vertex(xPos, yPos, zPos, color, 0)));
+ VertexPtr vrtx = VertexPtr(new Vertex(xPos, yPos, zPos, color, DBL_MAX));
+ m_GridVertices.push_back(vrtx);
xPos += stepX;
}
@@ -69,118 +85,130 @@ Grid3D::Grid3D(KDTree tree, const size_t dim_x, const size_t dim_y, const size_t
}
generateVertices();
- //approximateWLS(m_GridVertices);
+ approximateWLS(m_GridVertices);
}
void Grid3D::generateVertices()
/* Create 2 more Points per point */
{
for(VertexPtr vertex: m_tree.getVertices()){
- double epsilon = 0.01 * m_diagLength;
+ double epsilon = 0.1 * m_diagLength;
while(m_tree.findInRadius(vertex, epsilon).size() > 1){
- //std::cout << "Size: " << m_tree.findInRadius(vertex, epsilon).size()<< "\n";
epsilon /= 2.0;
- //std::cout << "Epsilon: " << epsilon << "\n";
}
- VertexPtr point1(new Vertex((*vertex) + (*vertex->getNormal())));
- VertexPtr point2(new Vertex((*vertex) - (*vertex->getNormal())));
+ VertexPtr point1(new Vertex((*vertex) + (*vertex->getNormal()), epsilon));
+ VertexPtr point2(new Vertex((*vertex) - (*vertex->getNormal()), -epsilon));
m_generatedPoints.push_back(point1);
m_generatedPoints.push_back(point2);
+ m_generatedPoints.push_back(vertex);
}
- VertexList allPoints(m_generatedPoints);
- for(auto vrtx: m_GridVertices){
- allPoints.push_back(vrtx);
- }
- m_fullTree = KDTree(allPoints, 3);
+ m_fullTree = KDTree(m_generatedPoints, 3);
approximateWLS(m_GridVertices);
}
void Grid3D::approximateWLS(VertexList& resultList)
{
- int m = 2;
- int d = 2;
+ int m = 0;
+ int d = 3;
- int k = factorial(d + m) / (factorial(m) * factorial(d));
+ //int k = factorial(d + m) / (factorial(m) * factorial(d));
+ int k = 1;
+ std::cout << "K: " << k << "\n";
+ VectorXf b = VectorXf::Zero(1);
+ b << 1.0f;
//Single Approximation for every Grid point
for(VertexPtr pointDesired: resultList)
{
//Get Points used for this approximation
- //TODO: Should be a good automatic? radius -- maybe gridsize related
VertexList list = m_fullTree.findInRadius(pointDesired, m_radius);
MatrixXf bDimsMatSum = MatrixXf::Zero(k,k);
- VectorXf bDimsVecSum = VectorXf::Zero(k);
+ VectorXf bDimsVecSum = VectorXf::Zero(1);
- VectorXf b(k);
- for(VertexPtr point : list)
- {
- float x = (*point)[0];
- float y = (*point)[1];
- float z = (*point)[2];
- b << 1, x, y, z, x*x, x*y, y*y, x*z, y*z, z*z, x*y*z;
- Eigen::MatrixXf bDims(k,k);
- bDims = b*b.transpose();
- vec3f distVec = (*pointDesired) - (*point);
- float dist = norm(distVec);
- float wendFac = getWendland(dist);
- bDimsMatSum += (wendFac * bDims);
- bDimsVecSum += (wendFac * b*z);
+ //std::cout << "Size: " << list.size() << "\n";
+ if(list.size() > 0){
+ for(VertexPtr point : list)
+ {
+ double funValue = point->getFunValue();
+ //std::cout << "funvalue: " << std::setprecision(5) << funValue << "\n";
+ Eigen::MatrixXf bDims = MatrixXf::Zero(k,k);
+ bDims = b*b.transpose();
+ vec3f distVec = (*pointDesired) - (*point);
+ float dist = norm(distVec);
+ float wendFac = getWendland(dist);
+ bDimsMatSum += (wendFac * bDims);
+ bDimsVecSum += (wendFac * b*funValue);
+ }
+
+ //float x = (*pointDesired)[0];
+ //float y = (*pointDesired)[1];
+ //b << 1, x, y, x*x, x*y, y*y;
+
+ // constant polynom basis
+ /**
+ VectorXf b(1);
+ float x = (*pointDesired)[0];
+ float y = (*pointDesired)[1];
+ float z = (*pointDesired)[2];
+ b << 1;
+ **/
+
+ // linear polynom basis
+ /**
+ VectorXf b(4);
+ float x = (*pointDesired)[0];
+ float y = (*pointDesired)[1];
+ float z = (*pointDesired)[2];
+ b << 1, x, y, z;
+ **/
+
+ // quadratic polynom basis
+ /**
+ VectorXf b(10);
+ float x = (*pointDesired)[0];
+ float y = (*pointDesired)[1];
+ float z = (*pointDesired)[2];
+ b << 1, x, y, z, x*x, x*y, x*z, y*y, y*z, z*z;
+ **/
+
+ VectorXf c = VectorXf::Zero(k);
+ c = bDimsMatSum.inverse() * bDimsVecSum;
+ double funValue = b.dot(c);
+ NormalPtr normal = interpolateNormal(list);
+ pointDesired->setFunValue(funValue);
+ pointDesired->setNormal(normal);
+ if(funValue < 0.0f){
+ pointDesired->highlight(vec3f(1.0f, 0.0f, 0.0f));
+ }
}
+ //m_coefficients.push_back(c);
+ }
+}
- float x = (*pointDesired)[0];
- float y = (*pointDesired)[1];
- b << 1, x, y, x*x, x*y, y*y;
-
- // constant polynom basis
- /**
- VectorXf b(1);
- float x = (*pointDesired)[0];
- float y = (*pointDesired)[1];
- float z = (*pointDesired)[2];
- b << 1;
- **/
-
- // linear polynom basis
- /**
- VectorXf b(4);
- float x = (*pointDesired)[0];
- float y = (*pointDesired)[1];
- float z = (*pointDesired)[2];
- b << 1, x, y, z;
- **/
-
- // quadratic polynom basis
- /**
- VectorXf b(10);
- float x = (*pointDesired)[0];
- float y = (*pointDesired)[1];
- float z = (*pointDesired)[2];
- b << 1, x, y, z, x*x, x*y, x*z, y*y, y*z, z*z;
- **/
-
- VectorXf c(k);
- c = bDimsMatSum.inverse() * bDimsVecSum;
- pointDesired->setFunValue(b.dot(c));
- m_coefficients.push_back(c);
+NormalPtr Grid3D::interpolateNormal(VertexList vrtxList) const{
+ std::vector<NormalPtr> normals;
+ for(VertexPtr vrtx : vrtxList){
+ NormalPtr normal = vrtx->getNormal();
+ if(normal){
+ normals.push_back(normal);
+ }
+ }
+ //TODO: distance - dependent interpolation if necessary
+ double factor = 1.0/normals.size();
+ vec3f avgNormal;
+ for(NormalPtr normal : normals){
+ avgNormal = ((*normal)*factor)+avgNormal;
}
+ return NormalPtr(new Normal(avgNormal));
}
-void Grid3D::draw()
+void Grid3D::draw(bool useAlpha)
{
- glDisable(GL_LIGHTING);
- glColor3f(0, 0, 1);
-
- for (size_t i = 0; i < m_GridVertices.size(); i++)
+ for (VertexPtr vrtx : m_GridVertices)
{
- VertexPtr point = m_GridVertices.at(i);
-
- glBegin(GL_POINTS);
- glVertex3fv(point->_v);
- glEnd();
+ vrtx->draw(useAlpha);
}
-
- glEnable(GL_LIGHTING);
}
unsigned int Grid3D::factorial(const int num)
@@ -195,7 +223,75 @@ unsigned int Grid3D::factorial(const int num)
return result;
}
-// TODO PLACEHOLDER, REPLACE ME!
-double Grid3D::getImplicitFunctionValue(float x,float y,float z) {
- return x*x*4 + y*y*6 + z*z*8 - 1;
+
+//--- Getting values ---
+
+int Grid3D::getIndex(int idX,int idY,int idZ) {
+ if(idX<0 || idX>m_dimX || idY<0 || idY>m_dimY || idZ<0 || idZ>m_dimZ)
+ return -1;
+ return idZ*(m_dimX+1)*(m_dimY+1) + idY*(m_dimX+1) + idX;
+}
+
+shared_ptr<Vertex> Grid3D::getVertex(int idX,int idY,int idZ) {
+ int index = getIndex(idX,idY,idZ);
+ if(index<0)
+ return nullptr;
+ else
+ return m_GridVertices.at(index);
+}
+
+double Grid3D::getVertexValue(int idX,int idY,int idZ,int valueType) {
+ shared_ptr<Vertex> vertex = getVertex(idX,idY,idZ);
+ if(vertex==nullptr)
+ return OUTOFRANGE_DISTANCE;
+ else{
+ if(valueType == 0)
+ return vertex->getFunValue();
+ else{
+ if(vertex->getNormal()!=nullptr)
+ return (*vertex->getNormal())[0];
+ else
+ return 0;
+ }
+ }
+}
+
+
+double Grid3D::getInterpolatedFunctionValue(float x,float y,float z,int valueType) {
+ if(m_interpolate) {
+ int iX = (int)x;
+ int iY = (int)y;
+ int iZ = (int)z;
+ float u = x-iX;
+ float v = y-iY;
+ float w = z-iZ;
+ float uR = 1-u;
+ float vR = 1-v;
+ float wR = 1-w;
+ float sum = 0;
+ sum += getVertexValue(iX,iY,iZ,valueType) * uR*vR*wR;
+ sum += getVertexValue(iX+1,iY,iZ,valueType) * u*vR*wR;
+ sum += getVertexValue(iX,iY+1,iZ,valueType) * uR*v*wR;
+ sum += getVertexValue(iX+1,iY+1,iZ,valueType) * u*v*wR;
+ sum += getVertexValue(iX,iY,iZ+1,valueType) * uR*vR*w;
+ sum += getVertexValue(iX+1,iY,iZ+1,valueType) * u*vR*w;
+ sum += getVertexValue(iX,iY+1,iZ+1,valueType) * uR*v*w;
+ sum += getVertexValue(iX+1,iY+1,iZ+1,valueType) * u*v*w;
+ return sum;
+ }else{
+ return getVertexValue((int)x,(int)y,(int)z,valueType);
+ }
+}
+
+double Grid3D::getImplicitFunctionValueWorldCoordinates(float x,float y,float z,int valueType) {
+ //if(x<m_MinX || x>m_MaxX || y<m_MinY || y>m_MaxY || z<m_MinZ || z>m_MaxZ)
+ // return OUTOFRANGE_DISTANCE;
+ //else
+ // return -0.5f;
+ x = (x - m_MinX)/(m_MaxX-m_MinX) * (m_dimX);
+ y = (y - m_MinY)/(m_MaxY-m_MinY) * (m_dimY);
+ z = (z - m_MinZ)/(m_MaxZ-m_MinZ) * (m_dimZ);
+ return getInterpolatedFunctionValue(x,y,z,valueType);
+
+//return x*x*4 + y*y*6 + z*z*8 - 1;
}
View
420 src/MarchingCube.cpp
@@ -0,0 +1,420 @@
+#include "MarchingCube.hpp"
+#ifdef __APPLE__
+ #include <GL/glew.h>
+ #include <GLUT/glut.h>
+#else
+ #include <GL/glew.h>
+ #include <GL/glut.h>
+#endif
+
+static int8 aCases[256][13]=
+{
+ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+ { 8, 3, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+ { 9, 0, 1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+ { 8, 3, 1, 8, 1, 9,-1,-1,-1,-1,-1,-1,-1},
+ {10, 1, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+ { 8, 3, 0, 1, 2,10,-1,-1,-1,-1,-1,-1,-1},
+ { 9, 0, 2, 9, 2,10,-1,-1,-1,-1,-1,-1,-1},
+ { 3, 2, 8, 2,10, 8, 8,10, 9,-1,-1,-1,-1},
+ {11, 2, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+ {11, 2, 0,11, 0, 8,-1,-1,-1,-1,-1,-1,-1},
+ {11, 2, 3, 0, 1, 9,-1,-1,-1,-1,-1,-1,-1},
+ { 2, 1,11, 1, 9,11,11, 9, 8,-1,-1,-1,-1},
+ {10, 1, 3,10, 3,11,-1,-1,-1,-1,-1,-1,-1},
+ { 1, 0,10, 0, 8,10,10, 8,11,-1,-1,-1,-1},
+ { 0, 3, 9, 3,11, 9, 9,11,10,-1,-1,-1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