This commit is contained in:
Daniele Bariletti
2026-03-16 17:07:22 +01:00
5 changed files with 36 additions and 78 deletions
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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]) ;
}
+10 -10
View File
@@ -48,7 +48,7 @@ LuaSurfIsClosed( lua_State* L)
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// verifico se è superficie chiusa
// verifico se superficie chiusa
bool bOk = ExeSurfIsClosed( nId) ;
LuaSetParam( L, bOk) ;
return 1 ;
@@ -218,7 +218,7 @@ LuaSurfFrMoveSimpleNoCollision( lua_State* L)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// verifico quale è la massima traslazione possibile
// verifico quale la massima traslazione possibile
double dLen = vtMove.Len() ;
Vector3d vtDir = ( dLen > EPS_SMALL ? vtMove / dLen : V_NULL) ;
bool bOk = ExeSurfFrMoveSimpleNoCollision( nId1, nId2, vtDir, dLen, nRefType) ;
@@ -246,7 +246,7 @@ LuaSurfFrRotateSimpleNoCollision( lua_State* L)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// verifico quale è la massima (in valore assoluto) rotazione possibile
// verifico quale la massima (in valore assoluto) rotazione possibile
bool bOk = ExeSurfFrRotateSimpleNoCollision( nId1, nId2, ptCen, dAngDeg, nRefType) ;
// restituisco il risultato
if ( bOk)
@@ -354,7 +354,7 @@ LuaSurfTmGetNearestVertex( lua_State* L)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero il vertice più vicino della superficie
// recupero il vertice pi vicino della superficie
int nVert ;
Point3d ptVert ;
bool bOk = ExeSurfTmGetNearestVertex( nId, ptNear, nRefId, nVert, ptVert) ;
@@ -575,7 +575,7 @@ LuaSurfTmFacetNearestEndPoint( lua_State* L)
int nRefId = nId ;
LuaGetParam( L, 4, nRefId) ;
LuaClearStack( L) ;
// recupero il punto End più vicino della faccia della superficie trimesh
// recupero il punto End pi vicino della faccia della superficie trimesh
Point3d ptEnd ;
Vector3d vtN ;
if ( ExeSurfTmFacetNearestEndPoint( nId, nFacet, ptNear, nRefId, ptEnd, vtN)) {
@@ -603,7 +603,7 @@ LuaSurfTmFacetNearestMidPoint( lua_State* L)
int nRefId = nId ;
LuaGetParam( L, 4, nRefId) ;
LuaClearStack( L) ;
// recupero il punto Mid più vicino della faccia della superficie trimesh
// recupero il punto Mid pi vicino della faccia della superficie trimesh
Point3d ptMid ;
Vector3d vtN ;
if ( ExeSurfTmFacetNearestMidPoint( nId, nFacet, ptNear, nRefId, ptMid, vtN)) {
@@ -1163,18 +1163,18 @@ 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) ;