- in BeamLib aggiunta funzione GetPlaneOrientation per avere il modulo di un vettore nelle 3 direzioni e l'incidenza relativa di ogni componente sul totale

- in BLADETOWASTE, chiamate a FindBlade aggiornate
- in FACEBYBLADE numerose modifiche, da terminare, per determinare se la lavorazione è fattibile e se in DownUp (GetBladeEngagement)
This commit is contained in:
luca.mazzoleni
2025-10-28 18:22:36 +01:00
parent b8b71ff73a
commit 21bb95c0e9
3 changed files with 226 additions and 11 deletions
+33
View File
@@ -782,6 +782,39 @@ function BeamLib.FindEdgeBestOrientedAsDirection( Edges, vtDirection)
return BestEdge
end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetPlaneOrientation( vtN)
local x = vtN:getX()
local y = vtN:getY()
local z = vtN:getZ()
-- modulo della proiezione in ogni piano
local Orientation = {
{ sPlane = "XY", dMagnitude = sqrt( x^2 + y^2)},
{ sPlane = "XZ", dMagnitude = sqrt( x^2 + z^2)},
{ sPlane = "YZ", dMagnitude = sqrt( y^2 + z^2)}
}
-- modulo totale in 3d
local dTotalMagnitude = sqrt( x^2 + y^2 + z^2)
-- incidenza del modulo in ogni piano
for i = 1, #Orientation do
-- se il modulo è nullo, si restituisce 0 in tutti i piani
if dTotalMagnitude == 0 then
Orientation[i].dRelativeMagnitude = 0
-- altrimenti, si calcola l'incidenza relativa
else
Orientation[i].dRelativeMagnitude = Orientation[i].dMagnitude / dTotalMagnitude
end
end
-- si ordina per incidenza in ogni piano
table.sort( Orientation, function (a, b) return a.dRatio > b.dRatio end)
return Orientation
end
-------------------------------------------------------------------------------------------------------------
-- nNearSide : 3=Z+, -3=Z-
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, nNearSide)