Include :

- migliorie varie.
This commit is contained in:
Dario Sassi
2018-09-03 05:33:36 +00:00
parent ddd91b02eb
commit a6c2a6a47f
6 changed files with 30 additions and 9 deletions
+6
View File
@@ -51,6 +51,12 @@ class DistPointCurve
public :
EGK_EXPORT bool GetSqDist( double& dSqDist) ;
EGK_EXPORT bool GetDist( double& dDist) ;
EGK_EXPORT bool IsEpsilon( double dTol)
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
EGK_EXPORT bool IsSmall( void)
{ return IsEpsilon( EPS_SMALL) ; }
EGK_EXPORT bool IsZero( void)
{ return IsEpsilon( EPS_ZERO) ; }
EGK_EXPORT int GetNbrMinDist( void) { return (int) m_Info.size() ; }
EGK_EXPORT bool GetMinDistPoint( int nInd, Point3d& ptMinDist, int& nFlag) ;
EGK_EXPORT bool GetMinDistPoint( double dNearParam, Point3d& ptMinDist, int& nFlag) ;
+4 -2
View File
@@ -32,10 +32,12 @@ class DistPointTriangle
public :
EGK_EXPORT bool GetSqDist( double& dSqDist) ;
EGK_EXPORT bool GetDist( double& dDist) ;
EGK_EXPORT bool IsEpsilon( double dTol)
{ double dSqDist ; return ( GetSqDist( dSqDist) && ( dSqDist < SQ_EPS_ZERO || dSqDist < dTol * dTol)) ; }
EGK_EXPORT bool IsSmall( void)
{ double dSqDist ; return ( GetSqDist( dSqDist) && dSqDist < SQ_EPS_SMALL) ; }
{ return IsEpsilon( EPS_SMALL) ; }
EGK_EXPORT bool IsZero( void)
{ double dSqDist ; return ( GetSqDist( dSqDist) && dSqDist < SQ_EPS_ZERO) ; }
{ return IsEpsilon( EPS_ZERO) ; }
EGK_EXPORT bool GetMinDistPoint( Point3d& ptMinDist) ;
private :
+2 -2
View File
@@ -27,12 +27,12 @@
//-----------------------------------------------------------------------------
EGK_EXPORT int IntersTriaTria( const Triangle3d& trTria1, const Triangle3d& trTria2,
Point3d& ptInt, Point3d& ptInt2, PNTVECTOR& vPnt) ;
Point3d& ptInt, Point3d& ptInt2, TRIA3DVECTOR& vTria) ;
//-----------------------------------------------------------------------------
// Tipo di intersezione triangolo-triangolo
enum IntTriaTriaType { ITTT_NO = 0, // non c'è intersezione
ITTT_OVERLAPS = 1, // i triangoli si sovrappongono (i vertici del poligono sono in vPnt)
ITTT_OVERLAPS = 1, // i triangoli si sovrappongono (i triangoli del poligono sono in vTria)
ITTT_VERT = 2, // l'intersezione coincide con un vertice di un triangolo (ptInt)
ITTT_PNT = 3, // l'intersezione è un punto sui lati di entrambi i triangoli (ptInt)
ITTT_EDGE = 4, // l'intersezione coincide con un lato di un triangolo (ptInt, ptInt2)
+7
View File
@@ -113,6 +113,13 @@ DistPointPlane( const Point3d& ptP, const Plane3d& plPlane)
return ((( ptP - ORIG) * plPlane.GetVersN()) - plPlane.GetDist()) ;
}
//-----------------------------------------------------------------------------
inline Point3d
ProjectPointOnPlane( const Point3d& ptP, const Plane3d& plPlane)
{
return ( ptP - DistPointPlane( ptP, plPlane) * plPlane.GetVersN()) ;
}
//-----------------------------------------------------------------------------
inline bool
PointInPlaneEpsilon( const Point3d& ptP, const Plane3d& plPlane, double dToler)
+10 -4
View File
@@ -15,6 +15,7 @@
#pragma once
#include "/EgtDev/Include/EGkBBox3d.h"
#include "/EgtDev/Include/EGkPlane3d.h"
#include <vector>
#include <list>
#include <algorithm>
@@ -26,13 +27,14 @@ class Triangle3d
Triangle3d( void) : m_nGrade( 0)
{ m_nAttr[0] = 0 ; m_nAttr[1] = 0 ; m_nAttr[2] = 0 ; }
void Set( const Point3d& ptP0, const Point3d& ptP1, const Point3d& ptP2)
{ m_ptP[0] = ptP0 ; m_ptP[1] = ptP1 ; m_ptP[2] = ptP2 ; m_vtN.Set( 0, 0, 0) ; }
{ m_ptP[0] = ptP0 ; m_ptP[1] = ptP1 ; m_ptP[2] = ptP2 ; m_vtN = V_NULL ; }
void Set( const Point3d& ptP0, const Point3d& ptP1, const Point3d& ptP2, const Vector3d& vtV)
{ m_ptP[0] = ptP0 ; m_ptP[1] = ptP1 ; m_ptP[2] = ptP2 ; m_vtN = vtV ; }
bool SetP( int nInd, const Point3d& ptV)
bool SetP( int nInd, const Point3d& ptP)
{ if ( nInd < 0 || nInd >= 3)
return false ;
m_ptP[nInd] = ptV ;
m_ptP[nInd] = ptP ;
m_vtN = V_NULL ;
return true ;
}
bool SetGrade( int nFlag)
@@ -50,7 +52,7 @@ class Triangle3d
return false ;
Vector3d vtV = ( m_ptP[1] - m_ptP[0]) ^ ( m_ptP[2] - m_ptP[0]) ;
vtV.Normalize( EPS_ZERO) ;
if ( m_vtN.IsZero() || bOverwrite) {
if ( m_vtN.IsSmall() || bOverwrite) {
m_vtN = vtV ;
return true ;
}
@@ -59,6 +61,8 @@ class Triangle3d
bool IsValid( void) const
{ if ( AreSamePointApprox( m_ptP[0], m_ptP[1]) || AreSamePointApprox( m_ptP[0], m_ptP[2]))
return false ;
if ( m_vtN.IsSmall())
return false ;
Vector3d vtV = ( m_ptP[1] - m_ptP[0]) ^ ( m_ptP[2] - m_ptP[0]) ;
vtV.Normalize( EPS_ZERO) ;
return AreSameVectorApprox( vtV, m_vtN) ;
@@ -134,6 +138,8 @@ class Triangle3d
{ return m_vtN ; }
Point3d GetCentroid( void) const
{ return ( m_ptP[0] + m_ptP[1] + m_ptP[2]) / 3 ; }
Plane3d GetPlane( void) const
{ Plane3d plT ; plT.Set( GetCentroid(), m_vtN) ; return plT ; }
double GetArea( void) const
{ return (( m_ptP[1] - m_ptP[0]) ^ ( m_ptP[2] - m_ptP[0])).Len() / 2 ; }
double GetAspectRatio( void) const
+1 -1
View File
@@ -522,7 +522,7 @@ EXE_EXPORT bool ExeCurveDomain( int nId, double* pdStart, double* pdEnd) ;
EXE_EXPORT bool ExeCurveLength( int nId, double* pdLen) ;
EXE_EXPORT bool ExeCurveLengthAtPoint( int nId, const Point3d& ptOn, double dExtend, double* pdLen) ;
EXE_EXPORT bool ExeCurveIsClosed( int nId) ;
EXE_EXPORT bool ExeCurveIsFlat( int nId, Plane3d& Plane) ;
EXE_EXPORT bool ExeCurveIsFlat( int nId, Plane3d& Plane, double dToler = EPS_SMALL) ;
EXE_EXPORT bool ExeCurveAreaXY( int nId, double& dArea) ;
EXE_EXPORT bool ExeCurveArea( int nId, Plane3d& Plane, double& dArea) ;
EXE_EXPORT bool ExeCurveNearestExtremityToPoint( int nId, const Point3d& ptP, bool& bStart) ;