EgtGeomKernel 2.1k2 :
- a Polygon3d aggiunte funzioni GetPerimeter e GetArea.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "PolygonPlane.h"
|
||||
#include "/EgtDev/Include/EgkPolygon3d.h"
|
||||
|
||||
using namespace std ;
|
||||
@@ -209,6 +210,29 @@ Polygon3d::GetPolyLine( void) const
|
||||
return PL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
Polygon3d::GetPerimeter( void) const
|
||||
{
|
||||
double dLen = 0 ;
|
||||
for ( size_t i = 0 ; i < m_vVert.size() ; ++ i) {
|
||||
size_t j = ( i + 1 < m_vVert.size() ? i + 1 : 0) ;
|
||||
dLen += Dist( m_vVert[i], m_vVert[j]) ;
|
||||
}
|
||||
return dLen ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
Polygon3d::GetArea( void) const
|
||||
{
|
||||
double dArea = 0 ;
|
||||
PolygonPlane PolyPlane ;
|
||||
for ( const auto& ptP : m_vVert)
|
||||
PolyPlane.AddPoint( ptP) ;
|
||||
return ( PolyPlane.GetArea( dArea) ? dArea : 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
Polygon3d::Translate( const Vector3d& vtMove)
|
||||
|
||||
Reference in New Issue
Block a user