STLTriangle.h
Go to the documentation of this file.
1 // This file is part of the MercuryDPM project (https://www.mercurydpm.org).
2 // Copyright (c), The MercuryDPM Developers Team. All rights reserved.
3 // License: BSD 3-Clause License; see the LICENSE file in the root directory.
4 
5 #ifndef STLTRIANGLE_H
6 #define STLTRIANGLE_H
7 
8 #include "Math/Vector.h"
9 
10 class STLTriangle
11 {
12 public:
14  {};
15 
16  STLTriangle(const Vec3D newNormal, const Vec3D newVertex1, const Vec3D newVertex2, const Vec3D newVertex3)
17  {
18  normal = newNormal;
19  vertex1 = newVertex1;
20  vertex2 = newVertex2;
21  vertex3 = newVertex3;
22  }
23 
24  bool isEqualTo(const STLTriangle answer, double toll)
25  {
26  if (!normal.isEqualTo(answer.normal, toll)) return false;
27  if (!vertex1.isEqualTo(answer.vertex1, toll)) return false;
28  if (!vertex2.isEqualTo(answer.vertex2, toll)) return false;
29  if (!vertex3.isEqualTo(answer.vertex3, toll)) return false;
30  return true;
31  }
32 
33  Vec3D normal;
34  Vec3D vertex1;
35  Vec3D vertex2;
36  Vec3D vertex3;
37 
38 };
39 
40 #endif //STLTRIANGLE_H
Test of the STL reader. The files used is STL file with containing 12 triange that a 1 by 1 by 1 squa...
Definition: BinaryReaderSTL1by1by1bySquareUnitTest.cpp:18
STLTriangle(const Vec3D newNormal, const Vec3D newVertex1, const Vec3D newVertex2, const Vec3D newVertex3)
Definition: STLTriangle.h:16
Vec3D vertex2
Definition: BinaryReaderSTL1by1by1bySquareUnitTest.cpp:41
Vec3D vertex3
Definition: BinaryReaderSTL1by1by1bySquareUnitTest.cpp:42
bool isEqualTo(const STLTriangle answer, double toll)
Definition: STLTriangle.h:24
Vec3D vertex1
Definition: BinaryReaderSTL1by1by1bySquareUnitTest.cpp:40
Vec3D normal
Definition: BinaryReaderSTL1by1by1bySquareUnitTest.cpp:39
STLTriangle()
Definition: STLTriangle.h:13
Definition: Kernel/Math/Vector.h:30
bool isEqualTo(const Vec3D &other, double tol) const
Checks if the length this Vec3D is equal the length of other with a certain tolerance.
Definition: Vector.cc:313