[Bf-blender-cvs] [5fbf41a] soc-2014-nurbs: Whoops, I forgot to make git track the GridMesh GLUT code. Here it is.
Jonathan deWerd
noreply at git.blender.org
Fri Jun 27 08:14:43 CEST 2014
Commit: 5fbf41a822109f50776c48c2618a256dad415da7
Author: Jonathan deWerd
Date: Tue Jun 24 21:57:33 2014 -0400
https://developer.blender.org/rB5fbf41a822109f50776c48c2618a256dad415da7
Whoops, I forgot to make git track the GridMesh GLUT code. Here it is.
===================================================================
M PolyTest.xcodeproj/project.pbxproj
M PolyTest/GridMesh.cpp
M PolyTest/GridMesh.h
A PolyTest/GridMesh_demo.cpp
===================================================================
diff --git a/PolyTest.xcodeproj/project.pbxproj b/PolyTest.xcodeproj/project.pbxproj
index d1956ea..f27fed6 100644
--- a/PolyTest.xcodeproj/project.pbxproj
+++ b/PolyTest.xcodeproj/project.pbxproj
@@ -11,9 +11,13 @@
FC354571194BDF7300F3D236 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC354570194BDF7300F3D236 /* OpenGL.framework */; };
FC354573194BDF7E00F3D236 /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC354572194BDF7E00F3D236 /* GLUT.framework */; };
FC458BC71953F95A00E260AC /* GridMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FC458BC51953F95A00E260AC /* GridMesh.cpp */; };
+ FC4C01831959FA25005025E0 /* GridMesh_demo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FC4C01821959FA25005025E0 /* GridMesh_demo.cpp */; };
FC67C07A19514DE10077AB72 /* rast_demo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FC67C07919514DE10077AB72 /* rast_demo.cpp */; };
FC67C08019515CBB0077AB72 /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC354572194BDF7E00F3D236 /* GLUT.framework */; };
FC67C08119515CBF0077AB72 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC354570194BDF7300F3D236 /* OpenGL.framework */; };
+ FCCF3BC7195A205400CCA487 /* GridMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FC458BC51953F95A00E260AC /* GridMesh.cpp */; };
+ FCCF3BC8195A207E00CCA487 /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC354572194BDF7E00F3D236 /* GLUT.framework */; };
+ FCCF3BC9195A208200CCA487 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC354570194BDF7300F3D236 /* OpenGL.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -26,6 +30,15 @@
);
runOnlyForDeploymentPostprocessing = 1;
};
+ FC4C017E1959FA25005025E0 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = /usr/share/man/man1/;
+ dstSubfolderSpec = 0;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
FC67C07519514DE00077AB72 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@@ -45,6 +58,8 @@
FC354572194BDF7E00F3D236 /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = System/Library/Frameworks/GLUT.framework; sourceTree = SDKROOT; };
FC458BC51953F95A00E260AC /* GridMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GridMesh.cpp; sourceTree = "<group>"; };
FC458BC61953F95A00E260AC /* GridMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GridMesh.h; sourceTree = "<group>"; };
+ FC4C01801959FA25005025E0 /* GridMesh_demo */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = GridMesh_demo; sourceTree = BUILT_PRODUCTS_DIR; };
+ FC4C01821959FA25005025E0 /* GridMesh_demo.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GridMesh_demo.cpp; sourceTree = "<group>"; };
FC67C07719514DE10077AB72 /* rast_demo */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = rast_demo; sourceTree = BUILT_PRODUCTS_DIR; };
FC67C07919514DE10077AB72 /* rast_demo.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = rast_demo.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -59,6 +74,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ FC4C017D1959FA25005025E0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ FCCF3BC9195A208200CCA487 /* OpenGL.framework in Frameworks */,
+ FCCF3BC8195A207E00CCA487 /* GLUT.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
FC67C07419514DE00077AB72 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -86,6 +110,7 @@
children = (
FC354561194BDED000F3D236 /* PolyTest */,
FC67C07719514DE10077AB72 /* rast_demo */,
+ FC4C01801959FA25005025E0 /* GridMesh_demo */,
);
name = Products;
sourceTree = "<group>";
@@ -96,6 +121,7 @@
FC35456F194BDF3700F3D236 /* poly.h */,
FC35456D194BDF2300F3D236 /* poly_demo.cpp */,
FC67C07919514DE10077AB72 /* rast_demo.cpp */,
+ FC4C01821959FA25005025E0 /* GridMesh_demo.cpp */,
FC458BC51953F95A00E260AC /* GridMesh.cpp */,
FC458BC61953F95A00E260AC /* GridMesh.h */,
);
@@ -122,6 +148,23 @@
productReference = FC354561194BDED000F3D236 /* PolyTest */;
productType = "com.apple.product-type.tool";
};
+ FC4C017F1959FA25005025E0 /* GridMesh_demo */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = FC4C01881959FA25005025E0 /* Build configuration list for PBXNativeTarget "GridMesh_demo" */;
+ buildPhases = (
+ FC4C017C1959FA25005025E0 /* Sources */,
+ FC4C017D1959FA25005025E0 /* Frameworks */,
+ FC4C017E1959FA25005025E0 /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = GridMesh_demo;
+ productName = GridMesh_demo;
+ productReference = FC4C01801959FA25005025E0 /* GridMesh_demo */;
+ productType = "com.apple.product-type.tool";
+ };
FC67C07619514DE00077AB72 /* rast_demo */ = {
isa = PBXNativeTarget;
buildConfigurationList = FC67C07F19514DE10077AB72 /* Build configuration list for PBXNativeTarget "rast_demo" */;
@@ -162,6 +205,7 @@
targets = (
FC354560194BDED000F3D236 /* PolyTest */,
FC67C07619514DE00077AB72 /* rast_demo */,
+ FC4C017F1959FA25005025E0 /* GridMesh_demo */,
);
};
/* End PBXProject section */
@@ -175,6 +219,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ FC4C017C1959FA25005025E0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ FCCF3BC7195A205400CCA487 /* GridMesh.cpp in Sources */,
+ FC4C01831959FA25005025E0 /* GridMesh_demo.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
FC67C07319514DE00077AB72 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -279,6 +332,24 @@
};
name = Release;
};
+ FC4C01861959FA25005025E0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ FC4C01871959FA25005025E0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
FC67C07D19514DE10077AB72 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -318,6 +389,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ FC4C01881959FA25005025E0 /* Build configuration list for PBXNativeTarget "GridMesh_demo" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ FC4C01861959FA25005025E0 /* Debug */,
+ FC4C01871959FA25005025E0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
FC67C07F19514DE10077AB72 /* Build configuration list for PBXNativeTarget "rast_demo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
diff --git a/PolyTest/GridMesh.cpp b/PolyTest/GridMesh.cpp
index ade9cef..823d601 100644
--- a/PolyTest/GridMesh.cpp
+++ b/PolyTest/GridMesh.cpp
@@ -7,52 +7,32 @@
//
#include <cmath>
+#include <cstdlib>
+#include <map>
#include "GridMesh.h"
static bool debug = 1;
float GridMesh::tolerance = 1e-5;
-
-/*struct GridMesh {
- // Vertex storage. Example: "int prev" in a GreinerV2f refers to v[prev].
- // v[0] is defined to be invalid and filled with the telltale location (-42,-42)
- GreinerV2f *v;
- float llx, lly, urx, ury; // Coordinates of lower left and upper right grid corners
- float inv_dx, inv_dy; // 1/(width of a cell), 1/(height of a cell)
- int nx, ny; // Number of cells in the x and y directions
-
- GridMesh(float lowerleft_x, float lowerleft_y,
- float upperright_x, float upperright_y,
- int num_x_cells, int num_y_cells);
-
- void merge_poly(GreinerV2f *mpoly);
-
- GreinerV2f *vert_new();
- int vert_id(GreinerV2f *vert) {return int(vert-v);}
- GreinerV2f *poly_for_cell(int x, int y, bool *isTrivial);
- GreinerV2f *poly_for_cell(float x, float y, bool *isTrivial);
- GreinerV2f *poly_first_vert(GreinerV2f *anyvert);
- GreinerV2f *poly_last_vert(GreinerV2f *anyvert);
- bool poly_is_cyclic(GreinerV2f *poly);
- bool poly_set_cyclic(GreinerV2f *poly);
-};*/
-
-
-
-GridMesh::GridMesh(float lowerleft_x, float lowerleft_y,
- float upperright_x, float upperright_y,
- int num_x_cells, int num_y_cells) {
+void GridMesh::set_ll_ur(double lowerleft_x, double lowerleft_y,
+ double upperright_x, double upperright_y) {
llx = lowerleft_x; lly = lowerleft_y;
urx = upperright_x; ury = upperright_y;
- nx = num_x_cells; ny = num_y_cells;
double Dx = urx-llx;
double Dy = ury-lly;
dx = Dx/nx;
dy = Dy/ny;
inv_dx = 1.0/dx;
inv_dy = 1.0/dy;
+}
+
+GridMesh::GridMesh(double lowerleft_x, double lowerleft_y,
+ double upperright_x, double upperright_y,
+ int num_x_cells, int num_y_cells) {
+ nx = num_x_cells; ny = num_y_cells;
+ set_ll_ur(lowerleft_x, lowerleft_y, upperright_x, upperright_y);
v_capacity = nx*ny*4 + 256;
- v_count = nx*ny*4;
+ v_count = nx*ny*4+1;
v = (GreinerV2f*)malloc(sizeof(GreinerV2f)*v_capacity);
new (v) GreinerV2f();
v->x = v->y = -1234;
@@ -67,9 +47,9 @@ GridMesh::GridMesh(float lowerleft_x, float lowerleft_y,
GreinerV2f *v3 = v1+2;
GreinerV2f *v4 = v1+3;
new (v1) GreinerV2f(); v1->x=l; v1->y=b;
- new (v2) GreinerV2f(); v1->x=r; v1->y=b;
- new (v3) GreinerV2f(); v1->x=r; v1->y=t;
- new (v4) GreinerV2f(); v1->x=l; v1->y=t;
+ new (v2) GreinerV2f(); v2->x=r; v2->y=b;
+ new (v3) GreinerV2f(); v3->x=r; v3->y=t;
+ new (v4) GreinerV2f(); v4->x=l; v4->y=t;
int iv1 = vert_id(v1);
int iv2 = iv1+1;
int iv3 = iv1+2;
@@ -155,8 +135,8 @@ Greine
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list