- in BLADETOWASTE correzione importante

- in BeamLib aggiunte funzioni ReverseTablePortionInPlace e RotateTableFromIndexInPlace
This commit is contained in:
luca.mazzoleni
2026-06-30 15:04:16 +02:00
parent 9706f218a8
commit 3f0654c655
2 changed files with 27 additions and 7 deletions
+26 -6
View File
@@ -961,16 +961,36 @@ function BeamLib.ConvertBitIndexToRotationIndex( sBitIndexCombination)
return nRotationIndex
end
-------------------------------------------------------------------------------------------------------------
-- inverte la porzione tra nStartIndex e nEndIndex della tabella passata
local function ReverseTablePortionInPlace( Table, nStartIndex, nEndIndex)
while nStartIndex < nEndIndex do
Table[nStartIndex], Table[nEndIndex] = Table[nEndIndex], Table[nStartIndex]
nStartIndex = nStartIndex + 1
nEndIndex = nEndIndex - 1
end
return Table
end
-------------------------------------------------------------------------------------------------------------
-- reindicizza una tabella passata ripartendo dall'indice nStartIndex e mantenendo l'ordine
function BeamLib.RotateTableFromIndex( Table, nStartIndex)
local RotatedTable = {}
function BeamLib.RotateTableFromIndexInPlace( Table, nStartIndex)
local dLen = #Table
for i = 1, #Table do
RotatedTable[#RotatedTable + 1] = Table[((RotatedTable + i - 2) % #Table) + 1]
end
-- Nessuna rotazione necessaria se la tabella è vuota, ha 1 solo elemento, o la rotazione è dall'indice 1
if dLen <= 1 or nStartIndex <= 1 or nStartIndex > dLen then
return Table
end
return RotatedTable
local k = nStartIndex - 1
ReverseTablePortionInPlace( Table, 1, k) -- 1. Inverte la parte inziale
ReverseTablePortionInPlace( Table, k + 1, dLen) -- 2. Inverte la parte finale
ReverseTablePortionInPlace( Table, 1, dLen) -- 3. Inverte tutto
return Table
end
-------------------------------------------------------------------------------------------------------------
+1 -1
View File
@@ -845,7 +845,7 @@ local function CalculateDiceMachinings( vCuts, Parameters)
local bReduceDiceDepth = Parameters.bReduceDiceDepth
-- trimesh con RestLength
local idCheckCollisionTm = Part.idBoxTm
local idCheckCollisionTm = EgtCopyGlob( Part.idBoxTm, Part.idTempGroup)
-- se testa o coda attaccate, si considerano nella superficie di collisione
if bCannotSplitRestLength then
local b3CheckCollision = BeamLib.GetPartBoxWithHeadTail( Part, sRestLengthSideForPreSimulation)