Files
OCCT/src/IntPatch/IntPatch_Point.hxx
nbv e2e0498b17 0027431: [Regression to 6.9.1] Huge tolerance obtained during intersection of cylinder and sphere
The root of the problem is incorrect processing of cases when intersection line goes through the apex(es) of sphere. The fix improves this situation. The algorithm is taken from DecomposeResult(...) function (see IntPatch_ImpPrmIntersection.cxx file). Before the fix, faltering steps were done to solve this problem. As result, it worked in some particular cases. Now, its possibilities have been extended significantly.

Following changes have been made in the fix:

1. Class IntPatch_ALineToWLine has been rewritten cardinally. It touches as interfaces of existing methods as adding/removing some methods/fields. Correction touches both cases: going through seam of Cone/Sphere and through pole(s) of sphere. Old interface did not allow making some actions with analytical line (ALine), e.g. splitting it on several Walking-lines (WLine).

2. Restriction-line support has been removed from Implicit-Implicit intersection result (see IntPatch_Intersection::GeomGeomPerfom(...) method). It connects with the fact that the intersection algorithm itself returns precise intersection line in analytical cases (in compare with parametric intersector). Therefore, we do not need in additional (restriction) line.

3. New class IntPatch_SpecialPoints has been added. This class contains methods to add some special points (such as apex of cone, pole of sphere, point on surface boundary etc.) in intersection line (IntPatch_PointLine). It is based on the static functions, which already exist in IntPatch_ImpPrmIntersection.cxx file (these functions have been moved to the new class).

4. Method IntPatch_WLineTool::ExtendTwoWlinesToEachOther(...) has been renamed to IntPatch_WLineTool::ExtendTwoWLines(...). It is connected with changing main idea of the method. Now it allows extending WLine to the surface boundary or to the singular point (if it is possible): cone apex, sphere pole etc. Interface of this method has been corrected, too. At that, old functionality (extending to each other) has been kept. For implementation of this algorithm, new enumeration "IntPatchWT_WLsConnectionType" has been created.

5. Method IntPatch_PointLine::CurvatureRadiusOfIntersLine(...) has been added. See IntPatch_PointLine.hxx for detail information. It allows correct step computing depended on the local curvature of the intersection line. This method uses geometrical properties of intersected surfaces to compute local curvature. Therefore, it can be applied in wide range of cases even if the intersection curve is not represented in explicit form (e.g. in case of param-param-intersection).

6. Method IntSurf::SetPeriod(...) has been created.

7. Additional check has been added in Draft_Modification::Perform() method for better choice of correct fragment of intersection line for processing DRAFT operation.

8. New overload method IntPatch_Point::SetValue() has been added.

9. Some refactoring of the code has been made.

Creation of test case for issue #27431.

---------------------------------------------------------------------------------------------
Some test cases have been adjusted according to their new behavior.

   tests\bugs\modalg_4\bug62
It is really IMPROVEMENT (but fortuitous).

   tests\bugs\modalg_5\bug25838
The behavior of this test has been reverted to the state before fixing the issue #27341. Main problem has not been fixed in #27341. It was fortuitous improvement.

    tests\bugs\moddata_2\bug565
Quality of intersection curve was not checked. And the curve is bad on both MASTER and FIX. Input data are really wrong: plane-like-cone. However, on the MASTER, four intersection curves (the quality is insignificant) are expected. On the fix, not empty intersection result is expected simply.

   tests\boolean\volumemaker\A8
Differences in images and CPU is expected. Difference in images is expected to be fixed in the issue #26020. Now, we should apply this behavior.
Much CPU time is spent by IntTools_FaceFace::ComputeTolReached3d(...) and GeomInt_IntSS::BuildPCurves(...) methods calling. These methods are not touched by the algorithm. It is the result of change of intersection curve(s) form. However, the new Curve(s) seems to be valid and can be applied. As result, new behavior can be applied, too.

   tests\boolean\volumemaker\F8
   tests\boolean\volumemaker\F9
   tests\boolean\volumemaker\G5
   tests\boolean\volumemaker\G6
CPU difference is expected. Much CPU time is spent by IntPatch_PointLine::CurvatureRadiusOfIntersLine(...) method calling. This method is really new (it does not exist on the MASTER) and is really useful. Therefore, we should apply new behavior.

   tests\boolean\volumemaker\G1
CPU difference is expected. Much CPU time is spent by IntTools_WLineTool::DecompositionOfWLine(...) and IntTools_FaceFace::ComputeTolReached3d(...) methods calling. These methods are not touched by the algorithm. It is the result of change of intersection curve(s) form. However, the new Curve(s) seems to be valid and can be applied. As result, new behavior can be applied, too.

   tests\bugs\modalg_6\bug26619
Differences in images is expected. The test keeps its BAD status on the FIX. But the result on the fix is nearer to expected than on the MASTER. Issue #27014 is still actual. As before, it is not clear, why the number of entities is different. The number of section curves has not been changed. Interfered entities are the same as on the MASTER.

   tests\bugs\modalg_5\bug25319_1(2)
The reason is described in the issue #27896.

Small correction in the test case
2016-11-03 14:15:41 +03:00

252 lines
8.1 KiB
C++

// Created on: 1992-05-06
// Created by: Jacques GOUSSARD
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _IntPatch_Point_HeaderFile
#define _IntPatch_Point_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <IntSurf_PntOn2S.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <IntSurf_Transition.hxx>
#include <Adaptor2d_HCurve2d.hxx>
class Adaptor3d_HVertex;
class Standard_DomainError;
class gp_Pnt;
class IntSurf_Transition;
class IntSurf_PntOn2S;
//! Definition of an intersection point between two surfaces.
//! Such a point is contains geometrical informations (see
//! the Value method) and logical informations.
class IntPatch_Point
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor.
Standard_EXPORT IntPatch_Point();
//! Sets the values of a point which is on no domain,
//! when both surfaces are implicit ones.
//! If Tangent is True, the point is a point of tangency
//! between the surfaces.
Standard_EXPORT void SetValue (const gp_Pnt& Pt, const Standard_Real Tol, const Standard_Boolean Tangent);
void SetValue (const gp_Pnt& Pt);
//! Sets the value of <pt> member
void SetValue (const IntSurf_PntOn2S& thePOn2S);
void SetTolerance (const Standard_Real Tol);
//! Sets the values of the parameters of the point
//! on each surface.
void SetParameters (const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2);
//! Set the value of the parameter on the intersection line.
void SetParameter (const Standard_Real Para);
//! Sets the values of a point which is a vertex on
//! the initial facet of restriction of one
//! of the surface.
//! If OnFirst is True, the point is on the domain of the
//! first patch, otherwise the point is on the domain of the
//! second surface.
Standard_EXPORT void SetVertex (const Standard_Boolean OnFirst, const Handle(Adaptor3d_HVertex)& V);
//! Sets the values of a point which is on one of the domain,
//! when both surfaces are implicit ones.
//! If OnFirst is True, the point is on the domain of the
//! first patch, otherwise the point is on the domain of the
//! second surface.
Standard_EXPORT void SetArc (const Standard_Boolean OnFirst, const Handle(Adaptor2d_HCurve2d)& A, const Standard_Real Param, const IntSurf_Transition& TLine, const IntSurf_Transition& TArc);
//! Sets (or unsets) the point as a point on several
//! intersection line.
void SetMultiple (const Standard_Boolean IsMult);
//! Returns the intersection point (geometric information).
const gp_Pnt& Value() const;
//! This method returns the parameter of the point
//! on the intersection line.
//! If the points does not belong to an intersection line,
//! the value returned does not have any sens.
Standard_Real ParameterOnLine() const;
//! This method returns the fuzziness on the point.
Standard_Real Tolerance() const;
//! Returns True if the Point is a tangency point between
//! the surfaces.
//! If the Point is on one of the domain (IsOnDomS1 returns
//! True or IsOnDomS2 returns True), an exception is raised.
Standard_Boolean IsTangencyPoint() const;
//! Returns the parameters on the first surface of the point.
void ParametersOnS1 (Standard_Real& U1, Standard_Real& V1) const;
//! Returns the parameters on the second surface of the point.
void ParametersOnS2 (Standard_Real& U2, Standard_Real& V2) const;
//! Returns True if the point belongs to several intersection
//! lines.
Standard_Boolean IsMultiple() const;
//! Returns TRUE if the point is on a boundary of the domain
//! of the first patch.
Standard_Boolean IsOnDomS1() const;
//! Returns TRUE if the point is a vertex on the initial
//! restriction facet of the first surface.
Standard_Boolean IsVertexOnS1() const;
//! Returns the information about the point when it is
//! on the domain of the first patch, i-e when the function
//! IsVertexOnS1 returns True.
//! Otherwise, an exception is raised.
const Handle(Adaptor3d_HVertex)& VertexOnS1() const;
//! Returns the arc of restriction containing the
//! vertex.
//! The exception DomainError is raised if
//! IsOnDomS1 returns False.
const Handle(Adaptor2d_HCurve2d)& ArcOnS1() const;
//! Returns the transition of the point on the
//! intersection line with the arc on S1.
//! The exception DomainError is raised if IsOnDomS1
//! returns False.
const IntSurf_Transition& TransitionLineArc1() const;
//! Returns the transition between the intersection line
//! returned by the method Line and the arc on S1 returned
//! by ArcOnS1().
//! The exception DomainError is raised if
//! IsOnDomS1 returns False.
const IntSurf_Transition& TransitionOnS1() const;
//! Returns the parameter of the point on the
//! arc returned by the method ArcOnS2.
//! The exception DomainError is raised if
//! IsOnDomS1 returns False.
Standard_Real ParameterOnArc1() const;
//! Returns TRUE if the point is on a boundary of the domain
//! of the second patch.
Standard_Boolean IsOnDomS2() const;
//! Returns TRUE if the point is a vertex on the initial
//! restriction facet of the first surface.
Standard_Boolean IsVertexOnS2() const;
//! Returns the information about the point when it is
//! on the domain of the second patch, i-e when the function
//! IsVertexOnS2 returns True.
//! Otherwise, an exception is raised.
const Handle(Adaptor3d_HVertex)& VertexOnS2() const;
//! Returns the arc of restriction containing the
//! vertex.
//! The exception DomainError is raised if
//! IsOnDomS2 returns False.
const Handle(Adaptor2d_HCurve2d)& ArcOnS2() const;
//! Returns the transition of the point on the
//! intersection line with the arc on S2.
//! The exception DomainError is raised if IsOnDomS2
//! returns False.
const IntSurf_Transition& TransitionLineArc2() const;
//! Returns the transition between the intersection line
//! returned by the method Line and the arc on S2 returned
//! by ArcOnS2.
//! The exception DomainError is raised if
//! IsOnDomS2 returns False.
const IntSurf_Transition& TransitionOnS2() const;
//! Returns the parameter of the point on the
//! arc returned by the method ArcOnS2.
//! The exception DomainError is raised if
//! IsOnDomS2 returns False.
Standard_Real ParameterOnArc2() const;
//! Returns the PntOn2S
//! (geometric Point and the parameters)
const IntSurf_PntOn2S& PntOn2S() const;
//! Returns the parameters on the first and on the
//! second surface of the point.
void Parameters (Standard_Real& U1, Standard_Real& V1, Standard_Real& U2, Standard_Real& V2) const;
Standard_EXPORT void ReverseTransition();
Standard_EXPORT void Dump() const;
protected:
private:
IntSurf_PntOn2S pt;
Standard_Real para;
Standard_Real tol;
Standard_Boolean tgt;
Standard_Boolean mult;
Standard_Boolean onS1;
Standard_Boolean vtxonS1;
Handle(Adaptor3d_HVertex) vS1;
Handle(Adaptor2d_HCurve2d) arcS1;
IntSurf_Transition traline1;
IntSurf_Transition tra1;
Standard_Real prm1;
Standard_Boolean onS2;
Standard_Boolean vtxonS2;
Handle(Adaptor3d_HVertex) vS2;
Handle(Adaptor2d_HCurve2d) arcS2;
IntSurf_Transition traline2;
IntSurf_Transition tra2;
Standard_Real prm2;
};
#include <IntPatch_Point.lxx>
#endif // _IntPatch_Point_HeaderFile