mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0029405: Modeling Algorithms - Check normal define status in HLRBRep_Data
Fixed exception when trying to calculate line and edge normal in methods HLRBRep_Data::OrientOutLine and HLRBRep_Data::OrientOthEdge, added a check for the existence of the normal before subsequent calculations. A correct check for zero derivative, correction of floating point error and division by zero determinant directly in HLRBRep_EdgeFaceTool::CurvatureValue was set.
This commit is contained in:
parent
f1c209dc77
commit
96b92906de
@ -1543,6 +1543,7 @@ Standard_Boolean HLRBRep_Data::OrientOutLine (const Standard_Integer I, HLRBRep_
|
||||
V = gp_Dir(0,0,-1);
|
||||
}
|
||||
V.Transform(TI);
|
||||
if (mySLProps.IsNormalDefined()) {
|
||||
Standard_Real curv = HLRBRep_EdgeFaceTool::CurvatureValue
|
||||
(iFaceGeom,pu,pv,V);
|
||||
gp_Vec Nm = mySLProps.Normal();
|
||||
@ -1581,6 +1582,7 @@ Standard_Boolean HLRBRep_Data::OrientOutLine (const Standard_Integer I, HLRBRep_
|
||||
}
|
||||
eb1->Orientation(ie1, myFEOri);
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout << "HLRBRep_Data::OrientOutLine " << I;
|
||||
@ -1627,6 +1629,7 @@ void HLRBRep_Data::OrientOthEdge (const Standard_Integer I,
|
||||
if (HLRBRep_EdgeFaceTool::UVPoint(p,myFEGeom,iFaceGeom,pu,pv)) {
|
||||
gp_Pnt Pt = EC.Value3D(p);
|
||||
mySLProps.SetParameters(pu,pv);
|
||||
if (mySLProps.IsNormalDefined()) {
|
||||
gp_Vec Nm = mySLProps.Normal();
|
||||
Pt.Transform(T);
|
||||
Nm.Transform(T);
|
||||
@ -1642,6 +1645,7 @@ void HLRBRep_Data::OrientOthEdge (const Standard_Integer I,
|
||||
eb1->Orientation(ie1, myFEOri);
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef OCCT_DEBUG
|
||||
else {
|
||||
std::cout << "HLRBRep_Data::OrientOthEdge " << I;
|
||||
|
@ -45,14 +45,14 @@ Standard_Real HLRBRep_EdgeFaceTool::CurvatureValue
|
||||
Standard_Real nmu2 = D1U*D1U;
|
||||
Standard_Real nmv2 = D1V*D1V;
|
||||
Standard_Real det = nmu2 * nmv2 - d1ud1v * d1ud1v;
|
||||
if (det > gp::Resolution()) {
|
||||
Standard_Real alfa = (d1ut * nmv2 - d1vt * d1ud1v) / det;
|
||||
Standard_Real beta = (d1vt * nmu2 - d1ut * d1ud1v) / det;
|
||||
gp_Vec Nm = D1U ^ D1V;
|
||||
if (Nm.Magnitude() > gp::Resolution()) {
|
||||
Nm.Normalize();
|
||||
Standard_Real alfa2 = alfa * alfa;
|
||||
Standard_Real beta2 = beta * beta;
|
||||
Standard_Real alfabeta = alfa * beta;
|
||||
gp_Vec Nm = D1U ^ D1V;
|
||||
Nm.Normalize();
|
||||
Standard_Real N = (Nm * D2U) * alfa2 + 2 * (Nm * D2UV) * alfabeta + (Nm * D2V) * beta2;
|
||||
Standard_Real D = nmu2 * alfa2 + 2 * d1ud1v * alfabeta + nmv2 * beta2;
|
||||
return N / D;
|
||||
|
9
tests/bugs/modalg_7/bug29405
Normal file
9
tests/bugs/modalg_7/bug29405
Normal file
@ -0,0 +1,9 @@
|
||||
puts "============================================"
|
||||
puts "OCC29405: Modeling Algorithms - Check normal define status in HLRBRep_Data"
|
||||
puts "============================================"
|
||||
puts ""
|
||||
|
||||
pload ALL
|
||||
ptorus t 17.37 17.37 [dval 2.35*180/pi]
|
||||
vdisplay t
|
||||
vcomputehlr t t2 -algotype algo 0 50 0 0 -50 0 0 0 1
|
Loading…
x
Reference in New Issue
Block a user