1 // Created on: 1994-03-24
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Geom2dAPI_InterCurveCurve_HeaderFile
18 #define _Geom2dAPI_InterCurveCurve_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Geom2dInt_GInter.hxx>
25 #include <Standard_Integer.hxx>
30 //! This class implements methods for computing
31 //! - the intersections between two 2D curves,
32 //! - the self-intersections of a 2D curve.
33 //! Using the InterCurveCurve algorithm allows to get the following results:
34 //! - intersection points in the case of cross intersections,
35 //! - intersection segments in the case of tangential intersections,
36 //! - nothing in the case of no intersections.
37 class Geom2dAPI_InterCurveCurve
44 //! Create an empty intersector. Use the
45 //! function Init for further initialization of the intersection
46 //! algorithm by curves or curve.
47 Standard_EXPORT Geom2dAPI_InterCurveCurve();
49 //! Creates an object and computes the
50 //! intersections between the curves C1 and C2.
51 Standard_EXPORT Geom2dAPI_InterCurveCurve(const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2, const Standard_Real Tol = 1.0e-6);
54 //! Creates an object and computes self-intersections of the curve C1.
55 //! Tolerance value Tol, defaulted to 1.0e-6, defines the precision of
56 //! computing the intersection points.
57 //! In case of a tangential intersection, Tol also defines the
58 //! size of intersection segments (limited portions of the curves)
59 //! where the distance between all points from two curves (or a curve
60 //! in case of self-intersection) is less than Tol.
62 //! Use functions NbPoints and NbSegments to obtain the number of
63 //! solutions. If the algorithm finds no intersections NbPoints and
64 //! NbSegments return 0.
65 Standard_EXPORT Geom2dAPI_InterCurveCurve(const Handle(Geom2d_Curve)& C1, const Standard_Real Tol = 1.0e-6);
67 //! Initializes an algorithm with the
68 //! given arguments and computes the intersections between the curves C1. and C2.
69 Standard_EXPORT void Init (const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2, const Standard_Real Tol = 1.0e-6);
71 //! Initializes an algorithm with the
72 //! given arguments and computes the self-intersections of the curve C1.
73 //! Tolerance value Tol, defaulted to 1.0e-6, defines the precision of
74 //! computing the intersection points. In case of a tangential
75 //! intersection, Tol also defines the size of intersection segments
76 //! (limited portions of the curves) where the distance between all
77 //! points from two curves (or a curve in case of self-intersection) is less than Tol.
79 //! Use functions NbPoints and NbSegments to obtain the number
80 //! of solutions. If the algorithm finds no intersections NbPoints
81 //! and NbSegments return 0.
82 Standard_EXPORT void Init (const Handle(Geom2d_Curve)& C1, const Standard_Real Tol = 1.0e-6);
84 //! Returns the number of intersection-points in case of cross intersections.
85 //! NbPoints returns 0 if no intersections were found.
86 Standard_EXPORT Standard_Integer NbPoints() const;
88 //! Returns the intersection point of index Index.
89 //! Intersection points are computed in case of cross intersections with a
90 //! precision equal to the tolerance value assigned at the time of
91 //! construction or in the function Init (this value is defaulted to 1.0e-6).
93 //! Standard_OutOfRange if index is not in the range [ 1,NbPoints ], where
94 //! NbPoints is the number of computed intersection points
95 Standard_EXPORT gp_Pnt2d Point (const Standard_Integer Index) const;
97 //! Returns the number of tangential intersections.
98 //! NbSegments returns 0 if no intersections were found
99 Standard_EXPORT Standard_Integer NbSegments() const;
101 //! Use this syntax only to get
102 //! solutions of tangential intersection between two curves.
103 //! Output values Curve1 and Curve2 are the intersection segments on the
104 //! first curve and on the second curve accordingly. Parameter Index
105 //! defines a number of computed solution.
106 //! An intersection segment is a portion of an initial curve limited
107 //! by two points. The distance from each point of this segment to the
108 //! other curve is less or equal to the tolerance value assigned at the
109 //! time of construction or in function Init (this value is defaulted to 1.0e-6).
111 //! Standard_OutOfRange if Index is not in the range [ 1,NbSegments ],
112 //! where NbSegments is the number of computed tangential intersections.
113 //! Standard_NullObject if the algorithm is initialized for the
114 //! computing of self-intersections on a curve.
115 Standard_EXPORT void Segment (const Standard_Integer Index, Handle(Geom2d_Curve)& Curve1, Handle(Geom2d_Curve)& Curve2) const;
117 //! return the algorithmic object from Intersection.
118 const Geom2dInt_GInter& Intersector() const;
133 Standard_Boolean myIsDone;
134 Handle(Geom2d_Curve) myCurve1;
135 Handle(Geom2d_Curve) myCurve2;
136 Geom2dInt_GInter myIntersector;
142 #include <Geom2dAPI_InterCurveCurve.lxx>
148 #endif // _Geom2dAPI_InterCurveCurve_HeaderFile