Chi-Tech
chi_surfacemesh_checksense.cc
Go to the documentation of this file.
1#include"chi_surfacemesh.h"
2#include<iostream>
3
4bool chi_mesh::SurfaceMesh::CheckNegativeSense(double x, double y, double z)
5{
7
8 //======================================================= Loop through each face
9 std::vector<chi_mesh::Face>::iterator cur_face;
10 for (cur_face = this->faces_.begin();
11 cur_face != this->faces_.end(); cur_face++)
12 {
13 //=========================================== Get a vertex (first one)
15 try{
16 p = this->vertices_.at(cur_face->v_index[0]);
17 }
18 catch(const std::out_of_range& o){
19 std::cout << "Invalid vertex handle" << std::endl;
20 }
21
22 //=========================================== Calculate dot product
23 chi_mesh::Vector3 p_xyz = xyz - p;
24 double dprod = cur_face->assigned_normal.Dot(p_xyz);
25
26 if (dprod<0.0)
27 {
28 return true;
29 }
30 }
31
32 return false;
33}
bool CheckNegativeSense(double x, double y, double z)
std::vector< chi_mesh::Vertex > vertices_
std::vector< chi_mesh::Face > faces_
VectorN< 3 > Vector3
Vector3 Dot(const chi_mesh::TensorRank2Dim3 &that) const