EgtGeomKernel :
- a Polygon3d aggiunta GetCentroid - modificata PolygonPlane per gestire correttamente i triangoli dando solo i tre vertici senza ripeterne uno.
This commit is contained in:
@@ -210,6 +210,18 @@ Polygon3d::GetPolyLine( void) const
|
||||
return PL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Point3d
|
||||
Polygon3d::GetCentroid( void) const
|
||||
{
|
||||
PolygonPlane PolyPlane ;
|
||||
for ( const auto& ptP : m_vVert)
|
||||
PolyPlane.AddPoint( ptP) ;
|
||||
Point3d ptCen ;
|
||||
PolyPlane.GetCentroid( ptCen) ;
|
||||
return ptCen ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
Polygon3d::GetPerimeter( void) const
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ bool
|
||||
PolygonPlane::Finalize( void)
|
||||
{
|
||||
// almeno 3 punti (il triangolo è il poligono con minimo numero di lati)
|
||||
if ( m_nPntNbr < 3)
|
||||
if ( m_nPntNbr + 1 < 3)
|
||||
return false ;
|
||||
// se il poligono non è stato chiuso, aggiungo calcolo per ultimo lato
|
||||
if ( ! AreSamePointApprox( m_ptFirst, m_ptLast)) {
|
||||
|
||||
Reference in New Issue
Block a user