mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0026431: Can't cut a sphere from a cylinder
This branch contains fixes for 26675 and 26431 bugs. 1. Normalization has been eliminated. 2. Interfaces of AppDef_Compute::Parametrization(...) and BRepAlgo_BooleanOperations::SetApproxParameters() methods have been changed. 3. Overloaded methods for ApproxInt_Approx::SetParameters(...), TopOpeBRepTool_GeomTool::GetTolerances(...) and TopOpeBRepTool_GeomTool::SetTolerances(...) have been removed (because some fields of these classes are not used more). 4. Comments for some methods have been changed in BRepApprox_TheMultiLineOfApprox.hxx and GeomInt_TheMultiLineOfWLApprox.hxx files. 5. Some fields have been deleted from ApproxInt_MultiLine class. Kept members have become constant. 6. Interface of ksection DRAW-command has been changed. 7. Now, 2dintersect DRAW-command prints information about found segments. 8. Some code fragments have been rewritten to make them easier. 9. Algorithm of splitting WLine, which goes through pole of sphere has been improved. 10. Improve approximation algorithm in order to it will compute correct 2D- and 3D-tangent at the end of bezier constraints (including case when curve goes through or finishes on singular points). 11. Interface of IntPatch_WLine::Dump(...) method has been corrected. 12. Some methods for working with Walking-line are made more universal (available for both GeomInt and IntTools packages). 13. Problem in BRepLib::SameParameter(...) method has been fixed (see corresponding comment). 14. Small correction in Draft package. 15. Any outputs in IntPatch_Intersection::Dump(...) method have become disabled because they are useless. If anybody need in this outputs he/she will correct this method himself/herself. Adjusting some test cases according to their new behavior. Creation of new test cases. ---------------------------------------------------------------------------------------------------------------------------- Some explanation of new behavior of some test cases: 1. Regressions: a) blend simple X4 The problem is described in the issue #0026740. According to this description, the result on the current MASTER seems to be wrong indeed. b) boolean bcommon_complex C7 and boolean bcut_complex Q1 These test case use same shapes with different Boolean operation (COMMON and CUT). They are already BAD (on the MASTER). Now, some sub-shapes have become not-shared, simply. In my opinion, we shall apply new behavior of these tests. c) boolean bsection M3 The problem described in the issue #0026777 exists even on the current MASTER. d) boolean bsection M9 The problem is described in the message http://tracker.dev.opencascade.org/view.php?id=26815#c47546. Here, we have really regression in the picture. e) boolean bsection N2 The problem is described in issue #0026814. f) boolean volumemaker G1 The problem is described in issue #26020. g) bugs modalg_1 bug1255 (and bug1255_1) The problem is described in issue #26815. h) bugs modalg_2 bug5805_18, bugs modalg_2 bug5805_42, bugs modalg_2 bug5805_46 The problem is described in issue #25925. i) bugs modalg_3 bug602 The problem is describes in issue #602. j) bugs modalg_5 bug24915 The problem is described in the message http://tracker.dev.opencascade.org/view.php?id=25929#c48565. It is not fixed by this issue. k) bugs modalg_5 bug25838 The main reason is described in issue #0026816. ---------------------------------------------------------------------------- 2. Improvements: a) boolean volumemaker F9 b) bugs modalg_1 bug10160_3 c) bugs modalg_2 bug22557 d) bugs modalg_5 bug25319_1 (_2) e) draft angle G2 f) offset shape A1 g) offset with_intersect_80 N7
This commit is contained in:
@@ -56,6 +56,92 @@ static int FlatLength(const TColStd_Array1OfInteger& Mults) {
|
||||
return sum;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckTangents
|
||||
//purpose : Checks if theArrTg3d and theArrTg2d have direction
|
||||
// corresponded to the direction between theArrPt1 and theArrPt2.
|
||||
// If it is not then reverses tangent vectors.
|
||||
// theArrPt1 (as same as theArrPt2) is sub-set of all 3D-points in
|
||||
// one multy-point (multy-point is union of sets of 2D- and 3D-points).
|
||||
//
|
||||
//ATTENTION!!!
|
||||
// The property of correlation between Tg3d and Tg2d is used here.
|
||||
// Therefore, only 3D-coinciding is checked.
|
||||
//=======================================================================
|
||||
static void CheckTangents(const TColgp_Array1OfPnt& theArrPt1,
|
||||
const TColgp_Array1OfPnt& theArrPt2,
|
||||
TColgp_Array1OfVec& theArrTg3d,
|
||||
TColgp_Array1OfVec2d& theArrTg2d)
|
||||
{
|
||||
if(theArrPt1.Lower() != theArrPt2.Lower())
|
||||
return;
|
||||
|
||||
if(theArrPt1.Upper() != theArrPt2.Upper())
|
||||
return;
|
||||
|
||||
if(theArrTg3d.Length() != theArrPt1.Length())
|
||||
return;
|
||||
|
||||
Standard_Boolean isToChangeDir = Standard_False;
|
||||
|
||||
for(Standard_Integer i = theArrPt1.Lower(); i <= theArrPt1.Upper(); i++)
|
||||
{
|
||||
const gp_Vec aV1(theArrPt1(i), theArrPt2(i));
|
||||
const gp_Vec& aV2 = theArrTg3d(i);
|
||||
|
||||
if(aV1.Dot(aV2) < 0.0)
|
||||
{
|
||||
isToChangeDir = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!isToChangeDir)
|
||||
return;
|
||||
|
||||
//Change directions for every 2D- and 3D-tangents
|
||||
|
||||
for(Standard_Integer i = theArrTg3d.Lower(); i <= theArrTg3d.Upper(); i++)
|
||||
{
|
||||
theArrTg3d(i).Reverse();
|
||||
}
|
||||
|
||||
for(Standard_Integer i = theArrTg2d.Lower(); i <= theArrTg2d.Upper(); i++)
|
||||
{
|
||||
theArrTg2d(i).Reverse();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckTangents
|
||||
//purpose : Checks if theArrTg2d have direction
|
||||
// corresponded to the direction between theArrPt1 and theArrPt2.
|
||||
// If it is not then reverses tangent vector.
|
||||
// theArrPt1 (as same as theArrPt2) is sub-set of all 2D-points in
|
||||
// one multy-point (multy-point is union of sets of 2D- and 3D-points).
|
||||
//=======================================================================
|
||||
static void CheckTangents(const TColgp_Array1OfPnt2d& theArrPt1,
|
||||
const TColgp_Array1OfPnt2d& theArrPt2,
|
||||
TColgp_Array1OfVec2d& theArrTg2d)
|
||||
{
|
||||
if(theArrPt1.Lower() != theArrPt2.Lower())
|
||||
return;
|
||||
|
||||
if(theArrPt1.Upper() != theArrPt2.Upper())
|
||||
return;
|
||||
|
||||
for(Standard_Integer i = theArrPt1.Lower(); i <= theArrPt1.Upper(); i++)
|
||||
{
|
||||
const gp_Vec2d aV1(theArrPt1(i), theArrPt2(i));
|
||||
const gp_Vec2d& aV2 = theArrTg2d(i);
|
||||
|
||||
if(aV1.Dot(aV2) < 0.0)
|
||||
{
|
||||
theArrTg2d(i).Reverse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AppParCurves_LeastSquare::
|
||||
AppParCurves_LeastSquare(const MultiLine& SSP,
|
||||
@@ -893,14 +979,20 @@ void AppParCurves_LeastSquare::Perform(const math_Vector& Parameters,
|
||||
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Affect
|
||||
//purpose : Index is an ID of the point in MultiLine. Every point is set of
|
||||
// several 3D- and 2D-points. E.g. every points of Walking-line,
|
||||
// obtained in intersection algorithm, is set of one 3D points
|
||||
// (nbP == 1) and two 2D-points (nbP2d == 2).
|
||||
//=======================================================================
|
||||
void AppParCurves_LeastSquare::Affect(const MultiLine& SSP,
|
||||
const Standard_Integer Index,
|
||||
AppParCurves_Constraint& Cons,
|
||||
math_Vector& Vt,
|
||||
math_Vector& Vc)
|
||||
{
|
||||
// Vt: vecteur tangent, Vc: vecteur courbure.
|
||||
// Vt: vector of tangent, Vc: vector of curvature.
|
||||
|
||||
if (Cons >= AppParCurves_TangencyPoint) {
|
||||
Standard_Integer i, i2 = 1;
|
||||
@@ -908,59 +1000,99 @@ void AppParCurves_LeastSquare::Affect(const MultiLine& SSP,
|
||||
Standard_Integer mynbP2d = nbP2d, mynbP = nbP;
|
||||
if (nbP2d == 0) mynbP2d = 1;
|
||||
if (nbP == 0) mynbP = 1;
|
||||
TColgp_Array1OfPnt TabP(1, mynbP);
|
||||
TColgp_Array1OfPnt2d TabP2d(1, mynbP2d);
|
||||
TColgp_Array1OfVec TabV(1, mynbP);
|
||||
TColgp_Array1OfVec2d TabV2d(1, mynbP2d);
|
||||
|
||||
if (Cons == AppParCurves_CurvaturePoint) {
|
||||
if (nbP != 0 && nbP2d != 0) {
|
||||
Ok = ToolLine::Curvature(SSP, Index,TabV,TabV2d);
|
||||
if (!Ok) { Cons = AppParCurves_TangencyPoint;}
|
||||
if (Cons == AppParCurves_CurvaturePoint)
|
||||
{
|
||||
if (nbP != 0 && nbP2d != 0)
|
||||
{
|
||||
Ok = ToolLine::Curvature(SSP, Index,TabV,TabV2d);
|
||||
if (!Ok) { Cons = AppParCurves_TangencyPoint;}
|
||||
}
|
||||
else if (nbP2d != 0) {
|
||||
Ok = ToolLine::Curvature(SSP, Index, TabV2d);
|
||||
if (!Ok) { Cons = AppParCurves_TangencyPoint;}
|
||||
else if (nbP2d != 0)
|
||||
{
|
||||
Ok = ToolLine::Curvature(SSP, Index, TabV2d);
|
||||
if (!Ok) { Cons = AppParCurves_TangencyPoint;}
|
||||
}
|
||||
else {
|
||||
Ok = ToolLine::Curvature(SSP, Index, TabV);
|
||||
if (!Ok) { Cons = AppParCurves_TangencyPoint;}
|
||||
Ok = ToolLine::Curvature(SSP, Index, TabV);
|
||||
if (!Ok) { Cons = AppParCurves_TangencyPoint;}
|
||||
}
|
||||
if (Ok) {
|
||||
for (i = 1; i <= nbP; i++) {
|
||||
(TabV(i)).Coord(Vc(i2), Vc(i2+1), Vc(i2+2));
|
||||
i2 += 3;
|
||||
}
|
||||
for (i = 1; i <= nbP2d; i++) {
|
||||
(TabV2d(i)).Coord(Vc(i2), Vc(i2+1));
|
||||
i2 += 2;
|
||||
}
|
||||
for (i = 1; i <= nbP; i++) {
|
||||
(TabV(i)).Coord(Vc(i2), Vc(i2+1), Vc(i2+2));
|
||||
i2 += 3;
|
||||
}
|
||||
|
||||
for (i = 1; i <= nbP2d; i++) {
|
||||
(TabV2d(i)).Coord(Vc(i2), Vc(i2+1));
|
||||
i2 += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i2 = 1;
|
||||
if (Cons >= AppParCurves_TangencyPoint) {
|
||||
if (nbP != 0 && nbP2d != 0) {
|
||||
Ok = ToolLine::Tangency(SSP, Index, TabV, TabV2d);
|
||||
if (!Ok) { Cons = AppParCurves_PassPoint;}
|
||||
Ok = ToolLine::Tangency(SSP, Index, TabV, TabV2d);
|
||||
if (!Ok) { Cons = AppParCurves_PassPoint;}
|
||||
}
|
||||
else if (nbP2d != 0) {
|
||||
Ok = ToolLine::Tangency(SSP, Index, TabV2d);
|
||||
if (!Ok) { Cons = AppParCurves_PassPoint;}
|
||||
Ok = ToolLine::Tangency(SSP, Index, TabV2d);
|
||||
if (!Ok) { Cons = AppParCurves_PassPoint;}
|
||||
}
|
||||
else {
|
||||
Ok = ToolLine::Tangency(SSP, Index, TabV);
|
||||
if (!Ok) { Cons = AppParCurves_PassPoint;}
|
||||
Ok = ToolLine::Tangency(SSP, Index, TabV);
|
||||
if (!Ok) { Cons = AppParCurves_PassPoint;}
|
||||
}
|
||||
if (Ok) {
|
||||
for (i = 1; i <= nbP; i++) {
|
||||
(TabV(i)).Coord(Vt(i2), Vt(i2+1), Vt(i2+2));
|
||||
i2 += 3;
|
||||
}
|
||||
for (i = 1; i <= nbP2d; i++) {
|
||||
(TabV2d(i)).Coord(Vt(i2), Vt(i2+1));
|
||||
i2 += 2;
|
||||
}
|
||||
|
||||
if (Ok)
|
||||
{
|
||||
TColgp_Array1OfPnt anArrPts3d1(1, mynbP), anArrPts3d2(1, mynbP);
|
||||
|
||||
if(nbP != 0)
|
||||
{
|
||||
if(Index < ToolLine::LastPoint(SSP))
|
||||
{
|
||||
ToolLine::Value(SSP, Index, anArrPts3d1);
|
||||
ToolLine::Value(SSP, Index+1, anArrPts3d2);
|
||||
}
|
||||
else
|
||||
{// (Index == ToolLine::LastPoint(theML))
|
||||
ToolLine::Value(SSP, Index-1, anArrPts3d1);
|
||||
ToolLine::Value(SSP, Index, anArrPts3d2);
|
||||
}
|
||||
|
||||
CheckTangents(anArrPts3d1, anArrPts3d2, TabV, TabV2d);
|
||||
}
|
||||
else if(nbP2d != 0)
|
||||
{
|
||||
TColgp_Array1OfPnt2d anArrPts2d1(1, mynbP2d), anArrPts2d2(1, mynbP2d);
|
||||
|
||||
if(Index < ToolLine::LastPoint(SSP))
|
||||
{
|
||||
ToolLine::Value(SSP, Index, anArrPts3d1, anArrPts2d1);
|
||||
ToolLine::Value(SSP, Index+1, anArrPts3d2, anArrPts2d2);
|
||||
}
|
||||
else
|
||||
{// (Index == ToolLine::LastPoint(theML))
|
||||
ToolLine::Value(SSP, Index-1, anArrPts3d1, anArrPts2d1);
|
||||
ToolLine::Value(SSP, Index, anArrPts3d2, anArrPts2d2);
|
||||
}
|
||||
|
||||
CheckTangents(anArrPts2d1, anArrPts2d2, TabV2d);
|
||||
}
|
||||
|
||||
for (i = 1; i <= nbP; i++) {
|
||||
(TabV(i)).Coord(Vt(i2), Vt(i2+1), Vt(i2+2));
|
||||
i2 += 3;
|
||||
}
|
||||
|
||||
for (i = 1; i <= nbP2d; i++) {
|
||||
(TabV2d(i)).Coord(Vt(i2), Vt(i2+1));
|
||||
i2 += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user