5 #ifndef BALL_MATHS_SURFACE_H
6 #define BALL_MATHS_SURFACE_H
8 #ifndef BALL_MATHS_VECTOR3_H
48 return (v1 == triangle.
v1) && (v2 == triangle.
v2) && (v3 == triangle.
v3);
54 return !(v1 == triangle.
v1) && (v2 == triangle.
v2) && (v3 == triangle.
v3);
197 #ifdef BALL_COMPILER_MSVC
201 template <
typename T>
206 template <
typename T>
208 : vertex(surface.vertex),
209 normal(surface.normal),
210 triangle(surface.triangle)
214 template <
typename T>
219 template <
typename T>
227 template <
typename T>
235 template <
typename T>
244 template <
typename T>
252 template <
typename T>
260 std::ifstream file(vert_filename.c_str());
279 vertex.push_back(
Vertex(s[0].toFloat(), s[1].toFloat(), s[2].toFloat()));
280 normal.push_back(
Normal(s[3].toFloat(), s[4].toFloat(), s[5].toFloat()));
290 file.open(face_filename.c_str());
304 Size number_of_vertices = (
Size)vertex.size();
309 t.
v1 = (
Index)s[0].toInt() - 1;
310 t.
v2 = (
Index)s[1].toInt() - 1;
311 t.
v3 = (
Index)s[2].toInt() - 1;
314 if ((t.
v1 < (
Index)number_of_vertices) && (t.
v1 >= 0)
315 && (t.
v1 < (
Index)number_of_vertices) && (t.
v1 >= 0)
316 && (t.
v1 < (
Index)number_of_vertices) && (t.
v1 >= 0))
318 triangle.push_back(t);
327 template <
typename T>
332 for (
Size i = 0; i < triangle.size(); i++)
336 area += ((vertex[triangle[i].v2] - vertex[triangle[i].v1]) % (vertex[triangle[i].v3] - vertex[triangle[i].v1])).getLength();
340 return (
float)( area * 0.5 );
343 template <
typename T>
346 return ((surface.
vertex == vertex)
347 && (surface.
normal == normal)
351 template <
typename T>
355 return (
Size)triangle.size();
358 template <
typename T>
362 return (
Size)vertex.size();
365 template <
typename T>
369 return (
Size)normal.size();
372 template <
typename T>
376 return triangle[index];
379 template <
typename T>
383 return triangle[index];
386 template <
typename T>
393 template <
typename T>
397 triangle.resize(size);
400 template <
typename T>
404 triangle.push_back(t);
408 template <
typename T>
412 return vertex[index];
415 template <
typename T>
419 return vertex[index];
422 template <
typename T>
429 template <
typename T>
437 template <
typename T>
441 vertex.push_back(position);
444 template <
typename T>
448 return normal[index];
451 template <
typename T>
455 return normal[index];
458 template <
typename T>
465 template <
typename T>
472 template <
typename T>
479 template <
typename T>
482 return !(*
this == surface);
492 #endif // BALL_MATHS_SURFACE_H