1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-06 18:26:22 +03:00

0026305: BRepFeat_MakePrism returns inconsistent results && 026315: BRepFeat_MakeRevol fails to create revol from shape

Test-cases for issues #26305 and #26315
This commit is contained in:
ifv 2015-06-18 13:36:16 +03:00 committed by bugmaster
parent c0e32b3c3d
commit d7988ee19f
7 changed files with 387 additions and 185 deletions

View File

@ -54,6 +54,7 @@
#include <LocOpe_CSIntersector.hxx>
#include <LocOpe_PntFace.hxx>
#include <LocOpe_BuildShape.hxx>
#include <ElSLib.hxx>
#include <TColGeom_SequenceOfCurve.hxx>
@ -490,14 +491,9 @@ void BRepFeat::FaceUntil(const TopoDS_Shape& Sbase,
{
Bnd_Box B;
BRepBndLib::Add(Sbase,B);
Standard_Real c[6], bnd;
B.Get(c[0],c[2],c[4],c[1],c[3],c[5]);
bnd = c[0];
for(Standard_Integer i = 1 ; i < 6; i++) {
if(c[i] > bnd) bnd = c[i];
}
bnd = 10*bnd;
Standard_Real x[2], y[2], z[2];
B.Get(x[0],y[0],z[0],x[1],y[1],z[1]);
Standard_Real diam = 10.*Sqrt(B.SquareExtent());
Handle(Geom_Surface) s = BRep_Tool::Surface(FUntil);
Handle(Standard_Type) styp = s->DynamicType();
@ -507,16 +503,80 @@ void BRepFeat::FaceUntil(const TopoDS_Shape& Sbase,
}
Handle(Geom_RectangularTrimmedSurface) str;
if (styp == STANDARD_TYPE(Geom_Plane)) {
gp_Pln aPln = Handle(Geom_Plane)::DownCast(s)->Pln();
Standard_Real u, v, umin = RealLast(), umax = -umin,
vmin = RealLast(), vmax = -vmin;
for(Standard_Integer i = 0 ; i < 2; i++)
{
for(Standard_Integer j = 0; j < 2; j++)
{
for(Standard_Integer k = 0; k < 2; k++)
{
gp_Pnt aP(x[i], y[j], z[k]);
ElSLib::Parameters(aPln, aP, u, v);
if(u < umin)
umin = u;
if(u > umax)
umax = u;
if(v < vmin)
vmin = v;
if(v > vmax)
vmax = v;
}
}
}
umin -= diam;
umax += diam;
vmin -= diam;
vmax += diam;
str = new Geom_RectangularTrimmedSurface
(s, bnd, -bnd, bnd, -bnd, Standard_True, Standard_True);
(s, umin, umax, vmin, vmax, Standard_True, Standard_True);
}
else if (styp == STANDARD_TYPE(Geom_CylindricalSurface)) {
gp_Cylinder aCyl = Handle(Geom_CylindricalSurface)::DownCast(s)->Cylinder();
Standard_Real u, v, vmin = RealLast(), vmax = -vmin;
for(Standard_Integer i = 0 ; i < 2; i++)
{
for(Standard_Integer j = 0; j < 2; j++)
{
for(Standard_Integer k = 0; k < 2; k++)
{
gp_Pnt aP(x[i], y[j], z[k]);
ElSLib::Parameters(aCyl, aP, u, v);
if(v < vmin)
vmin = v;
if(v > vmax)
vmax = v;
}
}
}
vmin -= diam;
vmax += diam;
str = new Geom_RectangularTrimmedSurface
(s, bnd, -bnd, Standard_False, Standard_True);
(s, vmin, vmax, Standard_False, Standard_True);
}
else if (styp == STANDARD_TYPE(Geom_ConicalSurface)) {
gp_Cone aCon = Handle(Geom_ConicalSurface)::DownCast(s)->Cone();
Standard_Real u, v, vmin = RealLast(), vmax = -vmin;
for(Standard_Integer i = 0 ; i < 2; i++)
{
for(Standard_Integer j = 0; j < 2; j++)
{
for(Standard_Integer k = 0; k < 2; k++)
{
gp_Pnt aP(x[i], y[j], z[k]);
ElSLib::Parameters(aCon, aP, u, v);
if(v < vmin)
vmin = v;
if(v > vmax)
vmax = v;
}
}
}
vmin -= diam;
vmax += diam;
str = new Geom_RectangularTrimmedSurface
(s, bnd, -bnd, Standard_False, Standard_True);
(s, vmin, vmax, Standard_False, Standard_True);
}
else {
FUntil.Nullify();

View File

@ -570,6 +570,7 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& From,
ASI2.Perform(scur);
TopAbs_Orientation OrU, OrF;
TopoDS_Face FFrom, FUntil;
Standard_Real ParF, ParU;
if (ASI1.IsDone() && ASI1.NbPoints(1) >=1) {
if (myFuse == 1) {
OrU = ASI1.Point(1,1).Orientation();
@ -579,6 +580,7 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& From,
}
if(sens==-1) OrU = TopAbs::Reverse(OrU);
FUntil = ASI1.Point(1,1).Face();
ParU = ASI1.Point(1,1).Parameter();
}
else {
NotDone();
@ -589,12 +591,20 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& From,
OrF = ASI2.Point(1,1).Orientation();
if(sens==1) OrF = TopAbs::Reverse(OrF);
FFrom = ASI2.Point(1,1).Face();
ParF = ASI2.Point(1,1).Parameter();
}
else {
NotDone();
myStatusError = BRepFeat_NoIntersectF;
return;
}
if(tran > 0 && (Abs(ParU) < Abs(ParF)))
{
TopAbs_Orientation Or;
Or = OrU;
OrU = OrF;
OrF = Or;
}
TopoDS_Shape Comp;
BRep_Builder B;
B.MakeCompound(TopoDS::Compound(Comp));

View File

@ -604,7 +604,8 @@ void BRepFeat_MakeRevol::Perform(const TopoDS_Shape& From,
pr1 = ElCLib::InPeriod(pr1,PrU-2*M_PI,PrU);
Standard_Real pr2 = ASI2.Point(1,ASI2.NbPoints(1)).Parameter();
pr2 = ElCLib::InPeriod(pr2,PrU-2*M_PI,PrU);
OrF = OrU;
//OrF = OrU;
OrF = TopAbs::Reverse(OrU);
FFrom = ASI2.Point(1,1).Face();
PrF = Max(pr1, pr2);
}
@ -642,7 +643,7 @@ void BRepFeat_MakeRevol::Perform(const TopoDS_Shape& From,
break;
}
}
if(myFuse == 1) {
if(myFuse == 1 && !myJustFeat) {
//modified by NIZNHY-PKV Thu Mar 21 18:19:14 2002 f
//BRepAlgo_Fuse f(mySbase, VraiRevol);
//myShape = f.Shape();
@ -653,7 +654,7 @@ void BRepFeat_MakeRevol::Perform(const TopoDS_Shape& From,
//modified by NIZNHY-PKV Thu Mar 21 18:19:18 2002 t
Done();
}
else if(myFuse == 0) {
else if(myFuse == 0 && !myJustFeat) {
//modified by NIZNHY-PKV Thu Mar 21 18:19:46 2002 f
//BRepAlgo_Cut c(mySbase, VraiRevol);
//myShape = c.Shape();

View File

@ -0,0 +1,34 @@
puts "========"
puts "OCC26305"
puts "========"
puts ""
###################################################
# BRepFeat_MakePrism returns inconsistent results
###################################################
circle aCircle -9 -9 0 0 0 1 1 0 0 10
mkedge anEdge aCircle
wire aWire anEdge
mkplane aCircle aWire 0
plane aFromPlane 0 0 -10 0 0 1 1 0 0
mkface aFromPlane aFromPlane
plane aToPlane 0 0 10 0 0 1 1 0 0
mkface aToPlane aToPlane
featprism aCircle aCircle aCircle 0 0 1 2 1
featperform prism aResult aFromPlane aToPlane
checkshape aResult
vinit
vdisplay aResult
vsetdispmode aResult 1
vfit
set bug_info [vreadpixel 300 340 name]
if {$bug_info == "BLACK 0"} {
puts "ERROR: OCC26305 is reproduced. Prism is incorrect."
}
set only_screen 1

View File

@ -0,0 +1,34 @@
puts "========"
puts "OCC26305"
puts "========"
puts ""
###################################################
# BRepFeat_MakePrism returns inconsistent results
###################################################
circle aCircle -10 -10 0 0 0 1 1 0 0 10
mkedge anEdge aCircle
wire aWire anEdge
mkplane aCircle aWire 0
plane aFromPlane 0 0 -10 0 0 1 1 0 0
mkface aFromPlane aFromPlane
plane aToPlane 0 0 10 0 0 1 1 0 0
mkface aToPlane aToPlane
featprism aCircle aCircle aCircle 0 0 1 2 1
featperform prism aResult aFromPlane aToPlane
checkshape aResult
vinit
vdisplay aResult
vsetdispmode aResult 1
vfit
set bug_info [vreadpixel 300 340 name]
if {$bug_info == "BLACK 0"} {
puts "ERROR: OCC26305 is reproduced. Prism is incorrect."
}
set only_screen 1

View File

@ -0,0 +1,34 @@
puts "========"
puts "OCC26305"
puts "========"
puts ""
###################################################
# BRepFeat_MakePrism returns inconsistent results
###################################################
circle aCircle 0 0 0 0 0 1 1 0 0 10
mkedge anEdge aCircle
wire aWire anEdge
mkplane aCircle aWire 0
plane aFromPlane 0 0 10 0 0 1 1 0 0
mkface aFromPlane aFromPlane
plane aToPlane 0 0 20 0 0 1 1 0 0
mkface aToPlane aToPlane
featprism aCircle aCircle aCircle 0 0 1 2 1
featperform prism aResult aToPlane aFromPlane
checkshape aResult
vinit
vdisplay aResult
vsetdispmode aResult 1
vfit
set bug_info [vreadpixel 300 300 name]
if {$bug_info == "BLACK 0"} {
puts "ERROR: OCC26305 is reproduced. Prism is incorrect."
}
set only_screen 1

View File

@ -0,0 +1,29 @@
puts "========"
puts "OCC26315"
puts "========"
puts ""
#######################################################
# BRepFeat_MakeRevol fails to create revol from shape
#######################################################
circle aCircle 0 0 0 0 0 1 1 0 0 10
mkedge anEdge aCircle
wire aWire anEdge
mkplane aCircle aWire 0
plane aFromPlane 0 0 -10 0 0 1 1 0 0
mkface aFromPlane aFromPlane
plane aToPlane 0 0 10 0 0 1 1 0 0
mkface aToPlane aToPlane
featrevol aCircle aCircle aCircle 20 0 0 0 1 0 2 1
featperform revol aResult aFromPlane aToPlane
checkshape aResult
vinit
vdisplay aResult
vsetdispmode aResult 1
vfit
set only_screen 1