- in PreCollisionLib ottimizzazioni tempi di esecuzione

- in TempGroup  le geometrie sono settate azzurre con alpha 5
This commit is contained in:
luca.mazzoleni
2025-11-26 15:00:12 +01:00
parent 86adb74131
commit 155fd09ee5
2 changed files with 8 additions and 40 deletions
+7 -40
View File
@@ -86,11 +86,11 @@ local function GetMachiningPoints( Edge, dDepthToMachine)
-- aggiunta punti
-- inizio e fine solo se lato obliquo
if bIsEdgeParallelToMainDirection then
if not bIsEdgeParallelToMainDirection then
table.insert( MachiningPoints, ptStart)
end
table.insert( MachiningPoints, ptMid)
if bIsEdgeParallelToMainDirection then
if not bIsEdgeParallelToMainDirection then
table.insert( MachiningPoints, ptEnd)
end
@@ -133,10 +133,6 @@ function PreCollisionLib.CheckCollisionAxisZ( Edge, vtNFace, vtHead, Part, Tool,
{ vtDirectionX = X_AX(), vtDirectionY = Y_AX(), vtDirectionZ = Z_AX(), sDirectionName = 'Z'}
}
-- TEST
local Color = Color3d( math.random(0, 255), math.random(0, 255), math.random(0, 255))
-- TEST
local bMoveAfterSplit = false
-- nel singolo punto notevole si ha collisione se si trova intersezione in tutte le direzioni
@@ -162,9 +158,6 @@ function PreCollisionLib.CheckCollisionAxisZ( Edge, vtNFace, vtHead, Part, Tool,
local CollisionCurvePoints = Tool.SetupInfo.GetAxisPoints( 'Z', sDirectionName)
-- curva di collisione in riferimento locale
local idCollisionCurve = EgtCurveCompoFromPoints( Part.idTempGroup, CollisionCurvePoints)
-- TEST
EgtSetColor( idCollisionCurve, Color)
-- TEST
-- curva in riferimento globale
local frReference = Frame3d( ptPivot, vtDirectionZ, vtDirectionX)
EgtTransform( idCollisionCurve, frReference, GDB_RT.GLOB )
@@ -177,24 +170,16 @@ function PreCollisionLib.CheckCollisionAxisZ( Edge, vtNFace, vtHead, Part, Tool,
local bCollisionFoundPiece = false
if nCollisionCountPiece == j - 1 then
local idPartSurfFr = GetPartSurfFrInPlane( Part, vtDirectionZ)
local bIntersectSuccess = EgtSurfFrIntersect( idPartSurfFr, idCollisionSurfFr)
if not bIntersectSuccess then
error( 'CheckCollision : intersect fail')
end
bCollisionFoundPiece = EgtExistsObj( idPartSurfFr)
bCollisionFoundPiece = not EgtSurfFrTestExternal( idPartSurfFr, idCollisionSurfFr)
end
-- check collisione con grezzo restante, se con il pezzo non c'è collisione
local bCollisionFoundRestLength = false
if not bCollisionFoundPiece then
local idRestLengthSurfFr = GetRestlengthSurfFrInPlane( Part, vtDirectionZ)
local bIntersectSuccess = EgtSurfFrIntersect( idRestLengthSurfFr, idCollisionSurfFr)
if not bIntersectSuccess then
error( 'CheckCollision : intersect fail')
end
bCollisionFoundRestLength = EgtExistsObj( idRestLengthSurfFr)
bCollisionFoundRestLength = not EgtSurfFrTestExternal( idRestLengthSurfFr, idCollisionSurfFr)
end
-- se non trovata collisione si passa al punto successivo
@@ -262,31 +247,13 @@ function PreCollisionLib.CheckCollisionAxisAB( Edge, vtNFace, vtHead, Part, Tool
-- flat region dal rettangolo
local idHeadSurfFr = EgtSurfFlatRegion( Part.idTempGroup, idHeadRectangle)
-- intersezione tra pezzo e motore (se fallisce si inverte la flat region del motore, probabile normale opposta)
local bIntersectSuccess = EgtSurfFrIntersect( idPartSurfFr, idHeadSurfFr)
if not bIntersectSuccess then
EgtInvertSurf( idHeadSurfFr)
bIntersectSuccess = EgtSurfFrIntersect( idPartSurfFr, idHeadSurfFr)
end
if not bIntersectSuccess then
error( 'Check2DBladeCollision : intersect fail')
end
local bCollisionFoundPiece = EgtExistsObj( idPartSurfFr)
-- intersezione tra pezzo e motore
local bCollisionFoundPiece = not EgtSurfFrTestExternal( idPartSurfFr, idHeadSurfFr)
-- intersezione tra grezzo restante e motore, se con il pezzo non c'è collisione
local bCollisionFoundRestLength
if not bCollisionFoundPiece then
bIntersectSuccess = EgtSurfFrIntersect( idRestlengthSurfFr, idHeadSurfFr)
if not bIntersectSuccess then
EgtInvertSurf( idHeadSurfFr)
bIntersectSuccess = EgtSurfFrIntersect( idRestlengthSurfFr, idHeadSurfFr)
end
if not bIntersectSuccess then
error( 'Check2DBladeCollision : intersect fail')
end
bCollisionFoundRestLength = EgtExistsObj( idRestlengthSurfFr)
bCollisionFoundRestLength = not EgtSurfFrTestExternal( idRestlengthSurfFr, idHeadSurfFr)
end
return bCollisionFoundPiece, bCollisionFoundRestLength