- in FaceData migliorata la scelta della BottomFace 1
This commit is contained in:
+24
-2
@@ -190,6 +190,8 @@ function FaceData.GetFacesInfo( Proc, Part, FacesToGet)
|
||||
Faces[i].dArea = dShortDimension * dLongDimension
|
||||
Faces[i].dLMinRectangle = dLongDimension
|
||||
Faces[i].dWMinRectangle = dShortDimension
|
||||
-- volume approssimato di materiale asportato lavorando questa faccia
|
||||
Faces[i].dMachinedVolumeApprox = Faces[i].dArea * Faces[i].dElevation
|
||||
|
||||
local nFaceType, Edges = FaceData.GetEdgesInfo( Proc, i - 1)
|
||||
Faces[i].bIsOkForMachining = nFaceType < 1
|
||||
@@ -248,6 +250,26 @@ function FaceData.IsFaceParallelogram( Face)
|
||||
return bIsRhomboid
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CompareBottomFaces( FaceA, FaceB)
|
||||
local dMaxVolumeRelativeChange = 0.15
|
||||
-- si prende la faccia con volume lavorato maggiore
|
||||
if FaceA.dMachinedVolumeApprox > ( 1 + dMaxVolumeRelativeChange) * FaceB.dMachinedVolumeApprox + 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
elseif FaceB.dMachinedVolumeApprox > ( 1 + dMaxVolumeRelativeChange) * FaceA.dMachinedVolumeApprox + 10 * GEO.EPS_SMALL then
|
||||
return false
|
||||
-- se volume lavorato simile, si prende la faccia con minore elevazione
|
||||
else
|
||||
if FaceA.dElevation < FaceB.dElevation - 10 * GEO.EPS_SMALL then
|
||||
return true
|
||||
elseif FaceB.dElevation < FaceA.dElevation - 10 * GEO.EPS_SMALL then
|
||||
return false
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CompareEdgesBottomFace( EdgeA, EdgeB)
|
||||
-- prima i lati con facce adiacenti
|
||||
@@ -369,8 +391,8 @@ local function GetBottomFaces( Proc)
|
||||
end
|
||||
nCurrentFace = nCurrentFace + 1
|
||||
end
|
||||
-- la BottomFace 1 è sempre quella con minor elevazione
|
||||
table.sort( BottomFaces, function (a, b) return a.dElevation < b.dElevation end)
|
||||
-- la BottomFace 1 è quella che permette di asportare il volume maggiore; nei casi ambigui si sceglie quella a minor elevazione
|
||||
table.sort( BottomFaces, CompareBottomFaces)
|
||||
end
|
||||
|
||||
if #BottomFaces == 0 then
|
||||
|
||||
Reference in New Issue
Block a user