0028591: BOP Cut creates wrong result
[occt.git] / src / IntTools / IntTools_Curve.hxx
CommitLineData
42cf5bc1 1// Created on: 2000-11-23
2// Created by: Michael KLOKOV
3// Copyright (c) 2000-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _IntTools_Curve_HeaderFile
17#define _IntTools_Curve_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_DefineAlloc.hxx>
21#include <Standard_Handle.hxx>
22
23#include <Standard_Boolean.hxx>
24#include <Standard_Real.hxx>
25#include <GeomAbs_CurveType.hxx>
26class Geom_Curve;
27class Geom2d_Curve;
28class gp_Pnt;
29
5652dc62 30//! The class is a container of one 3D curve, two 2D curves and two Tolerance values.<br>
31//! It is used in the Face/Face intersection algorithm to store the results
32//! of intersection. In this context:<br>
33//! **the 3D curve** is the intersection curve;<br>
34//! **the 2D curves** are the PCurves of the 3D curve on the intersecting faces;<br>
35//! **the tolerance** is the valid tolerance for 3D curve computed as
36//! maximal deviation between 3D curve and 2D curves (or surfaces in case there are no 2D curves);<br>
37//! **the tangential tolerance** is the maximal distance from 3D curve to the
38//! end of the tangential zone between faces in terms of their tolerance values.
39class IntTools_Curve
42cf5bc1 40{
41public:
42
43 DEFINE_STANDARD_ALLOC
44
42cf5bc1 45 //! Empty constructor
46 Standard_EXPORT IntTools_Curve();
42cf5bc1 47
5652dc62 48 //! Constructor taking 3d curve, two 2d curves and two tolerance values
49 Standard_EXPORT IntTools_Curve(const Handle(Geom_Curve)& the3dCurve3d,
50 const Handle(Geom2d_Curve)& the2dCurve1,
51 const Handle(Geom2d_Curve)& the2dCurve2,
52 const Standard_Real theTolerance = 0.0,
53 const Standard_Real theTangentialTolerance = 0.0);
54
55 //! Sets the curves
56 void SetCurves(const Handle(Geom_Curve)& the3dCurve,
57 const Handle(Geom2d_Curve)& the2dCurve1,
58 const Handle(Geom2d_Curve)& the2dCurve2)
59 {
60 my3dCurve = the3dCurve;
61 my2dCurve1 = the2dCurve1;
62 my2dCurve2 = the2dCurve2;
63 }
64
65 //! Sets the 3d curve
66 void SetCurve(const Handle(Geom_Curve)& the3dCurve)
67 {
68 my3dCurve = the3dCurve;
69 }
70
71 //! Sets the first 2d curve
72 void SetFirstCurve2d(const Handle(Geom2d_Curve)& the2dCurve1)
73 {
74 my2dCurve1 = the2dCurve1;
75 }
76
77 //! Sets the second 2d curve
78 void SetSecondCurve2d(const Handle(Geom2d_Curve)& the2dCurve2)
79 {
80 my2dCurve2 = the2dCurve2;
81 }
82
83 //! Sets the tolerance for the curve
84 void SetTolerance(const Standard_Real theTolerance)
85 {
86 myTolerance = theTolerance;
87 }
88
89 //! Sets the tangential tolerance
90 void SetTangentialTolerance(const Standard_Real theTangentialTolerance)
91 {
92 myTangentialTolerance = theTangentialTolerance;
93 }
94
95 //! Returns 3d curve
96 const Handle(Geom_Curve)& Curve() const
97 {
98 return my3dCurve;
99 }
100
101 //! Returns first 2d curve
102 const Handle(Geom2d_Curve)& FirstCurve2d() const
103 {
104 return my2dCurve1;
105 }
106
107 //! Returns second 2d curve
108 const Handle(Geom2d_Curve)& SecondCurve2d() const
109 {
110 return my2dCurve2;
111 }
112
113 //! Returns the tolerance
114 Standard_Real Tolerance() const
115 {
116 return myTolerance;
117 }
118
119 //! Returns the tangential tolerance
120 Standard_Real TangentialTolerance() const
121 {
122 return myTangentialTolerance;
123 }
124
125 //! Returns TRUE if 3d curve is BoundedCurve
42cf5bc1 126 Standard_EXPORT Standard_Boolean HasBounds() const;
42cf5bc1 127
5652dc62 128 //! If the 3d curve is bounded curve the method will return TRUE
129 //! and modify the output parameters with boundary parameters of
130 //! the curve and corresponded 3d points.<br>
131 //! If the curve does not have bounds, the method will return false
132 //! and the output parameters will stay untouched.
133 Standard_EXPORT Standard_Boolean Bounds(Standard_Real& theFirst,
134 Standard_Real& theLast,
135 gp_Pnt& theFirstPnt,
136 gp_Pnt& theLastPnt) const;
137
138 //! Computes 3d point corresponded to the given parameter if this
139 //! parameter is inside the boundaries of the curve.
140 //! Returns TRUE in this case. <br>
141 //! Otherwise, the point will not be computed and the method will return FALSE.
142 Standard_EXPORT Standard_Boolean D0(const Standard_Real& thePar,
143 gp_Pnt& thePnt) const;
144
145 //! Returns the type of the 3d curve
146 Standard_EXPORT GeomAbs_CurveType Type() const;
42cf5bc1 147
148protected:
149
42cf5bc1 150private:
151
42cf5bc1 152 Handle(Geom_Curve) my3dCurve;
153 Handle(Geom2d_Curve) my2dCurve1;
154 Handle(Geom2d_Curve) my2dCurve2;
5652dc62 155 Standard_Real myTolerance;
156 Standard_Real myTangentialTolerance;
42cf5bc1 157};
158
42cf5bc1 159#endif // _IntTools_Curve_HeaderFile