EgtGeomKernel :

- correzione calcolo intersezioni Linea-Box.
This commit is contained in:
Dario Sassi
2021-03-22 14:35:58 +00:00
parent a36251f308
commit 5e42cf86c4
+14 -9
View File
@@ -94,17 +94,22 @@ IntersLineBox( const Point3d& ptL, const Vector3d& vtL, double dLen, const BBox3
for ( size_t j = 1 ; j < vInters.size() ; ) {
// intersezione precedente
size_t i = j - 1 ;
// se hanno lo stesso parametro
if ( abs( vInters[i].second - vInters[j].second) < EPS_SMALL) {
// se sono uguali, elimino la seconda
if ( vInters[i].first == vInters[j].first) {
// se sono dello stesso tipo, elimino una delle due
if ( vInters[i].first == vInters[j].first) {
// se entranti elimino la prima
if ( vInters[i].first == ILBT_IN || vInters[i].first == ILBT_TG_INI)
vInters.erase( vInters.begin() + i) ;
// altrimenti la seconda
else
vInters.erase( vInters.begin() + j) ;
if ( i > 0)
-- j ;
continue ;
}
if ( i > 0)
-- j ;
continue ;
}
// se hanno lo stesso parametro
else if ( abs( vInters[i].second - vInters[j].second) < EPS_SMALL) {
// se una entrante e l'altra uscente, cambio in touch ed elimino la seconda
else if ( ( vInters[i].first == ILBT_IN && vInters[j].first == ILBT_OUT) ||
if ( ( vInters[i].first == ILBT_IN && vInters[j].first == ILBT_OUT) ||
( vInters[i].first == ILBT_OUT && vInters[j].first == ILBT_IN)) {
vInters[i].first = ILBT_TOUCH ;
vInters.erase( vInters.begin() + j) ;