1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0030869: Modeling Data - BRepAdaptor_CompCurve incorrectly evaluates the boundary points

Problem is solved by #0029430. Integrating test case only.
This commit is contained in:
emv
2019-08-07 09:40:42 +03:00
committed by bugmaster
parent 8996b4490a
commit 6f5db50804
2 changed files with 111 additions and 0 deletions

View File

@@ -3271,6 +3271,58 @@ static Standard_Integer OCC30708_2 (Draw_Interpretor& di, Standard_Integer, cons
return 0;
}
//=======================================================================
//function : OCC30869
//purpose :
//=======================================================================
static Standard_Integer OCC30869 (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
{
if (theArgc != 2)
{
theDI.PrintHelp (theArgv[0]);
return 1;
}
TopoDS_Shape aWire = DBRep::Get (theArgv[1]);
if (aWire.IsNull() || aWire.ShapeType() != TopAbs_WIRE)
{
theDI << theArgv[1] << " is not a wire.\n";
return 1;
}
BRepAdaptor_CompCurve aBACC (TopoDS::Wire (aWire));
Standard_Real aFirst = aBACC.FirstParameter();
Standard_Real aLast = aBACC.LastParameter();
gp_Pnt aPFirst, aPLast;
gp_Vec aVFirst, aVLast;
aBACC.D1 (aFirst, aPFirst, aVFirst);
aBACC.D1 (aLast, aPLast, aVLast);
if (aVFirst.SquareMagnitude() > gp::Resolution())
aVFirst.Normalize();
if (aVLast.SquareMagnitude() > gp::Resolution())
aVLast.Normalize();
theDI << aFirst << ": point " << aPFirst.X() << " "
<< aPFirst.Y() << " "
<< aPFirst.Z()
<< ", tangent " << aVFirst.X() << " "
<< aVFirst.Y() << " "
<< aVFirst.Z() << "\n";
theDI << aLast << ": point " << aPLast.X() << " "
<< aPLast.Y() << " "
<< aPLast.Z()
<< ", tangent " << aVLast.X() << " "
<< aVLast.Y() << " "
<< aVLast.Z() << "\n";
return 0;
}
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
@@ -3327,5 +3379,9 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
theCommands.Add ("OCC30708_2", "Tests initialization of the BRepLib_MakeWire with null shape",
__FILE__, OCC30708_2, group);
theCommands.Add ("OCC30869", "Prints bounding points of the given wire and tangent vectors at these points.\n"
"Usage: OCC30869 wire",
__FILE__, OCC30869, group);
return;
}

View File

@@ -0,0 +1,55 @@
puts "========"
puts "0030869: Modeling Data - BRepAdaptor_CompCurve incorrectly evaluates the boundary points"
puts "========"
puts ""
pload QAcommands
# create wire consisting of a single edge based on a trimmed circle
circle c 1 0 0 0 -1 0 0 0 -1 1
trim c c 1.5707963267949 4.71238898038469
mkedge e c
orientation e R
wire w e
# compute boundary points using BRepAdaptor_CompCurve
set log [OCC30869 w]
set lines [split $log "\n"]
if {![regexp {([-0-9.+eE]*): point ([-0-9.+eE]*) ([-0-9.+eE]*) ([-0-9.+eE]*), tangent ([-0-9.+eE]*) ([-0-9.+eE]*) ([-0-9.+eE]*)} [lindex $lines 0] full t1 x1 y1 z1 dx1 dy1 dz1]} {
puts "Error: first point is not computed"
}
if {![regexp {([-0-9.+eE]*): point ([-0-9.+eE]*) ([-0-9.+eE]*) ([-0-9.+eE]*), tangent ([-0-9.+eE]*) ([-0-9.+eE]*) ([-0-9.+eE]*)} [lindex $lines 1] full t2 x2 y2 z2 dx2 dy2 dz2]} {
puts "Error: last point is not computed"
}
# compute reference values
# inverse the curve as the edge in the wire is reversed
circle ci 1 0 0 0 1 0 0 0 -1 1
trim ci ci 1.5707963267949 4.71238898038469
cvalue ci 1.5707963267949 x1_ref y1_ref z1_ref dx1_ref dy1_ref dz1_ref
cvalue ci 4.71238898038469 x2_ref y2_ref z2_ref dx2_ref dy2_ref dz2_ref
# compare the values
set tol_abs 1.e-7
set tol_rel 1.e-7
checkreal first_pnt_x $x1 [dval x1_ref] $tol_abs $tol_rel
checkreal first_pnt_y $y1 [dval y1_ref] $tol_abs $tol_rel
checkreal first_pnt_z $z1 [dval z1_ref] $tol_abs $tol_rel
checkreal first_tgt_x $dx1 [dval dx1_ref] $tol_abs $tol_rel
checkreal first_tgt_y $dy1 [dval dy1_ref] $tol_abs $tol_rel
checkreal first_tgt_z $dz1 [dval dz1_ref] $tol_abs $tol_rel
checkreal last_pnt_x $x2 [dval x2_ref] $tol_abs $tol_rel
checkreal last_pnt_y $y2 [dval y2_ref] $tol_abs $tol_rel
checkreal last_pnt_z $z2 [dval z2_ref] $tol_abs $tol_rel
checkreal last_tgt_x $dx2 [dval dx2_ref] $tol_abs $tol_rel
checkreal last_tgt_y $dy2 [dval dy2_ref] $tol_abs $tol_rel
checkreal last_tgt_z $dz2 [dval dz2_ref] $tol_abs $tol_rel