├── Debug
├── QSlimCros.exe
├── QSlimCros.ilk
└── QSlimCros.pdb
├── QSlimCros.sdf
├── QSlimCros.sln
├── QSlimCros.suo
├── QSlimCros
├── Debug
│ ├── CL.read.1.tlog
│ ├── CL.write.1.tlog
│ ├── QSlim.obj
│ ├── QSlimBase.obj
│ ├── QSlimCros.Build.CppClean.log
│ ├── QSlimCros.exe.intermediate.manifest
│ ├── QSlimCros.lastbuildstate
│ ├── QSlimCros.log
│ ├── QSlimCros.write.1.tlog
│ ├── cl.command.1.tlog
│ ├── link.command.1.tlog
│ ├── link.read.1.tlog
│ ├── link.write.1.tlog
│ ├── main.obj
│ ├── mt.command.1.tlog
│ ├── mt.read.1.tlog
│ ├── mt.write.1.tlog
│ ├── vc100.idb
│ └── vc100.pdb
├── Mesh.h
├── QSlim.cpp
├── QSlim.h
├── QSlimCros.vcxproj
├── QSlimCros.vcxproj.filters
├── QSlimCros.vcxproj.user
├── Release
│ ├── CL.read.1.tlog
│ ├── CL.write.1.tlog
│ ├── QSlim.obj
│ ├── QSlimBase.obj
│ ├── QSlimCros.Build.CppClean.log
│ ├── QSlimCros.exe.intermediate.manifest
│ ├── QSlimCros.lastbuildstate
│ ├── QSlimCros.log
│ ├── QSlimCros.vcxprojResolveAssemblyReference.cache
│ ├── QSlimCros.write.1.tlog
│ ├── cl.command.1.tlog
│ ├── link.command.1.tlog
│ ├── link.read.1.tlog
│ ├── link.write.1.tlog
│ ├── main.obj
│ ├── mt.command.1.tlog
│ ├── mt.read.1.tlog
│ ├── mt.write.1.tlog
│ └── vc100.pdb
└── main.cpp
├── README.md
├── Release
├── QSlimCros.exe
└── QSlimCros.pdb
└── ipch
└── qslimcros-8cef9581
└── qslimcros-3f8e8143.ipch
/Debug/QSlimCros.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/Debug/QSlimCros.exe
--------------------------------------------------------------------------------
/Debug/QSlimCros.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/Debug/QSlimCros.ilk
--------------------------------------------------------------------------------
/Debug/QSlimCros.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/Debug/QSlimCros.pdb
--------------------------------------------------------------------------------
/QSlimCros.sdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros.sdf
--------------------------------------------------------------------------------
/QSlimCros.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QSlimCros", "QSlimCros\QSlimCros.vcxproj", "{AAC1ED99-C116-4FA9-A71D-58E05A7D79D0}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {AAC1ED99-C116-4FA9-A71D-58E05A7D79D0}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {AAC1ED99-C116-4FA9-A71D-58E05A7D79D0}.Debug|Win32.Build.0 = Debug|Win32
14 | {AAC1ED99-C116-4FA9-A71D-58E05A7D79D0}.Release|Win32.ActiveCfg = Release|Win32
15 | {AAC1ED99-C116-4FA9-A71D-58E05A7D79D0}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/QSlimCros.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros.suo
--------------------------------------------------------------------------------
/QSlimCros/Debug/CL.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/CL.read.1.tlog
--------------------------------------------------------------------------------
/QSlimCros/Debug/CL.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/CL.write.1.tlog
--------------------------------------------------------------------------------
/QSlimCros/Debug/QSlim.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/QSlim.obj
--------------------------------------------------------------------------------
/QSlimCros/Debug/QSlimBase.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/QSlimBase.obj
--------------------------------------------------------------------------------
/QSlimCros/Debug/QSlimCros.Build.CppClean.log:
--------------------------------------------------------------------------------
1 | F:\WORKSPACECSHARP\C++PROJ\QSLIMCROS\DEBUG\QSLIMCROS.EXE
2 | F:\WORKSPACECSHARP\C++PROJ\QSLIMCROS\DEBUG\QSLIMCROS.ILK
3 | F:\WORKSPACECSHARP\C++PROJ\QSLIMCROS\DEBUG\QSLIMCROS.PDB
4 | F:\workspacecsharp\C++Proj\QSlimCros\QSlimCros\Debug\cl.command.1.tlog
5 | F:\workspacecsharp\C++Proj\QSlimCros\QSlimCros\Debug\CL.read.1.tlog
6 | F:\workspacecsharp\C++Proj\QSlimCros\QSlimCros\Debug\CL.write.1.tlog
7 | F:\workspacecsharp\C++Proj\QSlimCros\QSlimCros\Debug\link.command.1.tlog
8 | F:\workspacecsharp\C++Proj\QSlimCros\QSlimCros\Debug\link.read.1.tlog
9 | F:\workspacecsharp\C++Proj\QSlimCros\QSlimCros\Debug\link.write.1.tlog
10 | F:\WORKSPACECSHARP\C++PROJ\QSLIMCROS\QSLIMCROS\DEBUG\MAIN.OBJ
11 | F:\workspacecsharp\C++Proj\QSlimCros\QSlimCros\Debug\mt.command.1.tlog
12 | F:\workspacecsharp\C++Proj\QSlimCros\QSlimCros\Debug\mt.read.1.tlog
13 | F:\workspacecsharp\C++Proj\QSlimCros\QSlimCros\Debug\mt.write.1.tlog
14 | F:\WORKSPACECSHARP\C++PROJ\QSLIMCROS\QSLIMCROS\DEBUG\QSLIM.OBJ
15 | F:\WORKSPACECSHARP\C++PROJ\QSLIMCROS\QSLIMCROS\DEBUG\QSLIMBASE.OBJ
16 | F:\WORKSPACECSHARP\C++PROJ\QSLIMCROS\QSLIMCROS\DEBUG\QSLIMCROS.EXE.INTERMEDIATE.MANIFEST
17 | F:\workspacecsharp\C++Proj\QSlimCros\QSlimCros\Debug\QSlimCros.write.1.tlog
18 | F:\workspacecsharp\C++Proj\QSlimCros\QSlimCros\Debug\vc100.idb
19 | F:\WORKSPACECSHARP\C++PROJ\QSLIMCROS\QSLIMCROS\DEBUG\VC100.PDB
20 |
--------------------------------------------------------------------------------
/QSlimCros/Debug/QSlimCros.exe.intermediate.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/QSlimCros/Debug/QSlimCros.lastbuildstate:
--------------------------------------------------------------------------------
1 | #v4.0:v100:false
2 | Debug|Win32|F:\workspacecsharp\C++Proj\QSlimCros\|
3 |
--------------------------------------------------------------------------------
/QSlimCros/Debug/QSlimCros.log:
--------------------------------------------------------------------------------
1 | Build started 2014/1/27 21:54:46.
2 | 1>Project "F:\workspacecsharp\C++Proj\QSlimCros\QSlimCros\QSlimCros.vcxproj" on node 2 (build target(s)).
3 | 1>InitializeBuildStatus:
4 | Creating "Debug\QSlimCros.unsuccessfulbuild" because "AlwaysCreate" was specified.
5 | ClCompile:
6 | D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /Od /Oy- /D _MBCS /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt main.cpp
7 | main.cpp
8 | 1>f:\workspacecsharp\c++proj\qslimcros\qslimcros\main.cpp(83): warning C4244: 'argument' : conversion from 'real' to 'float', possible loss of data
9 | 1>f:\workspacecsharp\c++proj\qslimcros\qslimcros\main.cpp(83): warning C4244: 'argument' : conversion from 'real' to 'float', possible loss of data
10 | 1>f:\workspacecsharp\c++proj\qslimcros\qslimcros\main.cpp(83): warning C4244: 'argument' : conversion from 'real' to 'float', possible loss of data
11 | Link:
12 | D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"F:\workspacecsharp\C++Proj\QSlimCros\Debug\QSlimCros.exe" /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"Debug\QSlimCros.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"F:\workspacecsharp\C++Proj\QSlimCros\Debug\QSlimCros.pdb" /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"F:\workspacecsharp\C++Proj\QSlimCros\Debug\QSlimCros.lib" /MACHINE:X86 Debug\main.obj
13 | Debug\QSlim.obj
14 | Debug\QSlimBase.obj
15 | LINK : F:\workspacecsharp\C++Proj\QSlimCros\Debug\QSlimCros.exe not found or not built by the last incremental link; performing full link
16 | QSlimCros.vcxproj -> F:\workspacecsharp\C++Proj\QSlimCros\Debug\QSlimCros.exe
17 | Manifest:
18 | C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\mt.exe /nologo /verbose /outputresource:"F:\workspacecsharp\C++Proj\QSlimCros\Debug\QSlimCros.exe;#1" /manifest Debug\QSlimCros.exe.intermediate.manifest
19 | FinalizeBuildStatus:
20 | Deleting file "Debug\QSlimCros.unsuccessfulbuild".
21 | Touching "Debug\QSlimCros.lastbuildstate".
22 | 1>Done Building Project "F:\workspacecsharp\C++Proj\QSlimCros\QSlimCros\QSlimCros.vcxproj" (build target(s)).
23 |
24 | Build succeeded.
25 |
26 | Time Elapsed 00:00:00.97
27 |
--------------------------------------------------------------------------------
/QSlimCros/Debug/QSlimCros.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/QSlimCros.write.1.tlog
--------------------------------------------------------------------------------
/QSlimCros/Debug/cl.command.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/cl.command.1.tlog
--------------------------------------------------------------------------------
/QSlimCros/Debug/link.command.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/link.command.1.tlog
--------------------------------------------------------------------------------
/QSlimCros/Debug/link.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/link.read.1.tlog
--------------------------------------------------------------------------------
/QSlimCros/Debug/link.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/link.write.1.tlog
--------------------------------------------------------------------------------
/QSlimCros/Debug/main.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/main.obj
--------------------------------------------------------------------------------
/QSlimCros/Debug/mt.command.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/mt.command.1.tlog
--------------------------------------------------------------------------------
/QSlimCros/Debug/mt.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/mt.read.1.tlog
--------------------------------------------------------------------------------
/QSlimCros/Debug/mt.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/mt.write.1.tlog
--------------------------------------------------------------------------------
/QSlimCros/Debug/vc100.idb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/vc100.idb
--------------------------------------------------------------------------------
/QSlimCros/Debug/vc100.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chnhideyoshi/SimplifiedQSlimLibrary/a982f7ea23b1097b4182d434295a178d2b2dd9fe/QSlimCros/Debug/vc100.pdb
--------------------------------------------------------------------------------
/QSlimCros/Mesh.h:
--------------------------------------------------------------------------------
1 | #ifndef BASE_H
2 | #define BASE_H
3 | #define _CRT_SECURE_NO_WARNINGS
4 | #include
5 | #include
6 | struct Point3d
7 | {
8 | public:
9 | float X;
10 | float Y;
11 | float Z;
12 | Point3d()
13 | {
14 | X = 0;
15 | Y = 0;
16 | Z = 0;
17 | }
18 | ~Point3d()
19 | {
20 | }
21 | Point3d(float x, float y, float z)
22 | {
23 | this->X = x;
24 | this->Y = y;
25 | this->Z = z;
26 | }
27 | };
28 | struct Triangle
29 | {
30 | public :
31 | int P0Index;
32 | int P1Index;
33 | int P2Index;
34 | Triangle(int p0index, int p1index, int p2index)
35 | {
36 | this->P0Index=p0index;
37 | this->P1Index=p1index;
38 | this->P2Index=p2index;
39 | }
40 | Triangle()
41 | {
42 | P0Index=-1;
43 | P1Index=-1;
44 | P2Index=-1;
45 | }
46 | };
47 | struct Vector
48 | {
49 | public:
50 | float X;
51 | float Y;
52 | float Z;
53 | Vector()
54 | {
55 | X = 0;
56 | Y = 0;
57 | Z = 0;
58 | }
59 | ~Vector()
60 | {
61 | }
62 | Vector(float x, float y, float z)
63 | {
64 | this->X = x;
65 | this->Y = y;
66 | this->Z = z;
67 | }
68 | };
69 | Vector CaculateTriangleNormal(Point3d& p0, Point3d& p1, Point3d& p2)
70 | {
71 | Vector Normal;
72 | float v1x = p1.X - p0.X;
73 | float v1y = p1.Y - p0.Y;
74 | float v1z = p1.Z - p0.Z;
75 | float v2x = p2.X - p1.X;
76 | float v2y = p2.Y - p1.Y;
77 | float v2z = p2.Z - p1.Z;
78 | Normal.X= v1y * v2z - v1z * v2y;
79 | Normal.Y = v1z * v2x - v1x * v2z;
80 | Normal.Z = v1x * v2y - v1y * v2x;
81 | float len = (float)sqrt(Normal.X * Normal.X + Normal.Y * Normal.Y + Normal.Z * Normal.Z);
82 | if (len == 0)
83 | {
84 | }
85 | else
86 | {
87 | Normal.X /= len;
88 | Normal.Y /= len;
89 | Normal.Z /= len;
90 | }
91 | return Normal;
92 | }
93 | class Mesh
94 | {
95 | public:
96 | std::vector Vertices;
97 | std::vector Faces;
98 | std::vector FaceNormals;
99 | std::vector VertexNormals;
100 | std::vector*> AdjacentFacesPerVertex;
101 | std::vector*> AdjacentVerticesPerVertex;
102 | Mesh()
103 | {
104 | }
105 | ~Mesh()
106 | {
107 | }
108 | int AddVertex(Point3d& toAdd)
109 | {
110 | int index = Vertices.size();
111 | Vertices.push_back(toAdd);
112 | return index;
113 | }
114 | int AddFace(Triangle& tri)
115 | {
116 | int index = Faces.size();
117 | Faces.push_back(tri);
118 | return index;
119 | }
120 | void CaculateFaceNormals()
121 | {
122 | FaceNormals.reserve(Faces.size());
123 | for(size_t i=0;i& tlist = *(AdjacentFacesPerVertex[i]);
145 | if(tlist.size()!=0)
146 | {
147 | for (size_t j = 0; i < tlist.size(); j++)
148 | {
149 | sumx += FaceNormals[tlist[j]].X;
150 | sumy += FaceNormals[tlist[j]].Y;
151 | sumz += FaceNormals[tlist[j]].Z;
152 | }
153 | VertexNormals.push_back(Vector(sumx / tlist.size(), sumy / tlist.size(), sumz /tlist.size()));
154 | }
155 | else
156 | {
157 | VertexNormals.push_back(Vector(0,0,0));
158 | }
159 | }
160 | }
161 | void CaculateAdjacentFacesPerVertex()
162 | {
163 | AdjacentFacesPerVertex.reserve(Vertices.size());
164 | for (size_t i = 0; i < Vertices.size(); i++)
165 | {
166 | std::vector* list=new std::vector();
167 | list->reserve(4);
168 | AdjacentFacesPerVertex.push_back(list);
169 | }
170 | for (size_t i = 0; i < Faces.size(); i++)
171 | {
172 | Triangle& t = Faces[i];
173 | std::vector *t0list= AdjacentFacesPerVertex[t.P0Index];
174 | std::vector *t1list= AdjacentFacesPerVertex[t.P1Index];
175 | std::vector *t2list= AdjacentFacesPerVertex[t.P2Index];
176 | t0list->push_back(i);
177 | t1list->push_back(i);
178 | t2list->push_back(i);
179 | }
180 | }
181 | void CaculateAdjacentVerticesPerVertex()
182 | {
183 | AdjacentVerticesPerVertex.reserve(Vertices.size());
184 | for (size_t i = 0; i < Vertices.size(); i++)
185 | {
186 | std::vector* list=new std::vector();
187 | list->reserve(4);
188 | AdjacentVerticesPerVertex.push_back(list);
189 | }
190 | for (size_t i = 0; i < Faces.size(); i++)
191 | {
192 | Triangle &t = Faces[i];
193 | std::vector *p0list= AdjacentVerticesPerVertex[t.P0Index];
194 | std::vector *p1list= AdjacentVerticesPerVertex[t.P1Index];
195 | std::vector *p2list= AdjacentVerticesPerVertex[t.P2Index];
196 | if (std::find(p0list->begin(), p0list->end(), t.P1Index)==p0list->end())
197 | p0list->push_back(t.P1Index);
198 | if (std::find(p0list->begin(), p0list->end(), t.P2Index)==p0list->end())
199 | p0list->push_back(t.P2Index);
200 | if (std::find(p1list->begin(), p1list->end(), t.P0Index)==p1list->end())
201 | p1list->push_back(t.P0Index);
202 | if (std::find(p1list->begin(), p1list->end(), t.P2Index)==p1list->end())
203 | p1list->push_back(t.P2Index);
204 | if (std::find(p2list->begin(), p2list->end(), t.P0Index)==p2list->end())
205 | p2list->push_back(t.P0Index);
206 | if (std::find(p2list->begin(), p2list->end(), t.P1Index)==p2list->end())
207 | p2list->push_back(t.P1Index);
208 | }
209 | }
210 | void LaplacianSmooth(int time)
211 | {
212 | if(AdjacentVerticesPerVertex.size()==0)
213 | CaculateAdjacentVerticesPerVertex();
214 | Point3d* tempPos=new Point3d[Vertices.size()];
215 | for(int k=0;k