EgtGeomKernel 2.4f2 :

- nell'intersezione tra un piano e una superficie trimesh forzo il risultato a stare esattamente nel piano.
This commit is contained in:
DarioS
2022-06-13 20:13:50 +02:00
parent 498e5b37f4
commit 4f0a1460fd
2 changed files with 26 additions and 5 deletions
BIN
View File
Binary file not shown.
+26 -5
View File
@@ -27,7 +27,7 @@
using namespace std ;
//----------------------------------------------------------------------------
void
static void
UpdateIntersPlaneSurfTm( const Plane3d& plPlane, const Triangle3d& Tria, PNTVECTOR& vPnt, BIPNTVECTOR& vBpt, TRIA3DVECTOR& vTria,
PointGrid3d& PtGrid, HashGrids3d& LnGrid, HashGrids3d& TrGrid)
{
@@ -109,8 +109,9 @@ UpdateIntersPlaneSurfTm( const Plane3d& plPlane, const Triangle3d& Tria, PNTVECT
}
//----------------------------------------------------------------------------
void
AdjustIntersPlaneSurfTm( PNTVECTOR& vPnt, BIPNTVECTOR& vBpt, const TRIA3DVECTOR& vTria, const HashGrids3d& LnGrid, const HashGrids3d& TrGrid)
static void
AdjustIntersPlaneSurfTm( PNTVECTOR& vPnt, BIPNTVECTOR& vBpt, TRIA3DVECTOR& vTria,
const Plane3d& plPlane, const HashGrids3d& LnGrid, const HashGrids3d& TrGrid)
{
// rimuovo i punti che stanno sui segmenti
for ( int i = int( vPnt.size()) - 1 ; i >= 0 ; -- i) {
@@ -173,6 +174,26 @@ AdjustIntersPlaneSurfTm( PNTVECTOR& vPnt, BIPNTVECTOR& vBpt, const TRIA3DVECTOR&
vBpt.erase( vBpt.begin() + i) ;
}
// porto i punti esattamente nel piano
for ( int i = 0 ; i < int( vPnt.size()) ; ++ i) {
vPnt[i] = ProjectPointOnPlane( vPnt[i], plPlane) ;
}
// porto i segmenti esattamente nel piano
for ( int i = 0 ; i < int( vBpt.size()) ; ++ i) {
vBpt[i].first = ProjectPointOnPlane( vBpt[i].first, plPlane) ;
vBpt[i].second = ProjectPointOnPlane( vBpt[i].second, plPlane) ;
}
// porto i triangoli esattamente nel piano
for ( int i = 0 ; i < int( vTria.size()) ; ++ i) {
Triangle3d& trTria = vTria[i] ;
trTria.SetP( 0, ProjectPointOnPlane( trTria.GetP( 0), plPlane)) ;
trTria.SetP( 1, ProjectPointOnPlane( trTria.GetP( 1), plPlane)) ;
trTria.SetP( 2, ProjectPointOnPlane( trTria.GetP( 2), plPlane)) ;
trTria.Validate( true) ;
}
return ;
}
@@ -216,7 +237,7 @@ IntersPlaneSurfTm( const Plane3d& plPlane, const ISurfTriMesh& Stm,
nT = Stm.GetNextTriangle( nT, Tria) ;
}
AdjustIntersPlaneSurfTm( vPnt, vBpt, vTria, LnGrid, TrGrid) ;
AdjustIntersPlaneSurfTm( vPnt, vBpt, vTria, plPlane, LnGrid, TrGrid) ;
return true ;
}
@@ -303,7 +324,7 @@ IntersParPlanesSurfTm::GetInters( double dDist, PNTVECTOR& vPnt, BIPNTVECTOR& vB
}
}
AdjustIntersPlaneSurfTm( vPnt, vBpt, vTria, LnGrid, TrGrid) ;
AdjustIntersPlaneSurfTm( vPnt, vBpt, vTria, plPlane, LnGrid, TrGrid) ;
return true ;
}