mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Porting the fix for issue #27664
This commit is contained in:
@@ -46,6 +46,8 @@
|
||||
#include <IntPatch_CSFunction.hxx>
|
||||
#include <IntPatch_CurvIntSurf.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
|
||||
#define myInfinite 1.e15 // the same as was in Adaptor3d_TopolTool
|
||||
|
||||
static void Recadre(GeomAbs_SurfaceType typeS1,
|
||||
@@ -589,29 +591,40 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
|
||||
}
|
||||
|
||||
Bnd_Box2d BPLin = PLin.Bounding();
|
||||
|
||||
if(SurfaceIsPeriodic) {
|
||||
Standard_Real xmin,ymin,xmax,ymax,g;
|
||||
BPLin.Get(xmin,ymin,xmax,ymax);
|
||||
g = BPLin.GetGap();
|
||||
BPLin.SetVoid();
|
||||
BPLin.Update(xmin-M_PI-M_PI,ymin,
|
||||
xmax+M_PI+M_PI,ymax);
|
||||
BPLin.SetGap(g);
|
||||
}
|
||||
if(SurfaceIsBiPeriodic) {
|
||||
Standard_Real xmin,ymin,xmax,ymax,g;
|
||||
BPLin.Get(xmin,ymin,xmax,ymax);
|
||||
g = BPLin.GetGap();
|
||||
BPLin.SetVoid();
|
||||
BPLin.Update(xmin,ymin-M_PI-M_PI,
|
||||
xmax,ymax+M_PI+M_PI);
|
||||
BPLin.SetGap(g);
|
||||
}
|
||||
Standard_Real OffsetV = 0.0;
|
||||
Standard_Real OffsetU = 0.0;
|
||||
|
||||
switch(arc->GetType())
|
||||
{
|
||||
case GeomAbs_Line: NbEchant=10; break;
|
||||
case GeomAbs_Line:
|
||||
{
|
||||
NbEchant=10;
|
||||
|
||||
Standard_Real aXmin, aYmin, aXmax, aYmax;
|
||||
BPLin.Get(aXmin, aYmin, aXmax, aYmax);
|
||||
gp_Lin2d aLin = arc->Curve2d().Line();
|
||||
const gp_Pnt2d& aLoc = aLin.Location();
|
||||
const gp_Dir2d& aDir = aLin.Direction();
|
||||
|
||||
//Here, we consider rectangular axis-aligned domain only.
|
||||
const Standard_Boolean isAlongU = (Abs(aDir.X()) > Abs(aDir.Y()));
|
||||
|
||||
if(SurfaceIsPeriodic && !isAlongU)
|
||||
{
|
||||
//Shift along U-direction
|
||||
const Standard_Real aNewLocation =
|
||||
ElCLib::InPeriod(aLoc.X(), aXmin, aXmin + M_PI + M_PI);
|
||||
OffsetU = aNewLocation - aLoc.X();
|
||||
}
|
||||
else if(SurfaceIsBiPeriodic && isAlongU)
|
||||
{
|
||||
//Shift along V-direction
|
||||
const Standard_Real aNewLocation =
|
||||
ElCLib::InPeriod(aLoc.Y(), aYmin, aYmin + M_PI + M_PI);
|
||||
OffsetV = aNewLocation - aLoc.Y();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
NbEchant = (3 + arc->NbPoles());
|
||||
@@ -634,24 +647,43 @@ void IntPatch_RstInt::PutVertexOnLine (Handle(IntPatch_Line)& L,
|
||||
}
|
||||
}
|
||||
|
||||
if(SurfaceIsPeriodic) {
|
||||
Standard_Real xmin,ymin,xmax,ymax,g;
|
||||
BPLin.Get(xmin,ymin,xmax,ymax);
|
||||
g = BPLin.GetGap();
|
||||
BPLin.SetVoid();
|
||||
BPLin.Update(xmin-M_PI-M_PI,ymin,
|
||||
xmax+M_PI+M_PI,ymax);
|
||||
BPLin.SetGap(g);
|
||||
}
|
||||
if(SurfaceIsBiPeriodic) {
|
||||
Standard_Real xmin,ymin,xmax,ymax,g;
|
||||
BPLin.Get(xmin,ymin,xmax,ymax);
|
||||
g = BPLin.GetGap();
|
||||
BPLin.SetVoid();
|
||||
BPLin.Update(xmin,ymin-M_PI-M_PI,
|
||||
xmax,ymax+M_PI+M_PI);
|
||||
BPLin.SetGap(g);
|
||||
}
|
||||
|
||||
IntPatch_PolyArc Brise(arc,NbEchant,PFirst,PLast,BPLin);
|
||||
|
||||
Standard_Integer IndiceOffsetBiPeriodic = 0;
|
||||
Standard_Integer IndiceOffsetPeriodic = 0;
|
||||
Standard_Real OffsetV = 0.0;
|
||||
Standard_Real OffsetU = 0.0;
|
||||
const Standard_Real aRefOU = OffsetU,
|
||||
aRefOV = OffsetV;
|
||||
|
||||
do {
|
||||
if(IndiceOffsetBiPeriodic == 1)
|
||||
OffsetV = -M_PI-M_PI;
|
||||
OffsetV = aRefOV - M_PI - M_PI;
|
||||
else if(IndiceOffsetBiPeriodic == 2)
|
||||
OffsetV = M_PI+M_PI;
|
||||
OffsetV = aRefOV + M_PI + M_PI;
|
||||
|
||||
do {
|
||||
if(IndiceOffsetPeriodic == 1)
|
||||
OffsetU = -M_PI-M_PI;
|
||||
OffsetU = aRefOU - M_PI - M_PI;
|
||||
else if(IndiceOffsetPeriodic == 2)
|
||||
OffsetU = M_PI+M_PI;
|
||||
OffsetU = aRefOU + M_PI + M_PI;
|
||||
|
||||
Brise.SetOffset(OffsetU,OffsetV);
|
||||
|
||||
|
@@ -8,10 +8,11 @@
|
||||
008 modalg_3
|
||||
009 modalg_4
|
||||
010 modalg_5
|
||||
011 moddata_1
|
||||
012 moddata_2
|
||||
013 moddata_3
|
||||
014 step
|
||||
015 caf
|
||||
016 mesh
|
||||
017 heal
|
||||
011 modalg_6
|
||||
012 moddata_1
|
||||
013 moddata_2
|
||||
014 moddata_3
|
||||
015 step
|
||||
016 caf
|
||||
017 mesh
|
||||
018 heal
|
||||
|
20
tests/bugs/modalg_6/begin
Normal file
20
tests/bugs/modalg_6/begin
Normal file
@@ -0,0 +1,20 @@
|
||||
set subgroup modalg
|
||||
|
||||
set calcul "p"
|
||||
set type "i"
|
||||
|
||||
proc OFFSETSHAPE {distance faces calcul type} {
|
||||
uplevel #0 explode s f
|
||||
uplevel #0 offsetparameter 1e-7 $calcul $type
|
||||
uplevel #0 offsetload s $distance $faces
|
||||
uplevel #0 offsetperform result
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
56
tests/bugs/modalg_6/bug27664_1
Normal file
56
tests/bugs/modalg_6/bug27664_1
Normal file
@@ -0,0 +1,56 @@
|
||||
puts "========"
|
||||
puts "OCC27664"
|
||||
puts "========"
|
||||
puts ""
|
||||
#################################################
|
||||
# Incomplete intersection curve from the attached shapes
|
||||
#################################################
|
||||
|
||||
set ExpTol 2.0017470228627478e-008
|
||||
set GoodNbCurv 2
|
||||
set GoodLength 0.6288896355727489
|
||||
|
||||
restore [locate_data_file bug27664_pl0.brep] pl0
|
||||
restore [locate_data_file bug27664_nsh_8.brep] nsh_8
|
||||
explode nsh_8 f
|
||||
explode pl0 f
|
||||
|
||||
set log [bopcurves pl0_1 nsh_8_4 -2d]
|
||||
|
||||
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
|
||||
|
||||
if {${NbCurv} != ${GoodNbCurv}} {
|
||||
puts "Error: Number of curves is bad!"
|
||||
}
|
||||
|
||||
checkreal TolReached $Toler $ExpTol 0.0 0.1
|
||||
|
||||
set clen 0.0
|
||||
|
||||
for {set ic 1} { $ic <= ${NbCurv} } { incr ic} {
|
||||
|
||||
set le [length c_$ic]
|
||||
regexp "The length c_$ic is +(\[-0-9.+eE\]+)" ${le} full ll
|
||||
|
||||
puts "ll = $ll"
|
||||
|
||||
set clen [expr $clen+$ll]
|
||||
}
|
||||
|
||||
puts "Summary length = $clen"
|
||||
|
||||
checkreal Length $clen $GoodLength 0.0 1.0e-5
|
||||
|
||||
smallview
|
||||
don c_*
|
||||
fit
|
||||
display pl0_1 nsh_8_4
|
||||
|
||||
xwd ${imagedir}/${test_image}_1.png
|
||||
|
||||
top
|
||||
don c_*
|
||||
fit
|
||||
display pl0_1 nsh_8_4
|
||||
|
||||
xwd ${imagedir}/${test_image}_2.png
|
38
tests/bugs/modalg_6/bug27664_2
Normal file
38
tests/bugs/modalg_6/bug27664_2
Normal file
@@ -0,0 +1,38 @@
|
||||
puts "========"
|
||||
puts "OCC27664"
|
||||
puts "========"
|
||||
puts ""
|
||||
#################################################
|
||||
# Incomplete intersection curve from the attached shapes
|
||||
#################################################
|
||||
|
||||
restore [locate_data_file bug27664_pl0.brep] pl0
|
||||
restore [locate_data_file bug27664_nsh_8.brep] nsh_8
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
|
||||
baddobjects pl0
|
||||
baddtools nsh_8
|
||||
|
||||
bfillds
|
||||
|
||||
# section
|
||||
bbop rs 4
|
||||
|
||||
if { [string compare -nocase [checksection rs] " nb alone Vertices : 0\n\n"] } {
|
||||
puts "ERROR: the section is not closed"
|
||||
} else {
|
||||
puts "The section is OK"
|
||||
}
|
||||
|
||||
# cut
|
||||
bbop result 2
|
||||
|
||||
smallview
|
||||
donly result
|
||||
fit
|
||||
|
||||
xwd ${imagedir}/${test_image}.png
|
||||
|
||||
set square 33.8629
|
Reference in New Issue
Block a user