EgtExecutor :
- la funzione Exe/Lua SurfBezierParamsFromPoint ora restituisce solo i valori dei parametri U e V che corrispondono al punto - piccole migliorie.
This commit is contained in:
@@ -23,7 +23,7 @@ using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExePocketing( const int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
|
||||
ExePocketing( int nId, double dRad, double dStep, double dAngle, int nType, bool bSmooth, int nDestGrpId,
|
||||
int& nFirstId, int& nCrvCount)
|
||||
{
|
||||
// database geometrico
|
||||
|
||||
+12
-54
@@ -48,9 +48,6 @@ ExeSurfArea( int nId, double& dArea)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( &dArea == nullptr)
|
||||
return false ;
|
||||
// recupero la superficie
|
||||
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
|
||||
// ne restituisco l'area
|
||||
@@ -75,9 +72,6 @@ ExeSurfVolume( int nId, double& dVol)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( &dVol == nullptr)
|
||||
return false ;
|
||||
// recupero la superficie
|
||||
ISurf* pSurf = GetSurf( pGeomDB->GetGeoObj( nId)) ;
|
||||
// ne restituisco l'eventuale volume (se è chiusa)
|
||||
@@ -106,9 +100,6 @@ ExeSurfFrGrossArea( int nId, double& dArea)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( &dArea == nullptr)
|
||||
return false ;
|
||||
// recupero la Regione
|
||||
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
|
||||
// ne restituisco l'area senza eventuali buchi
|
||||
@@ -220,9 +211,6 @@ ExeSurfFrChunkMaxOffset( int nId, int nChunk, double& dMaxOffset)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// verifico il parametro
|
||||
if ( &dMaxOffset == nullptr)
|
||||
return false ;
|
||||
// recupero la Regione
|
||||
const ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ;
|
||||
return ( pSfr != nullptr && pSfr->GetChunkMaxOffset( nChunk, dMaxOffset)) ;
|
||||
@@ -1587,7 +1575,7 @@ ExeSurfBezierGetPointNrmD1( int nSurfId, double dU, double dV, int nUsd, int nVs
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
static int
|
||||
MySurfBezierGetCurveUV( int nSurfId, bool bIsU, double dPar, int nDestGrpId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
@@ -1674,55 +1662,25 @@ ExeSurfBezierGetCurveV( int nSurfId, double dU, int nDestGrpId)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfBezParamsFromPoint( int nSurfId, const Point3d& ptOnSurf, int nDestGrpId, double& dU, double& dV)
|
||||
ExeSurfBezierParamsFromPoint( int nSurfId, const Point3d& ptOnSurf, int nRefId, double& dU, double& dV)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie di Bezier
|
||||
const ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nSurfId)) ;
|
||||
if ( pSbz == nullptr)
|
||||
return false ;
|
||||
// porto il punto Near nel riferimento dell'entità
|
||||
Point3d ptOnSurfL = ptOnSurf ;
|
||||
if ( ! InvTransformPoint( pGeomDB, nSurfId, nRefId, ptOnSurfL))
|
||||
return false ;
|
||||
// determino i parametri corrispondenti al punto
|
||||
Point3d ptParam ;
|
||||
Point3d ptBez ;
|
||||
if ( ! pSbz->UnprojectPoint( ptOnSurf, ptParam, P_INVALID))
|
||||
if ( ! pSbz->UnprojectPoint( ptOnSurfL, ptParam, P_INVALID))
|
||||
return false ;
|
||||
dU = ptParam.x ;
|
||||
dV = ptParam.y ;
|
||||
|
||||
if ( nDestGrpId != GDB_ID_NULL) {
|
||||
Vector3d vtNorm, vtDerU, vtDerV ;
|
||||
pSbz->GetPointNrmD1D2( ptParam.x, ptParam.y, ISurfBezier::Side::FROM_MINUS, ISurfBezier::Side::FROM_MINUS, ptBez, vtNorm, &vtDerU, &vtDerV) ;
|
||||
|
||||
PtrOwner<IGeoPoint3d> ptChosen( CreateGeoPoint3d()) ;
|
||||
ptChosen->Set( ptOnSurf) ;
|
||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( ptChosen)) ;
|
||||
INTVECTOR vIds ; vIds.push_back( nId) ;
|
||||
ExeSetColor( vIds, Color(255,0,128), false) ;
|
||||
PtrOwner<IGeoPoint3d> ptRefined( CreateGeoPoint3d()) ;
|
||||
|
||||
//// punto reale sulla superficie
|
||||
//ptRefined->Set( ptBez) ;
|
||||
//nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( ptRefined)) ;
|
||||
//vIds.clear() ; vIds.push_back( nId) ;
|
||||
//ExeSetColor( vIds, Color(128,0,255), false) ;
|
||||
//if ( ! AreSamePointEpsilon( ptBez, ptOnSurf, 100 * EPS_SMALL)) {
|
||||
//// i due punti possono essere distanti fino alla tolleranza usata per triangolare la superficie
|
||||
//return false ;
|
||||
//}
|
||||
PtrOwner<IGeoVector3d> vtGeoNorm( CreateGeoVector3d()) ; vtGeoNorm->Set( vtNorm, ptOnSurf) ;
|
||||
nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vtGeoNorm)) ;
|
||||
vIds.push_back( nId) ;
|
||||
ExeSetColor( vIds, Color(255,0,0), false) ;
|
||||
PtrOwner<IGeoVector3d> vtGeoDerU( CreateGeoVector3d()) ; vtGeoDerU->Set( vtDerU, ptOnSurf) ;
|
||||
nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vtGeoDerU)) ;
|
||||
vIds.clear() ; vIds.push_back( nId) ;
|
||||
ExeSetColor( vIds, Color(0,128,192), false) ;
|
||||
PtrOwner<IGeoVector3d> vtGeoDerV( CreateGeoVector3d()) ; vtGeoDerV->Set( vtDerV, ptOnSurf) ;
|
||||
nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vtGeoDerV)) ;
|
||||
vIds.clear() ; vIds.push_back( nId) ;
|
||||
ExeSetColor( vIds, Color(255,128,0), false) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -1855,7 +1813,7 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
|
||||
// recupero la superficie di Bezier
|
||||
const ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pSbz != nullptr) ;
|
||||
if( ! bOk)
|
||||
if ( ! bOk)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento della superficie
|
||||
Frame3d frSurf ;
|
||||
@@ -1905,7 +1863,7 @@ int
|
||||
ExeShowSurfBezierControlPoints( int nSrfId, int nDestGrpId, int* pnCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la superficie di bezier
|
||||
IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nSrfId) ;
|
||||
if ( pGeoObj->GetType() != SRF_BEZIER)
|
||||
@@ -1939,4 +1897,4 @@ ExeShowSurfBezierControlPoints( int nSrfId, int nDestGrpId, int* pnCount)
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -47,8 +47,8 @@
|
||||
using namespace std ;
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, const int nRefType,
|
||||
static bool
|
||||
MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
|
||||
INTDBLVECTOR& vInters)
|
||||
{
|
||||
vInters.clear() ;
|
||||
@@ -127,7 +127,7 @@ MyLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, con
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, const int nId, const int nRefType,
|
||||
ExeLineCurveInters( const Point3d& ptP, const Vector3d& vtDir, int nId, int nRefType,
|
||||
INTDBLVECTOR& vInters)
|
||||
{
|
||||
// eseguo
|
||||
@@ -475,8 +475,8 @@ MyAddPlaneIntersResultToGeomDB( IGeomDB* pGeomDB, const PNTVECTOR& vPnt, const B
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
MyPlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, const int nDestGrpId, const int nRefType, int& nCount)
|
||||
static int
|
||||
MyPlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDestGrpId, int nRefType, int& nCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
@@ -573,7 +573,7 @@ MyPlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, con
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExePlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, const int nId, const int nDestGrpId, const int nRefType, int* pnCount)
|
||||
ExePlaneCurveInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nDestGrpId, int nRefType, int* pnCount)
|
||||
{
|
||||
// eseguo
|
||||
int nCount{ 0} ;
|
||||
@@ -1036,8 +1036,8 @@ ExePlaneVolZmapInters( const Point3d& ptOn, const Vector3d& vtN, int nId, int nD
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& nPntCount, int& nCrvCount, bool bOnly3D)
|
||||
static int
|
||||
MyCurveCurveInters( int nId1, int nId2, int nDestGrpId, int& nPntCount, int& nCrvCount, bool bOnly3D)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
@@ -1116,7 +1116,7 @@ MyCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int& n
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCurveCurveInters( const int nId1, const int nId2, const int nDestGrpId, int* pnPntCount, int* pnCrvCount, bool bOnly3D)
|
||||
ExeCurveCurveInters( int nId1, int nId2, int nDestGrpId, int* pnPntCount, int* pnCrvCount, bool bOnly3D)
|
||||
{
|
||||
// eseguo
|
||||
int nPntCount{ 0}, nCrvCount{ 0} ;
|
||||
@@ -1161,7 +1161,7 @@ GetCurveSurfTmIntersType( int nFlag)
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
MyCurveSurfTmInters( const int nCrvId, const int nId2, const int nDestGrpId, int& nPntCount, int& nCrvCount)
|
||||
MyCurveSurfTmInters( int nCrvId, int nId2, int nDestGrpId, int& nPntCount, int& nCrvCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
@@ -1243,7 +1243,7 @@ MyCurveSurfTmInters( const int nCrvId, const int nId2, const int nDestGrpId, int
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCurveSurfTmInters( const int nCrvId, const int nStmId, const int nDestGrpId, int* pnPntCount, int* pnCrvCount)
|
||||
ExeCurveSurfTmInters( int nCrvId, int nStmId, int nDestGrpId, int* pnPntCount, int* pnCrvCount)
|
||||
{
|
||||
// eseguo
|
||||
int nPntCount{ 0}, nCrvCount{ 0} ;
|
||||
|
||||
+2
-2
@@ -72,7 +72,7 @@ ExeTrimmingGetHoleBorder( int nParentId, const INTVECTOR& vSurfIds, const INTVEC
|
||||
Point3d ptRef = P_INVALID ;
|
||||
if ( ! vOtherSurfIds.empty()) {
|
||||
int nToTSurf = 0 ;
|
||||
for ( const int& nOtherSurfId : vOtherSurfIds) {
|
||||
for ( int nOtherSurfId : vOtherSurfIds) {
|
||||
// Recupero l'entità
|
||||
const IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nOtherSurfId) ;
|
||||
if ( pGeoObj != nullptr) {
|
||||
@@ -288,7 +288,7 @@ ExeTrimmingGetAdjSurfs( const INTVECTOR& vSurfId, const INTVECTOR& vOtherSurfId,
|
||||
INTVECTOR vMyInds ;
|
||||
bOk = bOk && GetTrimmingAdjSurfs( vRefSurf, vOtherSurf, dLinTol, dAngTol, dAngFaceTol, vMyInds) ;
|
||||
if ( bOk) {
|
||||
for ( const int& myInd : vMyInds)
|
||||
for ( int myInd : vMyInds)
|
||||
vResId.push_back( vIds[myInd]) ;
|
||||
}
|
||||
|
||||
|
||||
+8
-6
@@ -1163,26 +1163,28 @@ LuaSurfBezierGetCurveV( lua_State* L)
|
||||
static int
|
||||
LuaSurfBezParamsFromPoint( lua_State* L)
|
||||
{
|
||||
// 3 parametri : nSurfId, ptOnSurf, nDestGrp
|
||||
// 2 o 3 parametri : nSurfId, ptOnSurf [, nRefId]
|
||||
int nSurfId ;
|
||||
LuaCheckParam( L, 1, nSurfId)
|
||||
Point3d ptOnSurf ;
|
||||
LuaCheckParam( L, 2, ptOnSurf)
|
||||
int nDestGrp ;
|
||||
LuaCheckParam( L, 3, nDestGrp)
|
||||
int nRefId = nSurfId ;
|
||||
LuaGetParam( L, 3, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero le coordinate parametriche del punto
|
||||
double dU = - 1 ;
|
||||
double dV = - 1 ;
|
||||
bool bOk = ExeSurfBezParamsFromPoint( nSurfId, ptOnSurf, nDestGrp, dU, dV) ;
|
||||
bool bOk = ExeSurfBezierParamsFromPoint( nSurfId, ptOnSurf, nRefId, dU, dV) ;
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, dU) ;
|
||||
LuaSetParam( L, dV) ;
|
||||
}
|
||||
else
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
LuaSetParam( L) ;
|
||||
}
|
||||
|
||||
return 1 ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user