3dPrinting :

- modifiche per nuova definizione di EgtCurveCurveInters.
This commit is contained in:
SaraP
2023-02-01 09:36:43 +01:00
parent ee59b4ac74
commit 9f5c2523e0
+27 -33
View File
@@ -709,45 +709,39 @@ local function VerifyRibsIntersection( nRib1, nRib2, nType1, nType2, nSrf1, nSrf
local nCrv1 = EgtCopyGlob( nRib1, nGrp)
local nCrv2 = EgtCopyGlob( nRib2, nGrp)
-- verifico se si intersecano nel piano XY definito dal gruppo locale
local nId, nCnt = EgtCurveCurveInters( nCrv1, nCrv2, nGrp)
local nId, nPntCnt, nCrvCnt = EgtCurveCurveInters( nCrv1, nCrv2, nGrp)
-- se si intersecano verifico se ho intersezioni valide
if nId then
-- scorro tutte le intersezioni trovate
for i = 0, nCnt - 1 do
-- scorro tutti i punti di intersezione trovati
for i = 0, nPntCnt - 1 do
local nPtId = nId + i
if EgtGetType( nPtId) ~= GDB_TY.GEO_POINT then
-- se è tratto sovrapposto warining
EgtOutLog( 'Warning : ribs overlapping - CalcPaths')
-- verifico se valida
if nType1 == RIB_TYPE.UNBOUNDED and nType2 == RIB_TYPE.UNBOUNDED then
-- nel caso unbounded l'intersezione può essere ovunque
bInters = true
elseif nType1 == RIB_TYPE.EXTERNAL or nType2 == RIB_TYPE.EXTERNAL then
-- l'intersezione deve essere esterna
if nSrf2 and EgtSurfFrTestExternal( nSrf2, nPtId) then bInters = true end
else
-- verifico se valida
if nType1 == RIB_TYPE.UNBOUNDED and nType2 == RIB_TYPE.UNBOUNDED then
-- nel caso unbounded l'intersezione può essere ovunque
bInters = true
elseif nType1 == RIB_TYPE.EXTERNAL or nType2 == RIB_TYPE.EXTERNAL then
-- l'intersezione deve essere esterna
if nSrf2 and EgtSurfFrTestExternal( nSrf2, nPtId) then bInters = true end
else
-- se uno dei due è interno o supporto l'intersezione deve essere interna
if nSrf1 and not EgtSurfFrTestExternal( nSrf1, nPtId) then bInters = true end
end
-- se uno dei due è interno o supporto l'intersezione deve essere interna
if nSrf1 and not EgtSurfFrTestExternal( nSrf1, nPtId) then bInters = true end
end
-- se valida verifico se forza il taglio sulla curva 1
if bInters then
local ptInt = EgtSP( nPtId, GDB_ID.ROOT)
local dPar1 = EgtCurveParamAtPoint( nCrv1, ptInt, GEO.EPS_SMALL, GDB_RT.GLOB)
local dPar2 = EgtCurveParamAtPoint( nCrv2, ptInt, GEO.EPS_SMALL, GDB_RT.GLOB)
local _, dParE1 = EgtCurveDomain( nCrv1)
local _, dParE2 = EgtCurveDomain( nCrv2)
-- se valida verifico se forza il taglio sulla curva 1
if bInters then
local ptInt = EgtSP( nPtId, GDB_ID.ROOT)
local dPar1 = EgtCurveParamAtPoint( nCrv1, ptInt, GEO.EPS_SMALL, GDB_RT.GLOB)
local dPar2 = EgtCurveParamAtPoint( nCrv2, ptInt, GEO.EPS_SMALL, GDB_RT.GLOB)
local _, dParE1 = EgtCurveDomain( nCrv1)
local _, dParE2 = EgtCurveDomain( nCrv2)
local bCrv1OnExtr = ( dPar1 < 10 * GEO.EPS_SMALL or abs( dPar1 - dParE1) < 10 * GEO.EPS_SMALL)
local bCrv2OnExtr = ( dPar2 < 10 * GEO.EPS_SMALL or abs( dPar2 - dParE2) < 10 * GEO.EPS_SMALL)
bForceCrv1Cut = ( bCrv1OnExtr and not bCrv2OnExtr)
if bForceCrv1Cut then
return bInters, bForceCrv1Cut -- true, true
end
local bCrv1OnExtr = ( dPar1 < 10 * GEO.EPS_SMALL or abs( dPar1 - dParE1) < 10 * GEO.EPS_SMALL)
local bCrv2OnExtr = ( dPar2 < 10 * GEO.EPS_SMALL or abs( dPar2 - dParE2) < 10 * GEO.EPS_SMALL)
bForceCrv1Cut = ( bCrv1OnExtr and not bCrv2OnExtr)
if bForceCrv1Cut then
return bInters, bForceCrv1Cut -- true, true
end
end
end