Files
Include/EGkSurfBezier.h
Daniele Bariletti e2295d2502 Include :
- aggiunte funzioni per superfici di bezier.
2023-06-21 09:39:09 +02:00

89 lines
5.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2020-2020
//----------------------------------------------------------------------------
// File : EGkSurfBezier.h Data : 22.03.20 Versione : 2.2c3
// Contenuto : Dichiarazione della interfaccia ISurfBezier.
//
//
//
// Modifiche : 22.03.20 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EGkSurf.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
class PolyLine ;
class ICurveComposite ;
class ISurfFlatRegion ;
class ISurfTriMesh ;
//----------------------------------------------------------------------------
class __declspec( novtable) ISurfBezier : public ISurf
{
public :
enum Side { FROM_MINUS = -1, // da valori inferiori del parametro
FROM_PLUS = 1} ; // da valori superiori del parametro
public : // IGeoObj
ISurfBezier* Clone( void) const override = 0 ;
public :
virtual bool CopyFrom( const IGeoObj* pGObjSrc) = 0 ;
virtual bool Init( int nDegU, int nDegV, int nSpanU, int nSpanV, bool bIsRational) = 0 ;
virtual bool SetControlPoint( int nIndU, int nIndV, const Point3d& ptCtrl) = 0 ;
virtual bool SetControlPoint( int nInd, const Point3d& ptCtrl) = 0 ;
virtual bool SetControlPoint( int nIndU, int nIndV, const Point3d& ptCtrl, double dW) = 0 ;
virtual bool SetControlPoint( int nInd, const Point3d& ptCtrl, double dW) = 0 ;
virtual bool SetTrimRegion( const ISurfFlatRegion& sfrTrimReg) = 0 ;
virtual ISurfFlatRegion* GetTrimRegion( void) const = 0 ;
virtual bool GetInfo( int& nDegU, int& nDegV, int& nSpanU, int& nSpanV, bool& bIsRat, bool& bTrimmed) const = 0 ;
virtual const Point3d& GetControlPoint( int nIndU, int nIndV, bool* pbOk) const = 0 ;
virtual const Point3d& GetControlPoint( int nInd, bool* pbOk) const = 0 ;
virtual double GetControlWeight( int nIndU, int nIndV, bool* pbOk) const = 0 ;
virtual double GetControlWeight( int nInd, bool* pbOk) const = 0 ;
virtual bool IsAPoint( void) const = 0 ;
virtual bool GetPointD1D2( double dU, double dV, Side nUs, Side nVs,
Point3d& ptPos,
Vector3d* pvtDerU = nullptr, Vector3d* pvtDerV = nullptr,
Vector3d* pvtDerUU = nullptr, Vector3d* pvtDerVV = nullptr, Vector3d* pvtDerUV = nullptr) const = 0 ;
virtual bool GetPointNrmD1D2( double dU, double dV, Side nUs, Side nVs,
Point3d& ptPos, Vector3d& vtN,
Vector3d* pvtDerU = nullptr, Vector3d* pvtDerV = nullptr,
Vector3d* pvtDerUU = nullptr, Vector3d* pvtDerVV = nullptr, Vector3d* pvtDerUV = nullptr) const = 0 ;
virtual ICurveComposite* GetCurveOnU( double dV) const = 0 ;
virtual ICurveComposite* GetCurveOnV( double dU) const = 0 ;
virtual ICurveComposite* GetLoop( int nLoop) const = 0 ; // nLoop 0-based (1°esterno, successivi interni)
virtual bool GetControlCurveOnU( int nIndV, PolyLine& plCtrlU) const = 0 ;
virtual bool GetControlCurveOnV( int nIndU, PolyLine& plCtrlV) const = 0 ;
virtual const ISurfTriMesh* GetAuxSurf( void) const = 0 ;
virtual bool GetLeaves ( std::vector<std::tuple<int, Point3d, Point3d>>& vLeaves) const = 0 ;
} ;
//-----------------------------------------------------------------------------
static const double SBZ_TREG_COEFF = 1000 ;
//-----------------------------------------------------------------------------
inline ISurfBezier* CreateSurfBezier( void)
{ return (static_cast<ISurfBezier*>( CreateGeoObj( SRF_BEZIER))) ; }
inline ISurfBezier* CloneSurfBezier( const IGeoObj* pGObj)
{ if ( pGObj == nullptr || pGObj->GetType() != SRF_BEZIER)
return nullptr ;
return (static_cast<ISurfBezier*>(pGObj->Clone())) ; }
inline const ISurfBezier* GetSurfBezier( const IGeoObj* pGObj)
{ if ( pGObj == nullptr || pGObj->GetType() != SRF_BEZIER)
return nullptr ;
return (static_cast<const ISurfBezier*>(pGObj)) ; }
inline ISurfBezier* GetSurfBezier( IGeoObj* pGObj)
{ if ( pGObj == nullptr || pGObj->GetType() != SRF_BEZIER)
return nullptr ;
return (static_cast<ISurfBezier*>(pGObj)) ; }
//----------------------------------------------------------------------------
// Raccolte di puntatori a ISurfBezier
typedef std::vector<const ISurfBezier*> CISURFBEZPVECTOR ; // vettore di puntatori a const ISurfBezier
typedef std::vector<ISurfBezier*> ISURFBEZPVECTOR ; // vettore di puntatori a ISurfBezier
typedef std::list<ISurfBezier*> ISURFBEZPLIST ; // lista di puntatori a ISurfBezier
typedef std::vector<PtrOwner<ISurfBezier>> ISURFBEZPOVECTOR ; // vettore di puntatori esclusivi a ISurfBezier