EgtInterface 1.6c2 :

- esplosione curva di Bezier ora dà composita di archi e rette
- aggiunte funzioni per creazione circonferenze e archi con tangenze.
This commit is contained in:
Dario Sassi
2015-03-16 07:41:34 +00:00
parent 2d04a08827
commit 4fe226fd74
4 changed files with 348 additions and 100 deletions
+242 -88
View File
@@ -27,6 +27,10 @@
#include "/EgtDev/Include/EGkLinePerpTwoCurves.h"
#include "/EgtDev/Include/EGkLineTgCurvePerpCurve.h"
#include "/EgtDev/Include/EgkCurveArc.h"
#include "/EgtDev/Include/EgkCircleCenTgCurve.h"
#include "/EgtDev/Include/EgkArcSpecial.h"
#include "/EgtDev/Include/EgkArcPntDirTgCurve.h"
#include "/EgtDev/Include/EgkArcCenTgCurvePnt.h"
#include "/EgtDev/Include/EgkCurveBezier.h"
#include "/EgtDev/Include/EgkCurveComposite.h"
#include "/EgtDev/Include/EgkChainCurves.h"
@@ -104,8 +108,7 @@ __stdcall EgtCreateCurveLineEx( int nParentId, const double ptIni[3], int nSepI,
PtrOwner<ICurveLine> pCrvLine ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti e il versore estrusione
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
Point3d ptFinL = GetPointLocal( pGeomDB, ptFin, nRefType, frLoc) ;
@@ -113,86 +116,74 @@ __stdcall EgtCreateCurveLineEx( int nParentId, const double ptIni[3], int nSepI,
// 1 - se punti entrambi definiti
if ( nSepI == SEP_STD && nSepF == SEP_STD) {
pCrvLine.Set( CreateCurveLine()) ;
if ( IsNull( pCrvLine))
return GDB_ID_NULL ;
if ( ! pCrvLine->Set( ptIniL, ptFinL))
return GDB_ID_NULL ;
bOk = bOk && ! IsNull( pCrvLine) ;
bOk = bOk && pCrvLine->Set( ptIniL, ptFinL) ;
}
// 2 - se primo punto definito e secondo a minima distanza
else if ( nSepI == SEP_STD && nSepF == SEP_MINDIST) {
pCrvLine.Set( CreateLinePointMinDistCurve( pGeomDB, nParentId, ptIniL, ptFinL, nIdF)) ;
if ( IsNull( pCrvLine))
return GDB_ID_NULL ;
bOk = bOk && ! IsNull( pCrvLine) ;
}
// 3 - se primo punto a minima distanza e secondo definito
else if ( nSepI == SEP_MINDIST && nSepF == SEP_STD) {
pCrvLine.Set( CreateLinePointMinDistCurve( pGeomDB, nParentId, ptFinL, ptIniL, nIdI)) ;
if ( IsNull( pCrvLine))
return GDB_ID_NULL ;
pCrvLine->Invert() ;
bOk = bOk && ! IsNull( pCrvLine) ;
bOk = bOk && pCrvLine->Invert() ;
}
// 4 - se primo punto definito e secondo tangente
else if ( nSepI == SEP_STD && nSepF == SEP_TG) {
pCrvLine.Set( CreateLinePointTgCurve( pGeomDB, nParentId, ptIniL, ptFinL, nIdF)) ;
if ( IsNull( pCrvLine))
return GDB_ID_NULL ;
bOk = bOk && ! IsNull( pCrvLine) ;
}
// 5 - se primo punto tangente e secondo definito
else if ( nSepI == SEP_TG && nSepF == SEP_STD) {
// costruisco la curva al contrario e poi la inverto
pCrvLine.Set( CreateLinePointTgCurve( pGeomDB, nParentId, ptFinL, ptIniL, nIdI)) ;
if ( IsNull( pCrvLine))
return GDB_ID_NULL ;
pCrvLine->Invert() ;
bOk = bOk && ! IsNull( pCrvLine) ;
bOk = bOk && pCrvLine->Invert() ;
}
// 6 - se entrambi i punti tangenti
else if ( nSepI == SEP_TG && nSepF == SEP_TG) {
pCrvLine.Set( CreateLineTgTwoCurves( pGeomDB, nParentId, ptIniL, nIdI, ptFinL, nIdF)) ;
if ( IsNull( pCrvLine))
return GDB_ID_NULL ;
bOk = bOk && ! IsNull( pCrvLine) ;
}
// 7 - se primo punto definito e secondo perpendicolare
else if ( nSepI == SEP_STD && nSepF == SEP_PERP) {
pCrvLine.Set( CreateLinePointPerpCurve( pGeomDB, nParentId, ptIniL, ptFinL, nIdF)) ;
if ( IsNull( pCrvLine))
return GDB_ID_NULL ;
bOk = bOk && ! IsNull( pCrvLine) ;
}
// 8 - se primo punto perpendicolare e secondo definito
else if ( nSepI == SEP_PERP && nSepF == SEP_STD) {
// costruisco la curva al contrario e poi la inverto
pCrvLine.Set( CreateLinePointPerpCurve( pGeomDB, nParentId, ptFinL, ptIniL, nIdI)) ;
if ( IsNull( pCrvLine))
return GDB_ID_NULL ;
pCrvLine->Invert() ;
bOk = bOk && ! IsNull( pCrvLine) ;
bOk = bOk && pCrvLine->Invert() ;
}
// 9 - se entrambi i punti perpendicolari
else if ( nSepI == SEP_PERP && nSepF == SEP_PERP) {
pCrvLine.Set( CreateLinePerpTwoCurves( pGeomDB, nParentId, ptIniL, nIdI, ptFinL, nIdF)) ;
if ( IsNull( pCrvLine))
return GDB_ID_NULL ;
bOk = bOk && ! IsNull( pCrvLine) ;
}
// 10 - se primo punto tangente e secondo perpendicolare
else if ( nSepI == SEP_TG && nSepF == SEP_PERP) {
pCrvLine.Set( CreateLineTgCurvePerpCurve( pGeomDB, nParentId, ptIniL, nIdI, ptFinL, nIdF)) ;
if ( IsNull( pCrvLine))
return GDB_ID_NULL ;
bOk = bOk && ! IsNull( pCrvLine) ;
}
// 11 - se primo punto perpendicolare e secondo tangente
else if ( nSepI == SEP_PERP && nSepF == SEP_TG) {
// costruisco la curva al contrario e poi la inverto
pCrvLine.Set( CreateLineTgCurvePerpCurve( pGeomDB, nParentId, ptFinL, nIdF, ptIniL, nIdI)) ;
if ( IsNull( pCrvLine))
return GDB_ID_NULL ;
pCrvLine->Invert() ;
bOk = bOk && ! IsNull( pCrvLine) ;
bOk = bOk && pCrvLine->Invert() ;
}
// errore
else {
return GDB_ID_NULL ;
bOk = false ;
}
// assegno il versore estrusione
pCrvLine->SetExtrusion( vtExtrL) ;
bOk = bOk && pCrvLine->SetExtrusion( vtExtrL) ;
// inserisco la linea nel DB
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvLine)) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvLine)) : GDB_ID_NULL) ;
EgtSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -630,12 +621,10 @@ __stdcall EgtCreateCurveCircleCPN( int nParentId, const double ptCen[3],
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
if ( IsNull( pCrvArc))
return GDB_ID_NULL ;
bool bOk = ! IsNull( pCrvArc) ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti e i versori
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
@@ -644,12 +633,11 @@ __stdcall EgtCreateCurveCircleCPN( int nParentId, const double ptCen[3],
// calcolo il raggio
double dRad = (( ptOnL - ptCenL) ^ vtNL).Len() ;
// setto la circonferenza
if ( ! pCrvArc->Set( ptCenL, vtNL, dRad))
return GDB_ID_NULL ;
bOk = bOk && pCrvArc->Set( ptCenL, vtNL, dRad) ;
// assegno il versore estrusione
pCrvArc->SetExtrusion( vtExtrL) ;
bOk = bOk && pCrvArc->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) : GDB_ID_NULL) ;
EgtSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -665,6 +653,65 @@ __stdcall EgtCreateCurveCircleCPN( int nParentId, const double ptCen[3],
return nId ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCircleCPNEx( int nParentId, const double ptCen[3],
const double ptOn[3], int nSepO, int nIdO, const double vtN[3], int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo l'arco
PtrOwner<ICurveArc> pCrvArc ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti e i versori
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
// se punto standard
if ( nSepO == SEP_STD) {
pCrvArc.Set( CreateCurveArc()) ;
bOk = bOk && ! IsNull( pCrvArc) ;
// calcolo il raggio
double dRad = (( ptOnL - ptCenL) ^ vtNL).Len() ;
// setto la circonferenza
bOk = bOk && pCrvArc->Set( ptCenL, vtNL, dRad) ;
}
// se punto di tangenza, determino il vero punto di passaggio
else if ( nSepO == SEP_TG) {
// recupero la curva di tangenza in locale
CurveLocal CrvTgLoc( pGeomDB, nIdO, frLoc) ;
// calcolo la circonferenza tangente a questa curva
pCrvArc.Set( GetCircleCenTgCurve( ptCenL, vtNL, *CrvTgLoc.Get(), ptOnL)) ;
bOk = bOk && ! IsNull( pCrvArc) ;
}
// altrimenti errore
else
bOk = false ;
// assegno il versore estrusione
bOk = bOk && pCrvArc->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) : GDB_ID_NULL) ;
EgtSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCircleCPNEx(" + ToString( nParentId) + ",{" +
ToString( Point3d( ptCen)) + "},{" +
ToString( Point3d( ptOn)) + "}," +
SepToString( nSepO) + "," +
ToString( nIdO) + ",{" +
ToString( Vector3d( vtN)) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCircle3P( int nParentId, const double ptP1[3],
@@ -797,6 +844,67 @@ __stdcall EgtCreateCurveArcC2PN( int nParentId, const double ptCen[3], const dou
return nId ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveArcC2PNEx( int nParentId, const double ptCen[3],
const double ptStart[3], int nSepS, int nIdS,
const double ptNearEnd[3], const double vtNorm[3], int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo l'arco
PtrOwner<ICurveArc> pCrvArc ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti, i versori e il versore estrusione
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
Point3d ptNearEndL = GetPointLocal( pGeomDB, ptNearEnd, nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, vtNorm, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
// se punto standard
if ( nSepS == SEP_STD) {
pCrvArc.Set( CreateCurveArc()) ;
bOk = bOk && ! IsNull( pCrvArc) ;
// setto l'arco
if ( ! pCrvArc->SetC2PN( ptCenL, ptStartL, ptNearEndL, vtNormL))
return GDB_ID_NULL ;
}
// se punto di tangenza, determino il vero punto di passaggio
else if ( nSepS == SEP_TG) {
// recupero la curva di tangenza in locale
CurveLocal CrvTgLoc( pGeomDB, nIdS, frLoc) ;
// calcolo l'arco tangente a questa curva
pCrvArc.Set( GetArcCenTgCurvePnt( ptCenL, *CrvTgLoc.Get(), ptStartL, ptNearEndL, vtNormL)) ;
bOk = bOk && ! IsNull( pCrvArc) ;
}
// altrimenti errore
else
bOk = false ;
// assegno il versore estrusione
bOk = bOk && pCrvArc->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) : GDB_ID_NULL) ;
EgtSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtArcC2PNEx(" + ToString( nParentId) + ",{" +
ToString( Point3d( ptCen)) + "},{" +
ToString( Point3d( ptStart)) + "},{" +
SepToString( nSepS) + "," +
ToString( nIdS) + ",{" +
ToString( Point3d( ptNearEnd)) + "},{" +
ToString( Vector3d( vtNorm)) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveArc3P( int nParentId, const double ptP1[3],
@@ -805,37 +913,23 @@ __stdcall EgtCreateCurveArc3P( int nParentId, const double ptP1[3],
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
if ( IsNull( pCrvArc))
return GDB_ID_NULL ;
PtrOwner<ICurve> pCrv ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti e il versore estrusione
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
Point3d ptP3L = GetPointLocal( pGeomDB, ptP3, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
int nId = GDB_ID_NULL ;
// setto l'arco
if ( pCrvArc->Set3P( ptP1L, ptP2L, ptP3L, false)) {
// assegno il versore estrusione
pCrvArc->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) ;
}
// se risulta essere una retta
else if ( ( ptP2L - ptP1L) * ( ptP3L - ptP2L) > EPS_ZERO) {
// creo e setto la retta
PtrOwner<ICurveLine> pCrvLine( CreateCurveLine()) ;
if ( ! IsNull( pCrvLine) && pCrvLine->Set( ptP1L, ptP3L)) {
// assegno il versore estrusione
pCrvLine->SetExtrusion( vtExtrL) ;
// inserisco la retta nel DB
nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvLine)) ;
}
}
pCrv.Set( GetArc3P( ptP1L, ptP2L, ptP3L, false)) ;
bOk = bOk && ! ( IsNull( pCrv)) ;
// assegno il versore estrusione
bOk = bOk && pCrv->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrv)) : GDB_ID_NULL) ;
EgtSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -858,39 +952,25 @@ __stdcall EgtCreateCurveArc2PVN( int nParentId, const double ptStart[3], const d
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo l'arco
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
if ( IsNull( pCrvArc))
return GDB_ID_NULL ;
// creo l'arco (in casi particolari retta)
PtrOwner<ICurve> pCrv ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti, i versori e il versore estrusione
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
Vector3d vtDirSL = GetVectorLocal( pGeomDB, vtDirS, nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, vtNorm, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
int nId = GDB_ID_NULL ;
// setto l'arco
if ( pCrvArc->Set2PVN( ptStartL, ptEndL, vtDirSL, vtNormL)) {
// assegno il versore estrusione
pCrvArc->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvArc)) ;
}
// se risulta essere una retta
else if ( ( ptEndL - ptStartL) * vtDirSL > EPS_ZERO) {
// creo e setto la retta
PtrOwner<ICurveLine> pCrvLine( CreateCurveLine()) ;
if ( ! IsNull( pCrvLine) && pCrvLine->Set( ptStartL, ptEndL)) {
// assegno il versore estrusione
pCrvLine->SetExtrusion( vtExtrL) ;
// inserisco la retta nel DB
nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvLine)) ;
}
}
pCrv.Set( GetArc2PVN( ptStartL, ptEndL, vtDirSL, vtNormL)) ;
bOk = bOk && ! IsNull( pCrv) ;
// assegno il versore estrusione
bOk = bOk && pCrv->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrv)) : GDB_ID_NULL) ;
EgtSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -907,6 +987,80 @@ __stdcall EgtCreateCurveArc2PVN( int nParentId, const double ptStart[3], const d
return nId ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveArc2PVNEx( int nParentId, const double ptStart[3],
const double ptEnd[3], int nSep, int nId,
const double vtDirS[3], const double vtNorm[3], int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// creo la curva ( in casi particolari potrebbe essere una retta)
PtrOwner<ICurve> pCrv ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti, i versori e il versore estrusione
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
Vector3d vtDirSL = GetVectorLocal( pGeomDB, vtDirS, nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, vtNorm, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
// se punto standard
if ( nSep == SEP_STD) {
// creo l'arco
pCrv.Set( CreateCurveArc()) ;
bOk = bOk && ! IsNull( pCrv) ;
if ( bOk) {
// imposto l'arco
if ( (dynamic_cast<ICurveArc*>(Get(pCrv)))->Set2PVN( ptStartL, ptEndL, vtDirSL, vtNormL))
;
// non riuscito, provo se risulta essere una retta
else if ( ( ptEndL - ptStartL) * vtDirSL > EPS_ZERO) {
// creo e setto la retta
pCrv.Set( CreateCurveLine()) ;
bOk = bOk && ! IsNull( pCrv) ;
bOk = bOk && (dynamic_cast<ICurveLine*>(Get(pCrv)))->Set( ptStartL, ptEndL) ;
}
// impossibile
else
bOk = false ;
}
}
// se punto di tangenza, determino il vero punto di passaggio
else if ( nSep == SEP_TG) {
// recupero la curva di tangenza in locale
CurveLocal CrvTgLoc( pGeomDB, nId, frLoc) ;
// calcolo l'arco tangente a questa curva
pCrv.Set( GetArcPntDirTgCurve( ptStartL, vtDirSL, *CrvTgLoc.Get(), ptEndL, vtNormL)) ;
bOk = bOk && ! IsNull( pCrv) ;
}
// altrimenti errore
else
bOk = false ;
// assegno il versore estrusione
bOk = bOk && pCrv->SetExtrusion( vtExtrL) ;
// inserisco l'arco nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrv)) : GDB_ID_NULL) ;
EgtSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtArc2PVNEx(" + ToString( nParentId) + ",{" +
ToString( Point3d( ptStart)) + "},{" +
ToString( Point3d( ptEnd)) + "}," +
SepToString( nSep) + "," +
ToString( nId) + ",{" +
ToString( Vector3d( vtDirS)) + "},{" +
ToString( Vector3d( vtNorm)) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nNewId ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveBezier( int nParentId, int nDegree, const double ptCtrls[], int nRefType)