51#include <unordered_map>
86 msh3Mesh(
double robotResolution,
bool convertMMtoM);
177 int AddMeshFile(
const std::string &meshFilePath);
180 void FindFaceNeighbor(
int faceIdx, std::unordered_multimap<std::string, int>& map);
184 std::string VertexToKey(
const int& vertex1,
const int& vertex2,
const vctInt3& triangle);
191 inline bool CheckConvexity(
int idx,
int idxNeighbor) {
192 vct3 vec1 = {0.0, 0.0, 0.0}, vec2 = {0.0, 0.0, 0.0};
193 switch (cpLocation.at(idx)){
195 vec1 = vertices.at(faces.at(idx)[V3-vertexOffset])-vertices.at(faces.at(idx)[V1-vertexOffset]);
196 vec2 = vertices.at(faces.at(idx)[V3-vertexOffset])-vertices.at(faces.at(idx)[V2-vertexOffset]);
199 vec1 = vertices.at(faces.at(idx)[V2-vertexOffset])-vertices.at(faces.at(idx)[V1-vertexOffset]);
200 vec2 = vertices.at(faces.at(idx)[V2-vertexOffset])-vertices.at(faces.at(idx)[V3-vertexOffset]);
203 vec1 = vertices.at(faces.at(idx)[V1-vertexOffset])-vertices.at(faces.at(idx)[V2-vertexOffset]);
204 vec2 = vertices.at(faces.at(idx)[V1-vertexOffset])-vertices.at(faces.at(idx)[V3-vertexOffset]);
207 vec1 = vertices.at(faces.at(idx)[V2-vertexOffset])-vertices.at(faces.at(idx)[V1-vertexOffset]);
208 vec2 = vertices.at(faces.at(idx)[V3-vertexOffset])-vertices.at(faces.at(idx)[V1-vertexOffset]);
211 vec1 = vertices.at(faces.at(idx)[V1-vertexOffset])-vertices.at(faces.at(idx)[V2-vertexOffset]);
212 vec2 = vertices.at(faces.at(idx)[V3-vertexOffset])-vertices.at(faces.at(idx)[V2-vertexOffset]);
215 vec1 = vertices.at(faces.at(idx)[V1-vertexOffset])-vertices.at(faces.at(idx)[V3-vertexOffset]);
216 vec2 = vertices.at(faces.at(idx)[V2-vertexOffset])-vertices.at(faces.at(idx)[V3-vertexOffset]);
219 if (vec1.
DotProduct(faceNormals.at(idxNeighbor)) > 0.0 || vec2.DotProduct(faceNormals.at(idxNeighbor)) > 0.0){
222 if (vec1.
DotProduct(faceNormals.at(idxNeighbor)) < 0.0 || vec2.DotProduct(faceNormals.at(idxNeighbor)) < 0.0){
228 inline bool CheckConcavity(
int idx,
int idxNeighbor) {
229 return !CheckConvexity(idx, idxNeighbor);
232 inline bool CheckNormal(
const vct3 & target,
const int idx,
double tolerance) {
233 if ((target-closestPoint.at(idx)).DotProduct(faceNormals.at(idx)) >= -tolerance){
241#if CISST_MSH_HAS_RPLY
244 double mMeshResolution;
245 double mRobotResolution;
size_t NumTriangles(void) const
Definition msh3Mesh.h:103
void TransformTriangle(const vctFrm4x4 &transformation)
msh3Mesh(double robotResolution, bool convertMMtoM)
void ResetMeshConstraintValues()
int LoadMeshFile(const std::string &meshFilePath)
void ReadMeshMeshFile(const std::string &meshFilePath)
void FaceCoords(int ti, vct3 &v0, vct3 &v1, vct3 &v2) const
Definition msh3Mesh.h:116
vctDynamicVector< vct3 > faceNormals
Definition msh3Mesh.h:64
void InitializeNoiseModel()
void ReadSURMeshFile(const char *fn)
VertexIndex
Definition msh3Mesh.h:163
@ V1V2
Definition msh3Mesh.h:163
@ IN
Definition msh3Mesh.h:163
@ VOID
Definition msh3Mesh.h:163
@ V2
Definition msh3Mesh.h:163
@ V2V3
Definition msh3Mesh.h:163
@ V3
Definition msh3Mesh.h:163
@ V1V3
Definition msh3Mesh.h:163
@ V1
Definition msh3Mesh.h:163
void SaveTriangleCovariances(std::string &filePath)
int SaveMeshFile(const std::string &filePath)
int LoadMesh(const vctDynamicVector< vct3 > &V, const vctDynamicVector< vctInt3 > &T, const vctDynamicVector< vct3 > &N)
vctDynamicVector< vct3 > closestPoint
Definition msh3Mesh.h:71
size_t NumVertices(void) const
Definition msh3Mesh.h:102
vct3 & FaceCoord(int ti, int vi)
Definition msh3Mesh.h:123
vctDynamicVector< vctInt3 > faces
Definition msh3Mesh.h:63
void InitializeNoiseModel(double noiseInPlaneVar, double noisePerpPlaneVar)
int LoadMeshFromSTLFile(const std::string &stlFilePath)
void LoadPLY(const std::string &input_file)
int edgeOffset
Definition msh3Mesh.h:164
vctDynamicVector< vct3x3 > TriangleCov
Definition msh3Mesh.h:79
msh3Mesh(bool convertMMtoM)
void MergeEdgePoint(std::vector< int > &faceIdx, vct3 &target)
vctDynamicVector< vct3 > vertices
Definition msh3Mesh.h:62
vctDynamicVector< int > cpLocation
Definition msh3Mesh.h:72
vctDynamicVector< vct3 > activeNormal
Definition msh3Mesh.h:73
void ReadMeshFile(const char *fn)
vctDynamicVector< vct3 > TriangleCovEig
Definition msh3Mesh.h:80
vctDynamicVector< vctInt3 > faceNeighbors
Definition msh3Mesh.h:68
int LoadMeshFileMultiple(const std::vector< std::string > &meshFilePaths)
void WriteSURMeshFile(const char *fn)
int LoadMesh(const vctDynamicVector< vct3 > *vertices, const vctDynamicVector< vctInt3 > *faces, const vctDynamicVector< vct3 > *face_normals=NULL, const vctDynamicVector< vctInt3 > *face_neighbors=NULL, const vctDynamicVector< vct3 > *vertex_normals=NULL)
void SavePLY(const std::string &output_file)
void WriteMeshFile(const char *fn)
vctDynamicVector< double > distance
Definition msh3Mesh.h:74
~msh3Mesh()
Definition msh3Mesh.h:92
vctDynamicVector< vct3 > vertexNormals
Definition msh3Mesh.h:67
void ReadSFCMeshFile(const char *fn)
int vertexOffset
Definition msh3Mesh.h:165
msh3Mesh(double robotResolution)
Definition vctForwardDeclarations.h:131
value_type DotProduct(const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &otherVector) const
Definition vctFixedSizeConstVectorBase.h:660
#define CISST_EXPORT
Definition cmnExportMacros.h:50
Macros to export the symbols of cisstMesh (in a Dll).
Typedef for dynamic vectors.
Typedef for fixed size matrices.
Typedef for fixed size vectors.
vctFixedSizeVector< double, 3 > vct3
Definition vctFixedSizeVectorTypes.h:46
vctFixedSizeVector< int, 3 > vctInt3
Definition vctFixedSizeVectorTypes.h:145