Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:33

0001 // Created on: 1994-03-24
0002 // Created by: Bruno DUMORTIER
0003 // Copyright (c) 1994-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Geom2dAPI_InterCurveCurve_HeaderFile
0018 #define _Geom2dAPI_InterCurveCurve_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Geom2dInt_GInter.hxx>
0025 #include <Standard_Integer.hxx>
0026 class Geom2d_Curve;
0027 class gp_Pnt2d;
0028 
0029 
0030 //! This class implements methods for computing
0031 //! -       the intersections between  two 2D curves,
0032 //! -       the self-intersections of a  2D curve.
0033 //! Using the InterCurveCurve algorithm allows to get the following results:
0034 //! -      intersection points in the  case of cross intersections,
0035 //! -      intersection segments in the case of tangential intersections,
0036 //! -       nothing in the case of no intersections.
0037 class Geom2dAPI_InterCurveCurve 
0038 {
0039 public:
0040 
0041   DEFINE_STANDARD_ALLOC
0042 
0043   
0044   //! Create an empty intersector. Use the
0045   //! function Init for further initialization of the intersection
0046   //! algorithm by curves or curve.
0047   Standard_EXPORT Geom2dAPI_InterCurveCurve();
0048   
0049   //! Creates an object and computes the
0050   //! intersections between the curves C1 and C2.
0051   Standard_EXPORT Geom2dAPI_InterCurveCurve(const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2, const Standard_Real Tol = 1.0e-6);
0052   
0053 
0054   //! Creates an object and computes self-intersections of the curve C1.
0055   //! Tolerance value Tol, defaulted to 1.0e-6, defines the precision of
0056   //! computing the intersection points.
0057   //! In case of a tangential intersection, Tol also defines the
0058   //! size of intersection segments (limited portions of the curves)
0059   //! where the distance between all points from two curves (or a curve
0060   //! in case of self-intersection) is less than Tol.
0061   //! Warning
0062   //! Use functions NbPoints and NbSegments to obtain the number of
0063   //! solutions. If the algorithm finds no intersections NbPoints and
0064   //! NbSegments return 0.
0065   Standard_EXPORT Geom2dAPI_InterCurveCurve(const Handle(Geom2d_Curve)& C1, const Standard_Real Tol = 1.0e-6);
0066   
0067   //! Initializes an algorithm with the
0068   //! given arguments and computes the intersections between the curves C1. and C2.
0069   Standard_EXPORT void Init (const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2, const Standard_Real Tol = 1.0e-6);
0070   
0071   //! Initializes an algorithm with the
0072   //! given arguments and computes the self-intersections of the curve C1.
0073   //! Tolerance value Tol, defaulted to 1.0e-6, defines the precision of
0074   //! computing the intersection points. In case of a tangential
0075   //! intersection, Tol also defines the size of intersection segments
0076   //! (limited portions of the curves) where the distance between all
0077   //! points from two curves (or a curve in case of self-intersection) is less than Tol.
0078   //! Warning
0079   //! Use functions NbPoints and NbSegments to obtain the number
0080   //! of solutions. If the algorithm finds no intersections NbPoints
0081   //! and NbSegments return 0.
0082   Standard_EXPORT void Init (const Handle(Geom2d_Curve)& C1, const Standard_Real Tol = 1.0e-6);
0083   
0084   //! Returns the number of intersection-points in case of cross intersections.
0085   //! NbPoints returns 0 if no intersections were found.
0086   Standard_EXPORT Standard_Integer NbPoints() const;
0087   
0088   //! Returns the intersection point of index Index.
0089   //! Intersection points are computed in case of cross intersections with a
0090   //! precision equal to the tolerance value assigned at the time of
0091   //! construction or in the function Init (this value is defaulted to 1.0e-6).
0092   //! Exceptions
0093   //! Standard_OutOfRange if index is not in the range [ 1,NbPoints ], where
0094   //! NbPoints is the number of computed intersection points
0095   Standard_EXPORT gp_Pnt2d Point (const Standard_Integer Index) const;
0096   
0097   //! Returns the number of tangential intersections.
0098   //! NbSegments returns 0 if no intersections were found
0099   Standard_EXPORT Standard_Integer NbSegments() const;
0100   
0101   //! Use this syntax only to get
0102   //! solutions of tangential intersection between two curves.
0103   //! Output values Curve1 and Curve2 are the intersection segments on the
0104   //! first curve and on the second curve accordingly. Parameter Index
0105   //! defines a number of computed solution.
0106   //! An intersection segment is a portion of an initial curve limited
0107   //! by two points. The distance from each point of this segment to the
0108   //! other curve is less or equal to the tolerance value assigned at the
0109   //! time of construction or in function Init (this value is defaulted to 1.0e-6).
0110   //! Exceptions
0111   //! Standard_OutOfRange if Index is not in the range [ 1,NbSegments ],
0112   //! where NbSegments is the number of computed tangential intersections.
0113   //! Standard_NullObject if the algorithm is initialized for the
0114   //! computing of self-intersections on a curve.
0115   Standard_EXPORT void Segment (const Standard_Integer Index, Handle(Geom2d_Curve)& Curve1, Handle(Geom2d_Curve)& Curve2) const;
0116   
0117   //! return the algorithmic object from Intersection.
0118     const Geom2dInt_GInter& Intersector() const;
0119 
0120 
0121 
0122 
0123 protected:
0124 
0125 
0126 
0127 
0128 
0129 private:
0130 
0131 
0132 
0133   Standard_Boolean myIsDone;
0134   Handle(Geom2d_Curve) myCurve1;
0135   Handle(Geom2d_Curve) myCurve2;
0136   Geom2dInt_GInter myIntersector;
0137 
0138 
0139 };
0140 
0141 
0142 #include <Geom2dAPI_InterCurveCurve.lxx>
0143 
0144 
0145 
0146 
0147 
0148 #endif // _Geom2dAPI_InterCurveCurve_HeaderFile