mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0026647: BRepTools::UVBounds() computes zero range by V
Calculation of bounding box on conic 2d curves corrected to work properly if specified parametric range is in negative values. Test case added
This commit is contained in:
parent
69f0a0fd28
commit
9966161704
@ -580,7 +580,7 @@ void BndLib_Box2dCurve::Compute(const Handle(Geom2d_Conic)& aConic2D,
|
|||||||
Bnd_Box2d& aBox2D)
|
Bnd_Box2d& aBox2D)
|
||||||
{
|
{
|
||||||
Standard_Integer i, aNbT;
|
Standard_Integer i, aNbT;
|
||||||
Standard_Real pT[10], aT, aTwoPI, aT1x, aT2x, dT, aT1z, aT2z, aEps;
|
Standard_Real pT[10], aT, aTwoPI, dT, aEps;
|
||||||
gp_Pnt2d aP2D;
|
gp_Pnt2d aP2D;
|
||||||
//
|
//
|
||||||
aNbT=Compute(aConic2D, aType, pT);
|
aNbT=Compute(aConic2D, aType, pT);
|
||||||
@ -601,53 +601,28 @@ void BndLib_Box2dCurve::Compute(const Handle(Geom2d_Conic)& aConic2D,
|
|||||||
aTwoPI=2.*M_PI;
|
aTwoPI=2.*M_PI;
|
||||||
dT=aT2-aT1;
|
dT=aT2-aT1;
|
||||||
//
|
//
|
||||||
aT1z=aT1;
|
Standard_Real aT1z = AdjustToPeriod (aT1, aTwoPI);
|
||||||
aT2z=aT2;
|
|
||||||
if (aT1z>=aTwoPI) {
|
|
||||||
aT1z=AdjustToPeriod(aT1z, aTwoPI);
|
|
||||||
aT2z=aT1z+dT;
|
|
||||||
}
|
|
||||||
if (fabs(aT1z)<aEps) {
|
if (fabs(aT1z)<aEps) {
|
||||||
aT1z=0.;
|
aT1z=0.;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
Standard_Real aT2z = aT1z + dT;
|
||||||
if (fabs(aT2z-aTwoPI)<aEps) {
|
if (fabs(aT2z-aTwoPI)<aEps) {
|
||||||
aT2z=aTwoPI;
|
aT2z=aTwoPI;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
for (i=0; i<aNbT; ++i) {
|
for (i=0; i<aNbT; ++i) {
|
||||||
aT=pT[i];
|
aT = pT[i];
|
||||||
if (aT>=aT1z && aT<=aT2z) {
|
// adjust aT to range [aT1z, aT1z + 2*PI]; note that pT[i] and aT1z
|
||||||
|
// are adjusted to range [0, 2*PI], but aT2z can be greater than 2*PI
|
||||||
|
aT = (aT < aT1z ? aT + aTwoPI : aT);
|
||||||
|
if (aT <= aT2z) {
|
||||||
D0(aT, aP2D);
|
D0(aT, aP2D);
|
||||||
aBox2D.Add(aP2D);
|
aBox2D.Add(aP2D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
aT1x=AdjustToPeriod(aT1, aTwoPI);
|
|
||||||
aT2x=aT1x+dT;
|
|
||||||
//
|
|
||||||
if (aT1x < aTwoPI && aT2x > aTwoPI) {
|
|
||||||
aT1z=aT1x;
|
|
||||||
aT2z=aTwoPI;
|
|
||||||
for (i=0; i<aNbT; ++i) {
|
|
||||||
aT=pT[i];
|
|
||||||
if (aT>=aT1z && aT<=aT2z) {
|
|
||||||
D0(aT, aP2D);
|
|
||||||
aBox2D.Add(aP2D);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
aT1z=0.;
|
|
||||||
aT2z=aT2x-aTwoPI;
|
|
||||||
for (i=0; i<aNbT; ++i) {
|
|
||||||
aT=pT[i];
|
|
||||||
if (aT>=aT1z && aT<=aT2z) {
|
|
||||||
D0(aT, aP2D);
|
|
||||||
aBox2D.Add(aP2D);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Compute
|
//function : Compute
|
||||||
//purpose :
|
//purpose :
|
||||||
|
17
tests/bugs/modalg_6/bug26647
Normal file
17
tests/bugs/modalg_6/bug26647
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
puts "##################################################"
|
||||||
|
puts "0026647: BRepTools::UVBounds() computes zero range by V"
|
||||||
|
puts "##################################################"
|
||||||
|
|
||||||
|
# load and check faces
|
||||||
|
restore [locate_data_file bug26627_face1.brep] f
|
||||||
|
tolerance f
|
||||||
|
checkshape f
|
||||||
|
|
||||||
|
# get UV bounds
|
||||||
|
set bounds [xbounds f]
|
||||||
|
|
||||||
|
# check for expected result
|
||||||
|
set expected [list {UMin -9.} {UMax 9.} {VMin -9.} {VMax 0.}]
|
||||||
|
for {set i 0} {$i < 4} {incr i} {
|
||||||
|
checkreal "[lindex $expected $i 0]" [lindex $bounds $i] [lindex $expected $i 1] 1e-9 0.
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user