Include :

- aggiornamento interfacce.
This commit is contained in:
Dario Sassi
2014-06-24 07:06:16 +00:00
parent 97fa024cbf
commit ce98475a7c
6 changed files with 154 additions and 7 deletions
+3 -2
View File
@@ -42,7 +42,8 @@ typedef std::vector<MinDistPCInfo> MDPCIVECTOR ; // vettore di MinDistPCInfo
class DistPointCurve
{
public :
EGK_EXPORT DistPointCurve( const Point3d& ptP, const ICurve& Curve) ;
EGK_EXPORT DistPointCurve( const Point3d& ptP, const ICurve& Curve, bool bIsSegment = true) ;
// Il flag bIsSegment vale solo per linee.
public :
EGK_EXPORT bool GetSqDist( double& dSqDist) ;
@@ -56,7 +57,7 @@ class DistPointCurve
private :
DistPointCurve( void) ;
void LineCalculate( const Point3d& ptP, const ICurve& Curve) ;
void LineCalculate( const Point3d& ptP, const ICurve& Curve, bool bIsSegment) ;
void ArcCalculate( const Point3d& ptP, const ICurve& Curve) ;
void CrvBezierCalculate( const Point3d& ptP, const ICurve& Curve) ;
void CrvCompositeCalculate( const Point3d& ptP, const ICurve& Curve) ;
+112
View File
@@ -0,0 +1,112 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : EGkIntersCurveCurve.h Data : 20.06.14 Versione : 1.5f6
// Contenuto : Dichiarazione della classe intersezione curva/curva.
//
//
//
// Modifiche : 20.06.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EGkPoint3d.h"
#include "/EgtDev/Include/EGkCurve.h"
//----------------------- Macro per import/export ----------------------------
#undef EGK_EXPORT
#if defined( I_AM_EGK) // da definirsi solo nella DLL
#define EGK_EXPORT __declspec( dllexport)
#else
#define EGK_EXPORT __declspec( dllimport)
#endif
//-----------------------------------------------------------------------------
struct IntCrvInfo {
// dati dell'intersezione relativi alla curva
double dU ; //!< parametro
Point3d ptI ; //!< punto sulla curva (Z della curva, intersezione a Z=0)
int nTy ; //!< tipo
// costruttori
IntCrvInfo( void)
: dU( 0), ptI(), nTy( 0){}
IntCrvInfo( double dUp, Point3d ptIp, int nTyp)
: dU( dUp), ptI( ptIp), nTy( nTyp){}
// assegnazione
void Set( double dUp, Point3d ptIp, int nTyp)
{ dU = dUp ; ptI = ptIp ; nTy = nTyp ; }
} ;
struct IntCrvCrvInfo {
IntCrvInfo Ici[2] ;
// costruttori
IntCrvCrvInfo( void)
{ Ici[0].Set( 0, Point3d(), 0) ; Ici[1].Set( 0, Point3d(), 0) ; }
IntCrvCrvInfo( double dU1p, Point3d ptI1p, int nTy1p, double dU2p, Point3d ptI2p, int nTy2p)
{ Ici[0].Set( dU1p, ptI1p, nTy1p) ; Ici[1].Set( dU2p, ptI2p, nTy2p) ; }
} ;
typedef std::vector<IntCrvCrvInfo> ICCIVECTOR ; // vettore di IntCrvCrvInfo
//-----------------------------------------------------------------------------
// Costanti per tipo di intersezione
const int ICCT_RESET = 0 ;
const int ICCT_PNULL = 0 ;
const int ICCT_PIN = 1 ;
const int ICCT_PON = 2 ;
const int ICCT_POUT = 3 ;
const int ICCT_NNULL = 0 ;
const int ICCT_NIN = 4 ;
const int ICCT_NON = 8 ;
const int ICCT_NOUT = 12 ;
// Per settare entrambi contemporaneamente basta sommare i valori dei due flag Prev e Next
inline bool SetIcctPrev( int nVal, int& nFlag)
{ if ( ( nVal & ( ~ICCT_POUT)) != 0)
return false ;
nFlag &= ( ~ICCT_POUT) ;
nFlag |= nVal ;
return true ; }
inline bool SetIcctNext( int nVal, int& nFlag)
{ if ( ( nVal & ( ~ICCT_NOUT)) != 0)
return false ;
nFlag &= ( ~ICCT_NOUT) ;
nFlag |= nVal ;
return true ; }
inline bool IsIcctPrevNull( int nFlag) { return ( ( nFlag & ICCT_POUT) == ICCT_PNULL) ; }
inline bool IsIcctPrevIn( int nFlag) { return ( ( nFlag & ICCT_POUT) == ICCT_PIN) ; }
inline bool IsIcctPrevOn( int nFlag) { return ( ( nFlag & ICCT_POUT) == ICCT_PON) ; }
inline bool IsIcctPrevOut( int nFlag) { return ( ( nFlag & ICCT_POUT) == ICCT_POUT) ; }
inline bool IsIcctNextNull( int nFlag) { return ( ( nFlag & ICCT_NOUT) == ICCT_NNULL) ; }
inline bool IsIcctNextIn( int nFlag) { return ( ( nFlag & ICCT_NOUT) == ICCT_NIN) ; }
inline bool IsIcctNextOn( int nFlag) { return ( ( nFlag & ICCT_NOUT) == ICCT_NON) ; }
inline bool IsIcctNextOut( int nFlag) { return ( ( nFlag & ICCT_NOUT) == ICCT_NOUT) ; }
//-----------------------------------------------------------------------------
class IntersCurveCurve
{
public :
//! Le intersezioni sono calcolate nel piano XY locale.<br/>
//! Il flag bIsSegment vale solo per le linee.
EGK_EXPORT IntersCurveCurve( const ICurve& Curve1, const ICurve& Curve2, bool bIsSegment = true) ;
public :
EGK_EXPORT bool GetOverlaps( void) ;
EGK_EXPORT int GetNumInters( void) ;
EGK_EXPORT bool GetIntersParam( int nInd, int nCrv, double& dPar) ;
EGK_EXPORT bool GetIntersPoint( int nInd, int nCrv, Point3d& ptI) ;
EGK_EXPORT bool GetIntersType( int nInd, int nCrv, int& nType) ;
EGK_EXPORT bool GetIntCrvCrvInfo( int nInd, IntCrvCrvInfo& aInfo) ;
EGK_EXPORT bool GetIntersPointNearTo( int nCrv, const Point3d& ptNear, Point3d& ptI) ;
private :
void LineLineCalculate( const ICurve& Curve1, const ICurve& Curve2, bool bIsSegment) ;
private :
bool m_bOverlaps ;
int m_nNumInters ;
ICCIVECTOR m_Info ;
const ICurve* m_pCurve[2] ;
} ;
+1 -1
View File
@@ -229,7 +229,7 @@ DistXY( const Point3d& ptP1, const Point3d& ptP2)
}
//----------------------------------------------------------------------------
// Direzione e distanza tra due punti
// Direzione e distanza tra due punti ( P1 -> P2)
//----------------------------------------------------------------------------
inline bool
DirDist( const Point3d& ptP1, const Point3d& ptP2, Vector3d& vtDir, double& dDist)
+23 -1
View File
@@ -43,8 +43,12 @@ class EGK_EXPORT Vector3d
void FromPolar( double dLen, double dAngDeg) ;
public :
double SqLen( void) const ;
double SqLen( void) const
{ return ( x * x + y * y + z * z) ; }
double Len( void) const ;
double SqLenXY( void) const
{ return ( x * x + y * y ) ; }
double LenXY( void) const ;
bool IsSmall( void) const
{ return ( ( x * x + y * y + z * z) < ( EPS_SMALL * EPS_SMALL)) ; }
bool IsZero( void) const
@@ -166,6 +170,15 @@ operator*( const Vector3d& vtV1, const Vector3d& vtV2)
return ( vtV1.x * vtV2.x + vtV1.y * vtV2.y + vtV1.z * vtV2.z) ;
}
//----------------------------------------------------------------------------
// Prodotto scalare nel piano XY
//----------------------------------------------------------------------------
inline double
ScalarXY( const Vector3d& vtV1, const Vector3d& vtV2)
{
return ( vtV1.x * vtV2.x + vtV1.y * vtV2.y) ;
}
//----------------------------------------------------------------------------
// Prodotto vettoriale
//----------------------------------------------------------------------------
@@ -177,6 +190,15 @@ operator^( const Vector3d& vtV1, const Vector3d& vtV2)
vtV1.x * vtV2.y - vtV1.y * vtV2.x)) ;
}
//----------------------------------------------------------------------------
// Prodotto vettoriale nel piano XY
//----------------------------------------------------------------------------
inline double
CrossXY( const Vector3d& vtV1, const Vector3d& vtV2)
{
return ( vtV1.x * vtV2.y - vtV1.y * vtV2.x) ;
}
//----------------------------------------------------------------------------
// Somma mediata di due vettori (baricentrica)
//----------------------------------------------------------------------------
+5
View File
@@ -27,6 +27,8 @@ class __declspec( novtable) ICurve : public IGeoObj
enum OffType { OFF_FILLET = 0, // si raccordano con arco gli spigoli esterni
OFF_CHAMFER = 1, // si raccordano con smusso gli spigoli esterni
OFF_EXTEND = 2} ; // si prolungano all'intersezione gli spigoli esterni
public : // IGeoObj
virtual ICurve* Clone( void) const = 0 ;
public :
virtual bool IsSimple( void) const = 0 ;
virtual bool IsClosed( void) const = 0 ;
@@ -39,6 +41,8 @@ class __declspec( novtable) ICurve : public IGeoObj
virtual bool GetMidDir( Vector3d& vtDir) const = 0 ;
virtual bool GetDomain( double& dStart, double& dEnd) const = 0 ;
virtual bool GetLength( double& dLen) const = 0 ;
virtual bool GetLengthAtParam( double dU, double& dLen) const = 0 ;
virtual bool GetParamAtLength( double dLen, double& dU) const = 0 ;
virtual bool GetPointD1D2( double dU, Side nS, Point3d& ptPos,
Vector3d* pvtDer1 = nullptr, Vector3d* pvtDer2 = nullptr) const = 0 ;
virtual bool GetPointTang( double dU, Side nS, Point3d& ptPos, Vector3d& vtTang) const = 0 ;
@@ -49,6 +53,7 @@ class __declspec( novtable) ICurve : public IGeoObj
virtual bool Offset( double dDist, int nSide, int nType = OFF_FILLET) = 0 ;
virtual bool TrimStartAtParam( double dUTrim) = 0 ;
virtual bool TrimEndAtParam( double dUTrim) = 0 ;
virtual bool TrimStartEndAtParam( double dUStartTrim, double dUEndTrim) = 0 ;
virtual bool TrimStartAtLen( double dLenTrim) = 0 ;
virtual bool TrimEndAtLen( double dLenTrim) = 0 ;
} ;
+10 -3
View File
@@ -21,15 +21,22 @@ class __declspec( novtable) ICurveComposite : public ICurve
public :
virtual bool Copy( const IGeoObj* pGObjSrc) = 0 ;
virtual bool Clear( void) = 0 ;
virtual bool AddCurve( const ICurve& cCrv) = 0 ;
virtual bool AddCurve( ICurve* pCrv) = 0 ;
virtual bool AddCurve( const ICurve& cCrv, bool bEndOrStart = true) = 0 ;
virtual bool AddCurve( ICurve* pCrv, bool bEndOrStart = true) = 0 ;
virtual bool FromSplit( const ICurve& cCrv, int nParts) = 0 ;
virtual bool FromPointVector( const PNTVECTOR& vPnt) = 0 ;
virtual bool FromPointBulgeVector( const UPNTVECTOR& vUPnt, const Vector3d& vtN) = 0 ;
virtual int GetCurveNumber( void) const = 0 ;
virtual bool PolygonCenterCorner( int nSides, const Point3d& ptCen, const Point3d& ptCorner) = 0 ;
virtual bool PolygonCenterMidSide( int nSides, const Point3d& ptCen, const Point3d& ptMidSide) = 0 ;
virtual bool PolygonSide( int nSides, const Point3d& ptStart, const Point3d& ptEnd) = 0 ;
virtual int GetCurveNumber( void) const = 0 ;
virtual const ICurve* GetFirstCurve( void) const = 0 ;
virtual const ICurve* GetNextCurve( void) const = 0 ;
virtual const ICurve* GetLastCurve( void) const = 0 ;
virtual const ICurve* GetPrevCurve( void) const = 0 ;
virtual bool IsParamAtJoint( double dU) const = 0 ;
virtual ICurve* RemoveFirstOrLastCurve( bool bLast = true) = 0 ;
virtual bool ChangeStartPoint( double dU) = 0 ;
virtual bool ArcsToBezierCurves( void) = 0 ;
} ;