Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:17:35

0001 // Created on: 1991-02-20
0002 // Created by: Jacques GOUSSARD
0003 // Copyright (c) 1991-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 _IntAna2d_AnaIntersection_HeaderFile
0018 #define _IntAna2d_AnaIntersection_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <IntAna2d_IntPoint.hxx>
0025 class gp_Lin2d;
0026 class gp_Circ2d;
0027 class IntAna2d_Conic;
0028 class gp_Elips2d;
0029 class gp_Parab2d;
0030 class gp_Hypr2d;
0031 
0032 //! Implementation of the analytical intersection between:
0033 //! - two Lin2d,
0034 //! - two Circ2d,
0035 //! - a Lin2d and a Circ2d,
0036 //! - an element of gp (Lin2d, Circ2d, Elips2d, Parab2d, Hypr2d)
0037 //! and another conic.
0038 //! No tolerance is given for all the intersections: the tolerance
0039 //! will be the "precision machine".
0040 class IntAna2d_AnaIntersection
0041 {
0042 public:
0043   DEFINE_STANDARD_ALLOC
0044 
0045   //! Empty constructor. IsDone returns False.
0046   Standard_EXPORT IntAna2d_AnaIntersection();
0047 
0048   //! Intersection between two lines.
0049   Standard_EXPORT IntAna2d_AnaIntersection(const gp_Lin2d& L1, const gp_Lin2d& L2);
0050 
0051   //! Intersection between two circles.
0052   Standard_EXPORT IntAna2d_AnaIntersection(const gp_Circ2d& C1, const gp_Circ2d& C2);
0053 
0054   //! Intersection between a line and a circle.
0055   Standard_EXPORT IntAna2d_AnaIntersection(const gp_Lin2d& L, const gp_Circ2d& C);
0056 
0057   //! Intersection between a line and a conic.
0058   Standard_EXPORT IntAna2d_AnaIntersection(const gp_Lin2d& L, const IntAna2d_Conic& C);
0059 
0060   //! Intersection between a circle and another conic.
0061   Standard_EXPORT IntAna2d_AnaIntersection(const gp_Circ2d& C, const IntAna2d_Conic& Co);
0062 
0063   //! Intersection between an ellipse and another conic.
0064   Standard_EXPORT IntAna2d_AnaIntersection(const gp_Elips2d& E, const IntAna2d_Conic& C);
0065 
0066   //! Intersection between a parabola and another conic.
0067   Standard_EXPORT IntAna2d_AnaIntersection(const gp_Parab2d& P, const IntAna2d_Conic& C);
0068 
0069   //! Intersection between an hyperbola and another conic.
0070   Standard_EXPORT IntAna2d_AnaIntersection(const gp_Hypr2d& H, const IntAna2d_Conic& C);
0071 
0072   //! Intersection between two lines.
0073   Standard_EXPORT void Perform(const gp_Lin2d& L1, const gp_Lin2d& L2);
0074 
0075   //! Intersection between two circles.
0076   Standard_EXPORT void Perform(const gp_Circ2d& C1, const gp_Circ2d& C2);
0077 
0078   //! Intersection between a line and a circle.
0079   Standard_EXPORT void Perform(const gp_Lin2d& L, const gp_Circ2d& C);
0080 
0081   //! Intersection between a line and a conic.
0082   Standard_EXPORT void Perform(const gp_Lin2d& L, const IntAna2d_Conic& C);
0083 
0084   //! Intersection between a circle and another conic.
0085   Standard_EXPORT void Perform(const gp_Circ2d& C, const IntAna2d_Conic& Co);
0086 
0087   //! Intersection between an ellipse and another conic.
0088   Standard_EXPORT void Perform(const gp_Elips2d& E, const IntAna2d_Conic& C);
0089 
0090   //! Intersection between a parabola and another conic.
0091   Standard_EXPORT void Perform(const gp_Parab2d& P, const IntAna2d_Conic& C);
0092 
0093   //! Intersection between an hyperbola and another conic.
0094   Standard_EXPORT void Perform(const gp_Hypr2d& H, const IntAna2d_Conic& C);
0095 
0096   //! Returns TRUE if the computation was successful.
0097   bool IsDone() const;
0098 
0099   //! Returns TRUE when there is no intersection, i-e
0100   //! - no intersection point
0101   //! - the elements are not identical.
0102   //! The element may be parallel in this case.
0103   bool IsEmpty() const;
0104 
0105   //! For the intersection between an element of gp and a conic
0106   //! known by an implicit equation, the result will be TRUE
0107   //! if the element of gp verifies the implicit equation.
0108   //! For the intersection between two Lin2d or two Circ2d, the
0109   //! result will be TRUE if the elements are identical.
0110   //! The function returns FALSE in all the other cases.
0111   bool IdenticalElements() const;
0112 
0113   //! For the intersection between two Lin2d or two Circ2d,
0114   //! the function returns TRUE if the elements are parallel.
0115   //! The function returns FALSE in all the other cases.
0116   bool ParallelElements() const;
0117 
0118   //! returns the number of IntPoint between the 2 curves.
0119   int NbPoints() const;
0120 
0121   //! returns the intersection point of range N;
0122   //! If (N<=0) or (N>NbPoints), an exception is raised.
0123   const IntAna2d_IntPoint& Point(const int N) const;
0124 
0125 private:
0126   bool              done;
0127   bool              para;
0128   bool              iden;
0129   bool              empt;
0130   int               nbp;
0131   IntAna2d_IntPoint lpnt[4];
0132 };
0133 
0134 #include <IntAna2d_AnaIntersection.lxx>
0135 
0136 #endif // _IntAna2d_AnaIntersection_HeaderFile