Include : Aggiunta classe CrvPointDiffGeom (geometria differenziale nell'intorno di un punto di una curva).

This commit is contained in:
Dario Sassi
2013-12-28 18:54:48 +00:00
parent 2c421bf05a
commit 2932f2837b
5 changed files with 151 additions and 23 deletions
+84
View File
@@ -0,0 +1,84 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : EgkCurvePointDiffGeom.h Data : 26.12.13 Versione : 1.4l4
// Contenuto : Tipi generali per calcoli geometrici.
//
//
//
// Modifiche : 26.12.13 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EGkPoint3d.h"
//----------------------------------------------------------------------------
// Oggetto Punto di curva con sua geometria differenziale
class CrvPointDiffGeom
{
public :
enum Status { NONE = 0x00, // non è definito alcunché
POS = 0x01, // è definito il punto
TANG = 0x03, // è definita la tangente (quindi anche il punto)
NCRV = 0x07} ; // è definita la normale/curvatura (quindi anche la tangente)
enum Flag { STD = 0x00, // punto standard
TO_VERIFY = 0x01, // punto da verificare (al confine tra due curve)
P1_DISC_TG = 0x02, // primo punto di una discontinuità della tangente
P2_DISC_TG = 0x04, // secondo punto di una discontinuità della tangente
P1_DISC_NC = 0x10, // primo punto di una discontinuità della normale/curvatura
P2_DISC_NC = 0x20} ; // secondo punto di una discontinuità della normale/curvatura
public :
Status nStatus ;
Flag nFlag ;
double dU ;
Point3d ptP ;
Vector3d vtT ;
Vector3d vtN ;
double dCurv ;
public :
CrvPointDiffGeom( void) { nStatus = NONE ; nFlag = STD ; }
} ;
//----------------------------------------------------------------------------
inline bool
ThereIsDiscontinuity( CrvPointDiffGeom& oDiffGp, CrvPointDiffGeom& oDiffGs)
{
// per default tutto continuo
oDiffGp.nFlag = CrvPointDiffGeom::STD ;
oDiffGs.nFlag = CrvPointDiffGeom::STD ;
// verifico che siano definiti i parametri e i punti
if ( ( oDiffGp.nStatus & CrvPointDiffGeom::POS) == 0 ||
( oDiffGs.nStatus & CrvPointDiffGeom::POS) == 0)
return false ;
// verifico che il parametro e i punti coincidano
if ( fabs ( oDiffGp.dU - oDiffGs.dU) > EPS_ZERO ||
! AreSamePointNear( oDiffGp.ptP, oDiffGs.ptP))
return false ;
// verifico che siano definite le tangenti
if ( ( oDiffGp.nStatus & CrvPointDiffGeom::TANG) == 0 ||
( oDiffGs.nStatus & CrvPointDiffGeom::TANG) == 0)
return false ;
// verifico discontinuità sulle tangenti
if ( ! AreSameVectorNear( oDiffGp.vtT, oDiffGs.vtT)) {
oDiffGp.nFlag = CrvPointDiffGeom::P1_DISC_TG ;
oDiffGs.nFlag = CrvPointDiffGeom::P2_DISC_TG ;
return true ;
}
// verifico che siano definite le normali/curvature
if ( ( oDiffGp.nStatus & CrvPointDiffGeom::NCRV) == 0 ||
( oDiffGs.nStatus & CrvPointDiffGeom::NCRV) == 0)
return false ;
// verifico discontinuità sulle normali/curvature
if ( ! AreSameVectorNear( oDiffGp.vtN, oDiffGs.vtN) ||
fabs( oDiffGp.dCurv - oDiffGs.dCurv) > EPS_SMALL) {
oDiffGp.nFlag = CrvPointDiffGeom::P1_DISC_NC ;
oDiffGs.nFlag = CrvPointDiffGeom::P2_DISC_NC ;
return true ;
}
return false ;
}
+10 -2
View File
@@ -1,8 +1,8 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : EgkGeoType.h Data : 17.12.13 Versione : 1.4l1
// Contenuto : Tipi generali per calcoli geometrici.
// File : EgkGeoCollection.h Data : 17.12.13 Versione : 1.4l1
// Contenuto : Raccolte di oggetti geometrici.
//
//
//
@@ -14,6 +14,7 @@
#pragma once
#include "/EgtDev/Include/EGkPoint3d.h"
#include "/EgtDev/Include/EGkCurvePointDiffGeom.h"
#include <vector>
#include <list>
@@ -21,7 +22,14 @@
// Raccolte di Point3d
typedef std::vector<Point3d> PNTVECTOR ; // vettore di punti
typedef std::list<Point3d> PNTLIST ; // lista di punti
//----------------------------------------------------------------------------
// Raccolte di coppie dU,Point3d
typedef std::pair<double,Point3d> UPOINT ; // coppia parametro, punto
typedef std::vector<UPOINT> UPNTVECTOR ; // vettore di coppie parametro, punto
typedef std::list<UPOINT> UPNTLIST ; // lista di coppie parametro, punto
//----------------------------------------------------------------------------
// Raccolte di Punti di curva con loro geometria differenziale
typedef std::vector<CrvPointDiffGeom> CPDGVECTOR ; // vettore di CrvPointDiffGeom
typedef std::list<CrvPointDiffGeom> CPDGLIST ; // lista di CrvPointDiffGeom
+27 -17
View File
@@ -14,7 +14,7 @@
#pragma once
#include "/EgtDev/Include/EGkPoint3d.h"
#include "/EgtDev/Include/EGkGeoType.h"
#include "/EgtDev/Include/EGkGeoCollection.h"
//-----------------------------------------------------------------------------
@@ -27,24 +27,34 @@ class PolyLine
bool EraseFirstUPoint( void) ;
bool AddOffsetToU( double dOffset) ;
bool Splice( PolyLine& PL) ;
int GetPointNbr( void) { return m_nCount ; }
bool GetFirstUPoint( double* pdPar, Point3d* pptP) ;
bool GetNextUPoint( double* pdPar, Point3d* pptP) ;
bool GetFirstU( double& dPar) { return GetFirstUPoint( &dPar, nullptr) ; }
bool GetNextU( double& dPar) { return GetNextUPoint( &dPar, nullptr) ; }
bool GetFirstPoint( Point3d& ptP) { return GetFirstUPoint( nullptr, &ptP) ; }
bool GetNextPoint( Point3d& ptP) { return GetNextUPoint( nullptr, &ptP) ; }
bool GetLastUPoint( double* pdPar, Point3d* pptP) ;
bool GetLastU( double& dPar) { return GetLastUPoint( &dPar, nullptr) ; }
bool GetLastPoint( Point3d& ptP) { return GetLastUPoint( nullptr, &ptP) ; }
int GetLineNbr( void) { return ( m_nCount > 1 ? ( m_nCount - 1) : 0) ; }
bool GetFirstULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) ;
bool GetNextULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) ;
bool GetFirstLine( Point3d& ptIni, Point3d& ptFin) { return GetFirstULine( nullptr, &ptIni, nullptr, &ptFin) ; }
bool GetNextLine( Point3d& ptIni, Point3d& ptFin) { return GetNextULine( nullptr, &ptIni, nullptr, &ptFin) ; }
int GetPointNbr( void) const
{ return m_nCount ; }
bool GetFirstUPoint( double* pdPar, Point3d* pptP) const ;
bool GetNextUPoint( double* pdPar, Point3d* pptP) const ;
bool GetFirstU( double& dPar) const
{ return GetFirstUPoint( &dPar, nullptr) ; }
bool GetNextU( double& dPar) const
{ return GetNextUPoint( &dPar, nullptr) ; }
bool GetFirstPoint( Point3d& ptP) const
{ return GetFirstUPoint( nullptr, &ptP) ; }
bool GetNextPoint( Point3d& ptP) const
{ return GetNextUPoint( nullptr, &ptP) ; }
bool GetLastUPoint( double* pdPar, Point3d* pptP) const ;
bool GetLastU( double& dPar)
{ return GetLastUPoint( &dPar, nullptr) ; }
bool GetLastPoint( Point3d& ptP)
{ return GetLastUPoint( nullptr, &ptP) ; }
int GetLineNbr( void) const
{ return ( m_nCount > 1 ? ( m_nCount - 1) : 0) ; }
bool GetFirstULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) const ;
bool GetNextULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) const ;
bool GetFirstLine( Point3d& ptIni, Point3d& ptFin) const
{ return GetFirstULine( nullptr, &ptIni, nullptr, &ptFin) ; }
bool GetNextLine( Point3d& ptIni, Point3d& ptFin) const
{ return GetNextULine( nullptr, &ptIni, nullptr, &ptFin) ; }
private :
int m_nCount ;
UPNTLIST m_lUPoints ;
UPNTLIST::const_iterator m_iter ;
mutable UPNTLIST::const_iterator m_iter ;
} ;
+22
View File
@@ -164,6 +164,28 @@ Media( const Vector3d& vtV1, const Vector3d& vtV2, double dCoeff)
( 1 - dCoeff) * vtV1.z + dCoeff * vtV2.z)) ;
}
//----------------------------------------------------------------------------
// Verifica che due vettori sono quasi coincidenti (Small error -> Near)
//----------------------------------------------------------------------------
inline bool
AreSameVectorNear( const Vector3d& vtV1, const Vector3d& vtV2)
{
return ( fabs( vtV1.x - vtV2.x) < EPS_SMALL &&
fabs( vtV1.y - vtV2.y) < EPS_SMALL &&
fabs( vtV1.z - vtV2.z) < EPS_SMALL) ;
}
//----------------------------------------------------------------------------
// Verifica che due vettori sono esattamente coincidenti (Zero error -> Exact)
//----------------------------------------------------------------------------
inline bool
AreSameVectorExact( const Vector3d& vtV1, const Vector3d& vtV2)
{
return ( fabs( vtV1.x - vtV2.x) < EPS_ZERO &&
fabs( vtV1.y - vtV2.y) < EPS_ZERO &&
fabs( vtV1.z - vtV2.z) < EPS_ZERO) ;
}
//----------------------------------------------------------------------------
// Verifica che due versori sono ortogonali (Small error -> Near)
//----------------------------------------------------------------------------
+8 -4
View File
@@ -19,6 +19,10 @@
//----------------------------------------------------------------------------
class __declspec( novtable) ICurve : public IGeoObj
{
public :
enum Side { FROM_MINUS = -1, // da valori inferiori del parametro
FROM_PLUS = 1} ; // da valori superiori del parametro
public :
virtual bool IsSimple( void) const = 0 ;
virtual bool IsClosed( void) const = 0 ;
@@ -26,10 +30,10 @@ class __declspec( novtable) ICurve : public IGeoObj
virtual bool GetEndPoint( Point3d& ptEnd) const = 0 ;
virtual bool GetDomain( double& dStart, double& dEnd) const = 0 ;
virtual bool GetLength( double& dLen) const = 0 ;
virtual bool GetPointD1D2( double dU, Point3d& ptPos, Vector3d& vtDer1, Vector3d& vtDer2) const = 0 ;
virtual bool GetPoint( double dU, Point3d& ptPos) const = 0 ;
virtual bool GetPointTang( double dU, Point3d& ptPos, Vector3d& vtTang) const = 0 ;
virtual bool GetPointTangNormCurv( double dU, Point3d& ptPos, Vector3d& vtT, Vector3d& vtN, double& dCurv) const = 0 ;
virtual bool GetPointD1D2( double dU, Side nS, Point3d& ptPos, Vector3d& vtDer1, Vector3d& vtDer2) const = 0 ;
virtual bool GetPoint( double dU, Side nS, Point3d& ptPos) const = 0 ;
virtual bool GetPointTang( double dU, Side nS, Point3d& ptPos, Vector3d& vtTang) const = 0 ;
virtual bool GetPointDiffGeom( double dU, Side nS, CrvPointDiffGeom& oDiffG) const = 0 ;
virtual bool Reverse( void) = 0 ;
virtual bool ApproxWithLines( double dLinTol, double dAngTolDeg, PolyLine& PL) const = 0 ;
virtual bool TrimStartAtParam( double dUTrim) = 0 ;