diff --git a/IntersLineBox.cpp b/IntersLineBox.cpp index 552f9a6..97868d6 100644 --- a/IntersLineBox.cpp +++ b/IntersLineBox.cpp @@ -113,7 +113,7 @@ IntersLineBox( const Point3d& ptL, const Vector3d& vtL, double dLen, const BBox3 double dU1, dU2 ; bool bInters = IntersLineBox( ptL, vtL, b3Box.GetMin(), b3Box.GetMax(), dU1, dU2) ; - // Se non c'่ intersezione + // Se non c'รจ intersezione if ( ! bInters || ( bFinite && ( dU1 > dLen + EPS_SMALL || dU2 < -EPS_SMALL))) return true ; @@ -144,8 +144,14 @@ IntersLineBox( const Point3d& ptL, const Vector3d& vtL, double dLen, const BBox3 else if ( dU2 < EPS_SMALL) vInters.emplace_back( ILBT_OUT, 0) ; else { - vInters.emplace_back( ILBT_TG_INI, Clamp( dU1, 0., dLen)) ; - vInters.emplace_back( ILBT_TG_FIN, Clamp( dU2, 0., dLen)) ; + if ( dU1 < - EPS_SMALL) + vInters.emplace_back( ILBT_TG_INSIDE, 0.) ; + else + vInters.emplace_back( ILBT_TG_INI, Clamp( dU1, 0., dLen)) ; + if ( dU2 > dLen + EPS_SMALL) + vInters.emplace_back( ILBT_TG_INSIDE, dLen) ; + else + vInters.emplace_back( ILBT_TG_FIN, Clamp( dU2, 0., dLen)) ; } } return true ; @@ -162,8 +168,14 @@ IntersLineBox( const Point3d& ptL, const Vector3d& vtL, double dLen, const BBox3 else if ( dU2 < EPS_SMALL) vInters.emplace_back( ILBT_OUT, 0) ; else { - vInters.emplace_back( ILBT_IN, Clamp( dU1, 0., dLen)) ; - vInters.emplace_back( ILBT_OUT, Clamp( dU2, 0., dLen)) ; + if ( dU1 < - EPS_SMALL) + vInters.emplace_back( ILBT_INSIDE, 0.) ; + else + vInters.emplace_back( ILBT_IN, Clamp( dU1, 0., dLen)) ; + if ( dU2 > dLen + EPS_SMALL) + vInters.emplace_back( ILBT_INSIDE, dLen) ; + else + vInters.emplace_back( ILBT_OUT, Clamp( dU2, 0., dLen)) ; } } return true ;