1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

0024328: Revolution of a wire generates two interfered faces.

Correct treatment of cones with collinear axes.

Test case for issue CR24328
This commit is contained in:
emv 2013-11-21 13:33:12 +04:00 committed by bugmaster
parent d5af86261d
commit b92a64cc68
3 changed files with 42 additions and 40 deletions

View File

@ -31,6 +31,7 @@
#include <gp_Cone.hxx> #include <gp_Cone.hxx>
#include <gp_Sphere.hxx> #include <gp_Sphere.hxx>
#include <gp_Torus.hxx> #include <gp_Torus.hxx>
#include <gp_Lin.hxx>
// //
#include <Geom2d_Curve.hxx> #include <Geom2d_Curve.hxx>
#include <Geom_Surface.hxx> #include <Geom_Surface.hxx>
@ -1853,9 +1854,11 @@ Standard_Boolean FindPointInFace(const TopoDS_Edge& aE,
case GeomAbs_Cylinder: case GeomAbs_Cylinder:
aR = aBAS.Cylinder().Radius(); aR = aBAS.Cylinder().Radius();
break; break;
case GeomAbs_Cone: case GeomAbs_Cone: {
aR = aBAS.Cone().RefRadius(); gp_Lin aL(aBAS.Cone().Axis());
aR = aL.Distance(aP);
break; break;
}
case GeomAbs_Sphere: case GeomAbs_Sphere:
aR = aBAS.Sphere().Radius(); aR = aBAS.Sphere().Radius();
break; break;

View File

@ -784,22 +784,18 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1,
} }
//// modified by jgv, 15.12.02 for OCC565 //// //// modified by jgv, 15.12.02 for OCC565 ////
if (typs1 == GeomAbs_Cone) if (typs1 == GeomAbs_Cone && TreatAsBiParametric)
{ {
const gp_Cone Con1 = theS1->Cone(); const gp_Cone Con1 = theS1->Cone();
const Standard_Real a1 = Abs(Con1.SemiAngle()); const Standard_Real a1 = Abs(Con1.SemiAngle());
if (a1 < 0.02 && a2 < 0.02) //quasi-cylinders: if same domain, treat as canonic //if collinear, treat as canonical
{
const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis(); const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis();
if (A1.IsParallel(A2,Precision::Angular()))
{
const gp_Lin L1(A1); const gp_Lin L1(A1);
if (L1.Distance(A2.Location()) <= Precision::Confusion()) if (A1.IsParallel(A2,Precision::Angular()) &&
(L1.Distance(A2.Location()) <= Precision::Confusion()))
{ {
TreatAsBiParametric = Standard_False; TreatAsBiParametric = Standard_False;
} }
}
}
else if (a1 > 1.55 && a2 > 1.55) //quasi-planes: if same domain, treat as canonic else if (a1 > 1.55 && a2 > 1.55) //quasi-planes: if same domain, treat as canonic
{ {
const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis(); const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis();
@ -813,14 +809,6 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1,
} }
} }
} }
else if ((a1 > 1.55) || (a2 > 1.55))
{
const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis();
if (A1.IsCoaxial(A2,Precision::Angular(),Precision::Confusion()))
{
TreatAsBiParametric = Standard_False;
}
}
}// if (typs1 == GeomAbs_Cone) { }// if (typs1 == GeomAbs_Cone) {
}// if(typs2 == GeomAbs_Cone) { }// if(typs2 == GeomAbs_Cone) {
@ -984,22 +972,18 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1,
} }
//// modified by jgv, 15.12.02 for OCC565 //// //// modified by jgv, 15.12.02 for OCC565 ////
if (typs1 == GeomAbs_Cone) if (typs1 == GeomAbs_Cone && TreatAsBiParametric)
{ {
const gp_Cone Con1 = theS1->Cone(); const gp_Cone Con1 = theS1->Cone();
const Standard_Real a1 = Abs(Con1.SemiAngle()); const Standard_Real a1 = Abs(Con1.SemiAngle());
if (a1 < 0.02 && a2 < 0.02) //quasi-cylinders: if same domain, treat as canonic //if collinear, treat as canonical
{
const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis(); const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis();
if (A1.IsParallel(A2,Precision::Angular()))
{
const gp_Lin L1(A1); const gp_Lin L1(A1);
if (L1.Distance(A2.Location()) <= Precision::Confusion()) if (A1.IsParallel(A2,Precision::Angular()) &&
(L1.Distance(A2.Location()) <= Precision::Confusion()))
{ {
TreatAsBiParametric = Standard_False; TreatAsBiParametric = Standard_False;
} }
}
}
else if (a1 > 1.55 && a2 > 1.55) //quasi-planes: if same domain, treat as canonic else if (a1 > 1.55 && a2 > 1.55) //quasi-planes: if same domain, treat as canonic
{ {
const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis(); const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis();
@ -1013,14 +997,6 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1,
} }
} }
} }
else if ((a1 > 1.55) || (a2 > 1.55))
{
const gp_Ax1 A1 = Con1.Axis(), A2 = Con2.Axis();
if (A1.IsCoaxial(A2,Precision::Angular(),Precision::Confusion()))
{
TreatAsBiParametric = Standard_False;
}
}
}// if (typs1 == GeomAbs_Cone) { }// if (typs1 == GeomAbs_Cone) {
}// if(typs2 == GeomAbs_Cone) { }// if(typs2 == GeomAbs_Cone) {

View File

@ -0,0 +1,23 @@
puts "================"
puts "OCC24328"
puts "================"
puts ""
#######################################################################
# Revolution of a wire generates two interfered faces
#######################################################################
vertex v1 23.500000 11.123000 0
vertex v2 22.000000 11.140900 0
vertex v3 20.500000 11.180700 0
edge e1 v1 v2
edge e2 v2 v3
wire w e1 e2
revol r w 0 0 0 1 0 0 360
set info [bopcheck r]
if { [regexp "This shape seems to be OK" ${info}] != 1 } {
puts "Error : Revolution works wrong"
} else {
puts "OK: Revolution works properly"
}