- in BatchProcessNew e BeamExec, dove si salva il Box del Part si salva anche idBoxTm, id della trimesh del box
- in BeamLib rimosse funzioni GetPlaneOrientation e IsEdgeOnBox, non usate - in MachiningLib rivista completamente GetBladeEngagement e aggiunta Check2DBladeCollision
This commit is contained in:
@@ -785,77 +785,6 @@ 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 = EgtClamp( sqrt( x^2 + y^2), 0, 1)},
|
||||
{ sPlane = "XZ", dMagnitude = EgtClamp( sqrt( x^2 + z^2), 0, 1)},
|
||||
{ sPlane = "YZ", dMagnitude = EgtClamp( sqrt( y^2 + z^2), 0, 1)}
|
||||
}
|
||||
|
||||
-- modulo totale in 3d
|
||||
local dTotalMagnitude = EgtClamp( sqrt( x^2 + y^2 + z^2), 0, 1)
|
||||
|
||||
-- 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.dRelativeMagnitude > b.dRelativeMagnitude end)
|
||||
|
||||
return Orientation
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.IsEdgeOnBox( Face, Edge, b3Box)
|
||||
-- TODO sostituire con informazioni direttamente da box e rimuuovere il parametro Face
|
||||
local ptEdge1, _, ptEdge2 = EgtSurfTmFacetOppositeSide( Face.idTrimesh, Face.id, -Edge.vtN, GDB_ID.ROOT)
|
||||
|
||||
-- il lato è sul box se i suoi estremi sono entrambi sullo stesso lato del box
|
||||
if ptEdge1:getZ() > b3Box:getMax():getZ() - 500 * GEO.EPS_SMALL
|
||||
and ptEdge2:getZ() > b3Box:getMax():getZ() - 500 * GEO.EPS_SMALL then
|
||||
|
||||
return true
|
||||
end
|
||||
if ptEdge1:getZ() > b3Box:getMin():getZ() - 500 * GEO.EPS_SMALL
|
||||
and ptEdge2:getZ() > b3Box:getMin():getZ() - 500 * GEO.EPS_SMALL then
|
||||
|
||||
return true
|
||||
end
|
||||
if ptEdge1:getY() > b3Box:getMax():getY() - 500 * GEO.EPS_SMALL
|
||||
and ptEdge2:getY() > b3Box:getMax():getY() - 500 * GEO.EPS_SMALL then
|
||||
|
||||
return true
|
||||
end
|
||||
if ptEdge1:getY() > b3Box:getMin():getY() - 500 * GEO.EPS_SMALL
|
||||
and ptEdge2:getY() > b3Box:getMin():getY() - 500 * GEO.EPS_SMALL then
|
||||
|
||||
return true
|
||||
end
|
||||
if ptEdge1:getX() > b3Box:getMax():getX() - 500 * GEO.EPS_SMALL
|
||||
and ptEdge2:getX() > b3Box:getMax():getX() - 500 * GEO.EPS_SMALL then
|
||||
|
||||
return true
|
||||
end
|
||||
if ptEdge1:getX() > b3Box:getMin():getX() - 500 * GEO.EPS_SMALL
|
||||
and ptEdge2:getX() > b3Box:getMin():getX() - 500 * GEO.EPS_SMALL then
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- nNearSide : 3=Z+, -3=Z-
|
||||
function BeamLib.PutStartNearestToEdge( nCrvId, b3Raw, dMaxDist, nNearSide)
|
||||
|
||||
Reference in New Issue
Block a user