b304c329ef
- aggiunta estensione di curve agli estremi di data lunghezza - a selezione oggetto aggiunto flag per farlo solo se già visibile - possibilità di ciclare gli oggetti selezionati a ritroso - a tutti gli oggetti Geo aggiunto il costruttore di copia.
96 lines
3.4 KiB
C++
96 lines
3.4 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2013-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : PolynomialPoint3d.h Data : 11.01.14 Versione : 1.5a2
|
|
// Contenuto : Dichiarazione classe polinomio con coefficienti Point3d.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 11.01.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "/EgtDev/Include/ENkPolynomial.h"
|
|
#include "/EgtDev/Include/EGkGeoCollection.h"
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
class PolynomialPoint3d
|
|
{
|
|
public :
|
|
PolynomialPoint3d( void) : m_nDegree( -1) {}
|
|
PolynomialPoint3d( const PolynomialPoint3d& pol3S)
|
|
{ SetDegree( pol3S.m_nDegree) ;
|
|
for ( int i = 0 ; i <= m_nDegree ; ++ i)
|
|
m_Coeff[i] = pol3S.m_Coeff[i] ; }
|
|
bool SetDegree( int nDegree) ;
|
|
bool SetCoeff( int nPower, Point3d& ptP) ;
|
|
bool Set( int nDegree, const PNTVECTOR& vP) ;
|
|
bool SetToConstant( const Point3d& ptP) ;
|
|
PolynomialPoint3d& operator =( const PolynomialPoint3d& pol3S)
|
|
{ if ( &pol3S != this) {
|
|
SetDegree( pol3S.m_nDegree) ;
|
|
for ( int i = 0 ; i <= m_nDegree ; ++ i)
|
|
m_Coeff[i] = pol3S.m_Coeff[i] ; }
|
|
return *this ; }
|
|
|
|
public :
|
|
int GetDegree( void) const { return m_nDegree ; }
|
|
Point3d GetCoeff( int nPower) const
|
|
{ if ( nPower < 0 || nPower > m_nDegree)
|
|
return Point3d( 0, 0, 0) ;
|
|
return m_Coeff[nPower] ; }
|
|
PolynomialPoint3d& operator +=( const PolynomialPoint3d& pol3P) ;
|
|
PolynomialPoint3d& operator -=( const PolynomialPoint3d& pol3P) ;
|
|
PolynomialPoint3d& operator *=( const Polynomial& polP) ;
|
|
void Derive( void) ;
|
|
void Derive( const PolynomialPoint3d& pol3P) ;
|
|
void AdjustDegree( void) ;
|
|
Point3d Evaluate( double dVal) ;
|
|
int FindMainComponentRoots( DBLVECTOR& vdRoot) ;
|
|
|
|
private :
|
|
bool EnsureDegree( int nDegree) ;
|
|
|
|
private :
|
|
int m_nDegree ;
|
|
PNTVECTOR m_Coeff ;
|
|
} ;
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
// Somma
|
|
//----------------------------------------------------------------------------
|
|
inline PolynomialPoint3d
|
|
operator+( const PolynomialPoint3d& pol3P1, const PolynomialPoint3d& pol3P2)
|
|
{
|
|
PolynomialPoint3d pol3Summ = pol3P1 ;
|
|
pol3Summ += pol3P2 ;
|
|
return pol3Summ ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
// Differenza
|
|
//----------------------------------------------------------------------------
|
|
inline PolynomialPoint3d
|
|
operator-( const PolynomialPoint3d& pol3P1, const PolynomialPoint3d& pol3P2)
|
|
{
|
|
PolynomialPoint3d pol3Diff = pol3P1 ;
|
|
pol3Diff -= pol3P2 ;
|
|
return pol3Diff ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
// Moltiplicazione con un polinomio di numeri
|
|
//----------------------------------------------------------------------------
|
|
inline PolynomialPoint3d
|
|
operator*( const PolynomialPoint3d& pol3P1, const Polynomial& polP2)
|
|
{
|
|
PolynomialPoint3d pol3Mul = pol3P1 ;
|
|
pol3Mul *= polP2 ;
|
|
return pol3Mul ;
|
|
}
|