diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index 6716bf9..006e971 100644 Binary files a/EgtGeomKernel.rc and b/EgtGeomKernel.rc differ diff --git a/Polygon3d.cpp b/Polygon3d.cpp index 473348e..b41e773 100644 --- a/Polygon3d.cpp +++ b/Polygon3d.cpp @@ -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)