Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:06

0001 // Created on: 1992-08-06
0002 // Created by: Laurent BUCHARD
0003 // Copyright (c) 1992-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 _IntAna_QuadQuadGeo_HeaderFile
0018 #define _IntAna_QuadQuadGeo_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <IntAna_ResultType.hxx>
0025 #include <gp_Pnt.hxx>
0026 #include <gp_Dir.hxx>
0027 class gp_Pln;
0028 class gp_Cylinder;
0029 class gp_Sphere;
0030 class gp_Cone;
0031 class gp_Torus;
0032 class gp_Lin;
0033 class gp_Circ;
0034 class gp_Elips;
0035 class gp_Parab;
0036 class gp_Hypr;
0037 
0038 
0039 //! Geometric intersections between two natural quadrics
0040 //! (Sphere , Cylinder , Cone , Pln from gp).
0041 //! The possible intersections are :
0042 //! - 1 point
0043 //! - 1 or 2 line(s)
0044 //! - 1 Point and 1 Line
0045 //! - 1 circle
0046 //! - 1 ellipse
0047 //! - 1 parabola
0048 //! - 1 or 2 hyperbola(s).
0049 //! - Empty : there is no intersection between the two quadrics.
0050 //! - Same  : the quadrics are identical
0051 //! - NoGeometricSolution : there may be an intersection, but it
0052 //! is necessary to use an analytic algorithm to determine
0053 //! it. See class IntQuadQuad from IntAna.
0054 class IntAna_QuadQuadGeo 
0055 {
0056 public:
0057 
0058   DEFINE_STANDARD_ALLOC
0059 
0060   
0061   //! Empty constructor.
0062   Standard_EXPORT IntAna_QuadQuadGeo();
0063   
0064   //! Creates the intersection between two planes.
0065   //! TolAng is the angular tolerance used to determine
0066   //! if the planes are parallel.
0067   //! Tol is the tolerance used to determine if the planes
0068   //! are identical (only when they are parallel).
0069   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Pln& P1, const gp_Pln& P2, const Standard_Real TolAng, const Standard_Real Tol);
0070   
0071   //! Intersects two planes.
0072   //! TolAng is the angular tolerance used to determine
0073   //! if the planes are parallel.
0074   //! Tol is the tolerance used to determine if the planes
0075   //! are identical (only when they are parallel).
0076   Standard_EXPORT void Perform (const gp_Pln& P1, const gp_Pln& P2, const Standard_Real TolAng, const Standard_Real Tol);
0077   
0078   //! Creates the intersection between a plane and a cylinder.
0079   //! TolAng is the angular tolerance used to determine
0080   //! if the axis of the cylinder is parallel to the plane.
0081   //! Tol is the tolerance used to determine if the result
0082   //! is a circle or an ellipse. If the maximum distance between
0083   //! the ellipse solution and the circle centered at the ellipse
0084   //! center is less than Tol, the result will be the circle.
0085   //! H is the height of the cylinder <Cyl>. It is  used to check
0086   //! whether the plane and cylinder are parallel.
0087   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Pln& P, const gp_Cylinder& C, const Standard_Real Tolang, const Standard_Real Tol, const Standard_Real H = 0);
0088   
0089   //! Intersects a plane and a cylinder.
0090   //! TolAng is the angular tolerance used to determine
0091   //! if the axis of the cylinder is parallel to the plane.
0092   //! Tol is the tolerance used to determine if the result
0093   //! is a circle or an ellipse. If the maximum distance between
0094   //! the ellipse solution and the circle centered at the ellipse
0095   //! center is less than Tol, the result will be the circle.
0096   //! H is the height of the cylinder <Cyl>. It is  used to check
0097   //! whether the plane and cylinder are parallel.
0098   Standard_EXPORT void Perform (const gp_Pln& P, const gp_Cylinder& C, const Standard_Real Tolang, const Standard_Real Tol, const Standard_Real H = 0);
0099   
0100   //! Creates the intersection between a plane and a sphere.
0101   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Pln& P, const gp_Sphere& S);
0102   
0103   //! Intersects a plane and a sphere.
0104   Standard_EXPORT void Perform (const gp_Pln& P, const gp_Sphere& S);
0105   
0106   //! Creates the intersection between a plane and a cone.
0107   //! TolAng is the angular tolerance used to determine
0108   //! if the axis of the cone is parallel or perpendicular
0109   //! to the plane, and if the generating line of the cone
0110   //! is parallel to the plane.
0111   //! Tol is the tolerance used to determine if the apex
0112   //! of the cone is in the plane.
0113   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Pln& P, const gp_Cone& C, const Standard_Real Tolang, const Standard_Real Tol);
0114   
0115   //! Intersects a plane and a cone.
0116   //! TolAng is the angular tolerance used to determine
0117   //! if the axis of the cone is parallel or perpendicular
0118   //! to the plane, and if the generating line of the cone
0119   //! is parallel to the plane.
0120   //! Tol is the tolerance used to determine if the apex
0121   //! of the cone is in the plane.
0122   Standard_EXPORT void Perform (const gp_Pln& P, const gp_Cone& C, const Standard_Real Tolang, const Standard_Real Tol);
0123   
0124   //! Creates the intersection between two cylinders.
0125   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Cylinder& Cyl1, const gp_Cylinder& Cyl2, const Standard_Real Tol);
0126   
0127   //! Intersects two cylinders
0128   Standard_EXPORT void Perform (const gp_Cylinder& Cyl1, const gp_Cylinder& Cyl2, const Standard_Real Tol);
0129   
0130   //! Creates the intersection between a Cylinder and a Sphere.
0131   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Cylinder& Cyl, const gp_Sphere& Sph, const Standard_Real Tol);
0132   
0133   //! Intersects a cylinder and a sphere.
0134   Standard_EXPORT void Perform (const gp_Cylinder& Cyl, const gp_Sphere& Sph, const Standard_Real Tol);
0135   
0136   //! Creates the intersection between a Cylinder and a Cone
0137   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Cylinder& Cyl, const gp_Cone& Con, const Standard_Real Tol);
0138   
0139   //! Intersects a cylinder and a cone.
0140   Standard_EXPORT void Perform (const gp_Cylinder& Cyl, const gp_Cone& Con, const Standard_Real Tol);
0141   
0142   //! Creates the intersection between two Spheres.
0143   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Sphere& Sph1, const gp_Sphere& Sph2, const Standard_Real Tol);
0144   
0145   //! Intersects a two spheres.
0146   Standard_EXPORT void Perform (const gp_Sphere& Sph1, const gp_Sphere& Sph2, const Standard_Real Tol);
0147   
0148   //! Creates the intersection between a Sphere and a Cone.
0149   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Sphere& Sph, const gp_Cone& Con, const Standard_Real Tol);
0150   
0151   //! Intersects a sphere and a cone.
0152   Standard_EXPORT void Perform (const gp_Sphere& Sph, const gp_Cone& Con, const Standard_Real Tol);
0153   
0154   //! Creates the intersection between two cones.
0155   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Cone& Con1, const gp_Cone& Con2, const Standard_Real Tol);
0156   
0157   //! Intersects two cones.
0158   Standard_EXPORT void Perform (const gp_Cone& Con1, const gp_Cone& Con2, const Standard_Real Tol);
0159   
0160   //! Creates the intersection between plane and torus.
0161   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Pln& Pln, const gp_Torus& Tor, const Standard_Real Tol);
0162   
0163   //! Intersects plane and torus.
0164   Standard_EXPORT void Perform (const gp_Pln& Pln, const gp_Torus& Tor, const Standard_Real Tol);
0165   
0166   //! Creates the intersection between cylinder and torus.
0167   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Cylinder& Cyl, const gp_Torus& Tor, const Standard_Real Tol);
0168   
0169   //! Intersects cylinder and torus.
0170   Standard_EXPORT void Perform (const gp_Cylinder& Cyl, const gp_Torus& Tor, const Standard_Real Tol);
0171   
0172   //! Creates the intersection between cone and torus.
0173   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Cone& Con, const gp_Torus& Tor, const Standard_Real Tol);
0174   
0175   //! Intersects cone and torus.
0176   Standard_EXPORT void Perform (const gp_Cone& Con, const gp_Torus& Tor, const Standard_Real Tol);
0177   
0178   //! Creates the intersection between sphere and torus.
0179   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Sphere& Sph, const gp_Torus& Tor, const Standard_Real Tol);
0180   
0181   //! Intersects sphere and torus.
0182   Standard_EXPORT void Perform (const gp_Sphere& Sph, const gp_Torus& Tor, const Standard_Real Tol);
0183   
0184   //! Creates the intersection between two toruses.
0185   Standard_EXPORT IntAna_QuadQuadGeo(const gp_Torus& Tor1, const gp_Torus& Tor2, const Standard_Real Tol);
0186   
0187   //! Intersects two toruses.
0188   Standard_EXPORT void Perform (const gp_Torus& Tor1, const gp_Torus& Tor2, const Standard_Real Tol);
0189   
0190   //! Returns Standard_True if the computation was successful.
0191     Standard_Boolean IsDone() const;
0192   
0193   //! Returns the type of intersection.
0194     IntAna_ResultType TypeInter() const;
0195   
0196   //! Returns the number of intersections.
0197   //! The possible intersections are :
0198   //! - 1 point
0199   //! - 1 or 2 line(s)
0200   //! - 1 Point and 1 Line
0201   //! - 1 circle
0202   //! - 1 ellipse
0203   //! - 1 parabola
0204   //! - 1 or 2 hyperbola(s).
0205     Standard_Integer NbSolutions() const;
0206   
0207   //! Returns the point solution of range Num.
0208   Standard_EXPORT gp_Pnt Point (const Standard_Integer Num) const;
0209   
0210   //! Returns the line solution of range Num.
0211   Standard_EXPORT gp_Lin Line (const Standard_Integer Num) const;
0212   
0213   //! Returns the circle solution of range Num.
0214   Standard_EXPORT gp_Circ Circle (const Standard_Integer Num) const;
0215   
0216   //! Returns the ellipse solution of range Num.
0217   Standard_EXPORT gp_Elips Ellipse (const Standard_Integer Num) const;
0218   
0219   //! Returns the parabola solution of range Num.
0220   Standard_EXPORT gp_Parab Parabola (const Standard_Integer Num) const;
0221   
0222   //! Returns the hyperbola solution of range Num.
0223   Standard_EXPORT gp_Hypr Hyperbola (const Standard_Integer Num) const;
0224   
0225   Standard_EXPORT Standard_Boolean HasCommonGen() const;
0226   
0227   Standard_EXPORT const gp_Pnt& PChar() const;
0228 
0229 
0230 
0231 
0232 protected:
0233 
0234   
0235   //! Initialize the values of inner tolerances.
0236   Standard_EXPORT void InitTolerances();
0237 
0238 
0239   Standard_Boolean done;
0240   Standard_Integer nbint;
0241   IntAna_ResultType typeres;
0242   gp_Pnt pt1;
0243   gp_Pnt pt2;
0244   gp_Pnt pt3;
0245   gp_Pnt pt4;
0246   gp_Dir dir1;
0247   gp_Dir dir2;
0248   gp_Dir dir3;
0249   gp_Dir dir4;
0250   Standard_Real param1;
0251   Standard_Real param2;
0252   Standard_Real param3;
0253   Standard_Real param4;
0254   Standard_Real param1bis;
0255   Standard_Real param2bis;
0256   Standard_Real myEPSILON_DISTANCE;
0257   Standard_Real myEPSILON_ANGLE_CONE;
0258   Standard_Real myEPSILON_MINI_CIRCLE_RADIUS;
0259   Standard_Real myEPSILON_CYLINDER_DELTA_RADIUS;
0260   Standard_Real myEPSILON_CYLINDER_DELTA_DISTANCE;
0261   Standard_Real myEPSILON_AXES_PARA;
0262   Standard_Boolean myCommonGen;
0263   gp_Pnt myPChar;
0264 
0265 
0266 private:
0267 
0268 
0269 
0270 
0271 
0272 };
0273 
0274 
0275 #include <IntAna_QuadQuadGeo.lxx>
0276 
0277 
0278 
0279 
0280 
0281 #endif // _IntAna_QuadQuadGeo_HeaderFile