0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / Geom2dAPI / Geom2dAPI_InterCurveCurve.hxx
CommitLineData
42cf5bc1 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
5//
6// This file is part of Open CASCADE Technology software library.
7//
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _Geom2dAPI_InterCurveCurve_HeaderFile
18#define _Geom2dAPI_InterCurveCurve_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Boolean.hxx>
25#include <Geom2dInt_GInter.hxx>
26#include <Standard_Real.hxx>
27#include <Standard_Integer.hxx>
28class Geom2d_Curve;
29class Standard_OutOfRange;
30class Standard_NullObject;
31class gp_Pnt2d;
32class Geom2dInt_GInter;
33
34
35//! This class implements methods for computing
36//! - the intersections between two 2D curves,
37//! - the self-intersections of a 2D curve.
38//! Using the InterCurveCurve algorithm allows to get the following results:
39//! - intersection points in the case of cross intersections,
40//! - intersection segments in the case of tangential intersections,
41//! - nothing in the case of no intersections.
42class Geom2dAPI_InterCurveCurve
43{
44public:
45
46 DEFINE_STANDARD_ALLOC
47
48
49 //! Create an empty intersector. Use the
50 //! function Init for further initialization of the intersection
51 //! algorithm by curves or curve.
52 Standard_EXPORT Geom2dAPI_InterCurveCurve();
53
54 //! Creates an object and computes the
55 //! intersections between the curves C1 and C2.
56 Standard_EXPORT Geom2dAPI_InterCurveCurve(const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2, const Standard_Real Tol = 1.0e-6);
57
58
59 //! Creates an object and computes self-intersections of the curve C1.
60 //! Tolerance value Tol, defaulted to 1.0e-6, defines the precision of
61 //! computing the intersection points.
62 //! In case of a tangential intersection, Tol also defines the
63 //! size of intersection segments (limited portions of the curves)
64 //! where the distance between all points from two curves (or a curve
65 //! in case of self-intersection) is less than Tol.
66 //! Warning
67 //! Use functions NbPoints and NbSegments to obtain the number of
68 //! solutions. If the algorithm finds no intersections NbPoints and
69 //! NbSegments return 0.
70 Standard_EXPORT Geom2dAPI_InterCurveCurve(const Handle(Geom2d_Curve)& C1, const Standard_Real Tol = 1.0e-6);
71
72 //! Initializes an algorithm with the
73 //! given arguments and computes the intersections between the curves C1. and C2.
74 Standard_EXPORT void Init (const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2, const Standard_Real Tol = 1.0e-6);
75
76 //! Initializes an algorithm with the
77 //! given arguments and computes the self-intersections of the curve C1.
78 //! Tolerance value Tol, defaulted to 1.0e-6, defines the precision of
79 //! computing the intersection points. In case of a tangential
80 //! intersection, Tol also defines the size of intersection segments
81 //! (limited portions of the curves) where the distance between all
82 //! points from two curves (or a curve in case of self-intersection) is less than Tol.
83 //! Warning
84 //! Use functions NbPoints and NbSegments to obtain the number
85 //! of solutions. If the algorithm finds no intersections NbPoints
86 //! and NbSegments return 0.
87 Standard_EXPORT void Init (const Handle(Geom2d_Curve)& C1, const Standard_Real Tol = 1.0e-6);
88
89 //! Returns the number of intersection-points in case of cross intersections.
90 //! NbPoints returns 0 if no intersections were found.
91 Standard_EXPORT Standard_Integer NbPoints() const;
92
93 //! Returns the intersection point of index Index.
94 //! Intersection points are computed in case of cross intersections with a
95 //! precision equal to the tolerance value assigned at the time of
96 //! construction or in the function Init (this value is defaulted to 1.0e-6).
97 //! Exceptions
98 //! Standard_OutOfRange if index is not in the range [ 1,NbPoints ], where
99 //! NbPoints is the number of computed intersection points
100 Standard_EXPORT gp_Pnt2d Point (const Standard_Integer Index) const;
101
102 //! Returns the number of tangential intersections.
103 //! NbSegments returns 0 if no intersections were found
104 Standard_EXPORT Standard_Integer NbSegments() const;
105
106 //! Use this syntax only to get
107 //! solutions of tangential intersection between two curves.
108 //! Output values Curve1 and Curve2 are the intersection segments on the
109 //! first curve and on the second curve accordingly. Parameter Index
110 //! defines a number of computed solution.
111 //! An intersection segment is a portion of an initial curve limited
112 //! by two points. The distance from each point of this segment to the
113 //! other curve is less or equal to the tolerance value assigned at the
114 //! time of construction or in function Init (this value is defaulted to 1.0e-6).
115 //! Exceptions
116 //! Standard_OutOfRange if Index is not in the range [ 1,NbSegments ],
117 //! where NbSegments is the number of computed tangential intersections.
118 //! Standard_NullObject if the algorithm is initialized for the
119 //! computing of self-intersections on a curve.
120 Standard_EXPORT void Segment (const Standard_Integer Index, Handle(Geom2d_Curve)& Curve1, Handle(Geom2d_Curve)& Curve2) const;
121
42cf5bc1 122 //! return the algorithmic object from Intersection.
123 const Geom2dInt_GInter& Intersector() const;
124
125
126
127
128protected:
129
130
131
132
133
134private:
135
136
137
138 Standard_Boolean myIsDone;
139 Handle(Geom2d_Curve) myCurve1;
140 Handle(Geom2d_Curve) myCurve2;
141 Geom2dInt_GInter myIntersector;
142
143
144};
145
146
147#include <Geom2dAPI_InterCurveCurve.lxx>
148
149
150
151
152
153#endif // _Geom2dAPI_InterCurveCurve_HeaderFile