Skip to content
Snippets Groups Projects
Commit 11aa3392 authored by Markus Frank's avatar Markus Frank Committed by MarkusFrankATcernch
Browse files

Correctly handle quadrilinear facets in tessellated shapes.

parent 63aa094d
No related branches found
No related tags found
No related merge requests found
......@@ -54,25 +54,6 @@ namespace dd4hep {
}
// Determine if the facet is degenerated by calculating its determinant
inline bool facetIsDegenerated(std::vector<ROOT::Geom::Vertex_t> const& vertices){
#if 0
const ROOT::Geom::Vertex_t& v1 = vertices[0];
const ROOT::Geom::Vertex_t& v2 = vertices[1];
const ROOT::Geom::Vertex_t& v3 = vertices[2];
constexpr double epsilon = std::numeric_limits<double>::epsilon();
// v1.x v2.x v3.x v1.x v2.x
//
// v1.y v2.y v3.y v1.y v2.y
//
// v1.z v2.z v3.z v1.z v2.z
double det = 0.0
+ v1.x() * v2.y() * v3.z()
+ v2.x() * v3.y() * v1.z()
+ v3.x() * v1.y() * v2.z()
- v1.z() * v2.y() * v3.x()
- v2.z() * v3.y() * v1.x()
- v3.z() * v1.y() * v2.x();
return std::fabs(det) < epsilon;
#else
using ROOT::Geom::Vertex_t;
// Compute normal using non-zero segments
constexpr double kTolerance = 1.e-20;
......@@ -99,7 +80,6 @@ namespace dd4hep {
break;
}
return degenerated;
#endif
}
}
}
......
......@@ -117,7 +117,12 @@ ASSIMPReader::readVolumes(const std::string& source, double unit_length) const
/// assigns the proper indices to the facet.
for(unsigned int i=0; i < mesh->mNumFaces; i++) {
const unsigned int* idx = mesh->mFaces[i].mIndices;
bool degenerated = dd4hep::cad::facetIsDegenerated({vertices[idx[0]], vertices[idx[1]], vertices[idx[2]]});
bool degenerated = false;
if ( mesh->mFaces[i].mNumIndices == 3 )
degenerated = dd4hep::cad::facetIsDegenerated({vertices[idx[0]], vertices[idx[1]], vertices[idx[2]]});
else if ( mesh->mFaces[i].mNumIndices == 4 )
degenerated = dd4hep::cad::facetIsDegenerated({vertices[idx[0]], vertices[idx[1]], vertices[idx[2]], vertices[idx[3]]});
if ( degenerated ) {
printout(DEBUG, "ASSIMPReader", "+++ %s: Drop degenerated facet: %d %d %d",
name.c_str(), idx[0], idx[1], idx[2]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment