Ottimizzate le chiamate al calcolo elevazione. Si evita di calcolarla più volte inutilmente perchè calcolata inizialmente nel CollectFeatures.

This commit is contained in:
luca.mazzoleni
2023-11-29 16:07:18 +01:00
parent 593fdcfc24
commit 1664513c8f
12 changed files with 57 additions and 36 deletions
+14 -14
View File
@@ -1589,7 +1589,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
-- distanza di sicurezza per evitare collisioni
dCollSic = BL.CalcCollisionSafety( vtN1)
-- elevazione massima della faccia
dMaxElev = EgtSurfTmFacetElevationInBBox( Proc.Id, nFacInd, b3Solid, GDB_ID.ROOT)
dMaxElev = BL.GetFaceElevation( Proc, nFacInd, b3Solid)
-- ciclo tutta la tabella
local tPaths = {}
local ptIniPath
@@ -1634,7 +1634,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
-- distanza di sicurezza per evitare collisioni
dCollSic = BL.CalcCollisionSafety( vtOrtho)
-- calcolo elevazione dalla faccia trasversale aggiunta
local dSurfIntElev = EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT)
local dSurfIntElev = BL.GetFaceElevation( nSurfInt, 0, b3Solid)
if bDoubleSide then
dMaxElev = dSurfIntElev
else
@@ -1645,13 +1645,13 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
-- se non è possibile svuotare completamente da una sola parte
if dTMaxDepth <= ( dMaxElev + BD.CUT_EXTRA + dCollSic) then
bDoubleSide = true
dMaxElev = EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT)
dMaxElev = BL.GetFaceElevation( nSurfInt, 0, b3Solid)
else
dExtraDepth = dMaxElev - EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT)
dExtraDepth = dMaxElev - BL.GetFaceElevation( nSurfInt, 0, b3Solid)
end
-- altrimenti non è stata fatta completamente calcolo la distanza tra faccia aggiunta e profondità superficie
else
dExtraDepth = dMaxElev - EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT)
dExtraDepth = dMaxElev - BL.GetFaceElevation( nSurfInt, 0, b3Solid)
end
end
-- normale alla faccia aggiunta
@@ -4240,7 +4240,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
dCheckDepth = 0.5 * dDepth
else
if not nPathInt then
dCheckDepth = EgtSurfTmFacetElevationInBBox( Proc.Id, nFacInd, b3Solid, GDB_ID.ROOT)
dCheckDepth = BL.GetFaceElevation( Proc, nFacInd, b3Solid)
else
dCheckDepth = dDepth
end
@@ -4289,7 +4289,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
end
local ptIniPath
local nMaxLen = 0
dMaxElevMaster = EgtSurfTmFacetElevationInBBox( Proc.Id, nFacInd, b3Solid, GDB_ID.ROOT)
dMaxElevMaster = BL.GetFaceElevation( Proc, nFacInd, b3Solid)
-- ciclo tutta la tabella
for i = 1, #tFacAdjMain do
-- le 2 facce di contatto devono essere perpendicolari o non sottosquadra rispetto alla faccia di fondo
@@ -4348,13 +4348,13 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw,
-- se non è possibile svuotare completamente da una sola parte
if dMaxDepth <= ( dMaxElevMaster + BD.CUT_EXTRA + dCollSic) then
bDoubleSide = true
dMaxElevMaster = EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT)
dMaxElevMaster = BL.GetFaceElevation( nSurfInt, 0, b3Solid)
else
dExtraDepth = dMaxElevMaster - EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT)
dExtraDepth = dMaxElevMaster - BL.GetFaceElevation( nSurfInt, 0, b3Solid)
end
-- altrimenti non è stata fatta completamente calcolo la distanza tra faccia aggiunta e profondità superficie
else
dExtraDepth = dMaxElevMaster - EgtSurfTmFacetElevationInBBox( nSurfInt, 0, b3Solid, GDB_ID.ROOT)
else
dExtraDepth = dMaxElevMaster - BL.GetFaceElevation( nSurfInt, 0, b3Solid)
end
end
vtN1 = Vector3d(vtOrtho)
@@ -4897,7 +4897,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
return false, sErr
end
nFacInd = nFacAdj
dFacElev = EgtSurfTmFacetElevationInBBox( Proc.Id, nFacInd, b3Solid, GDB_ID.ROOT)
dFacElev = BL.GetFaceElevation( Proc, nFacInd, b3Solid)
ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
end
@@ -5159,7 +5159,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
local tvtNx = {}
tvtNx[2] = vtN
local ptPs = ptC
dFacElev = EgtSurfTmFacetElevationInBBox( Proc.Id, nFacInd, b3Solid, GDB_ID.ROOT)
dFacElev = BL.GetFaceElevation( Proc, nFacInd, b3Solid)
dCollSic = BL.CalcCollisionSafety( tvtNx[2])
local dMachDepth = dFacElev + dCollSic
local frFacRec, dFacDim1, dFacDim2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
@@ -5181,7 +5181,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
end
vAdj[i] = nCount
if vAdj[i] == Proc.Fct - 1 and i ~= nFacInd + 1 then
dV = EgtSurfTmFacetElevationInBBox( Proc.Id, i - 1, b3Solid, GDB_ID.ROOT)
dV = BL.GetFaceElevation( Proc, i - 1, b3Solid)
vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT)
end
end