Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:58:31

0001 // Created on: 1992-03-05
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 _IntRes2d_Domain_HeaderFile
0018 #define _IntRes2d_Domain_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <gp_Pnt2d.hxx>
0025 #include <Standard_Boolean.hxx>
0026 
0027 //! Definition of the domain of parameter on a 2d-curve.
0028 //! Most of the time, a domain is defined by two extremities.
0029 //! An extremity is made of :
0030 //! - a point in 2d-space (Pnt2d from gp),
0031 //! - a parameter on the curve,
0032 //! - a tolerance in the 2d-space.
0033 //! Sometimes, it can be made of 0 or 1 point ( for an infinite
0034 //! or semi-infinite line for example).
0035 //!
0036 //! For Intersection algorithms, Ellipses and Circles
0037 //! Domains must be closed.
0038 //! So, SetEquivalentParameters(.,.) method must be called
0039 //! after initializing the first and the last bounds.
0040 class IntRes2d_Domain
0041 {
0042 public:
0043   DEFINE_STANDARD_ALLOC
0044 
0045   //! Creates an infinite Domain (HasFirstPoint = False
0046   //! and HasLastPoint = False).
0047   Standard_EXPORT IntRes2d_Domain();
0048 
0049   //! Creates a bounded Domain.
0050   Standard_EXPORT IntRes2d_Domain(const gp_Pnt2d& Pnt1,
0051                                   const double    Par1,
0052                                   const double    Tol1,
0053                                   const gp_Pnt2d& Pnt2,
0054                                   const double    Par2,
0055                                   const double    Tol2);
0056 
0057   //! Creates a semi-infinite Domain. If First is set to
0058   //! True, the given point is the first point of the domain,
0059   //! otherwise it is the last point.
0060   Standard_EXPORT IntRes2d_Domain(const gp_Pnt2d& Pnt,
0061                                   const double    Par,
0062                                   const double    Tol,
0063                                   const bool      First);
0064 
0065   //! Sets the values for a bounded domain.
0066   Standard_EXPORT void SetValues(const gp_Pnt2d& Pnt1,
0067                                  const double    Par1,
0068                                  const double    Tol1,
0069                                  const gp_Pnt2d& Pnt2,
0070                                  const double    Par2,
0071                                  const double    Tol2);
0072 
0073   //! Sets the values for an infinite domain.
0074   Standard_EXPORT void SetValues();
0075 
0076   //! Sets the values for a semi-infinite domain.
0077   Standard_EXPORT void SetValues(const gp_Pnt2d& Pnt,
0078                                  const double    Par,
0079                                  const double    Tol,
0080                                  const bool      First);
0081 
0082   //! Defines a closed domain.
0083   void SetEquivalentParameters(const double zero, const double period);
0084 
0085   //! Returns True if the domain has a first point, i-e
0086   //! a point defining the lowest admitted parameter on the
0087   //! curve.
0088   bool HasFirstPoint() const;
0089 
0090   //! Returns the parameter of the first point of the domain
0091   //! The exception DomainError is raised if HasFirstPoint
0092   //! returns False.
0093   double FirstParameter() const;
0094 
0095   //! Returns the first point of the domain.
0096   //! The exception DomainError is raised if HasFirstPoint
0097   //! returns False.
0098   const gp_Pnt2d& FirstPoint() const;
0099 
0100   //! Returns the tolerance of the first (left) bound.
0101   //! The exception DomainError is raised if HasFirstPoint
0102   //! returns False.
0103   double FirstTolerance() const;
0104 
0105   //! Returns True if the domain has a last point, i-e
0106   //! a point defining the highest admitted parameter on the
0107   //! curve.
0108   bool HasLastPoint() const;
0109 
0110   //! Returns the parameter of the last point of the domain.
0111   //! The exception DomainError is raised if HasLastPoint
0112   //! returns False.
0113   double LastParameter() const;
0114 
0115   //! Returns the last point of the domain.
0116   //! The exception DomainError is raised if HasLastPoint
0117   //! returns False.
0118   const gp_Pnt2d& LastPoint() const;
0119 
0120   //! Returns the tolerance of the last (right) bound.
0121   //! The exception DomainError is raised if HasLastPoint
0122   //! returns False.
0123   double LastTolerance() const;
0124 
0125   //! Returns True if the domain is closed.
0126   bool IsClosed() const;
0127 
0128   //! Returns Equivalent parameters if the domain is closed.
0129   //! Otherwise, the exception DomainError is raised.
0130   void EquivalentParameters(double& zero, double& zeroplusperiod) const;
0131 
0132 private:
0133   int      status;
0134   double   first_param;
0135   double   last_param;
0136   double   first_tol;
0137   double   last_tol;
0138   gp_Pnt2d first_point;
0139   gp_Pnt2d last_point;
0140   double   periodfirst;
0141   double   periodlast;
0142 };
0143 
0144 #include <IntRes2d_Domain.lxx>
0145 
0146 #endif // _IntRes2d_Domain_HeaderFile