1 // Created on: 1992-03-05
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _IntRes2d_Domain_HeaderFile
18 #define _IntRes2d_Domain_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Real.hxx>
26 #include <gp_Pnt2d.hxx>
27 #include <Standard_Boolean.hxx>
28 class Standard_DomainError;
32 //! Definition of the domain of parameter on a 2d-curve.
33 //! Most of the time, a domain is defined by two extremities.
34 //! An extremity is made of :
35 //! - a point in 2d-space (Pnt2d from gp),
36 //! - a parameter on the curve,
37 //! - a tolerance in the 2d-space.
38 //! Sometimes, it can be made of 0 or 1 point ( for an infinite
39 //! or semi-infinite line for example).
41 //! For Intersection algorithms, Ellipses and Circles
42 //! Domains must be closed.
43 //! So, SetEquivalentParameters(.,.) method must be called
44 //! after initializing the first and the last bounds.
52 //! Creates an infinite Domain (HasFirstPoint = False
53 //! and HasLastPoint = False).
54 Standard_EXPORT IntRes2d_Domain();
56 //! Creates a bounded Domain.
57 Standard_EXPORT IntRes2d_Domain(const gp_Pnt2d& Pnt1, const Standard_Real Par1, const Standard_Real Tol1, const gp_Pnt2d& Pnt2, const Standard_Real Par2, const Standard_Real Tol2);
59 //! Creates a semi-infinite Domain. If First is set to
60 //! True, the given point is the first point of the domain,
61 //! otherwise it is the last point.
62 Standard_EXPORT IntRes2d_Domain(const gp_Pnt2d& Pnt, const Standard_Real Par, const Standard_Real Tol, const Standard_Boolean First);
64 //! Sets the values for a bounded domain.
65 Standard_EXPORT void SetValues (const gp_Pnt2d& Pnt1, const Standard_Real Par1, const Standard_Real Tol1, const gp_Pnt2d& Pnt2, const Standard_Real Par2, const Standard_Real Tol2);
67 //! Sets the values for an infinite domain.
68 Standard_EXPORT void SetValues();
70 //! Sets the values for a semi-infinite domain.
71 Standard_EXPORT void SetValues (const gp_Pnt2d& Pnt, const Standard_Real Par, const Standard_Real Tol, const Standard_Boolean First);
73 //! Defines a closed domain.
74 void SetEquivalentParameters (const Standard_Real zero, const Standard_Real period);
76 //! Returns True if the domain has a first point, i-e
77 //! a point defining the lowest admitted parameter on the
79 Standard_Boolean HasFirstPoint() const;
81 //! Returns the parameter of the first point of the domain
82 //! The exception DomainError is raised if HasFirstPoint
84 Standard_Real FirstParameter() const;
86 //! Returns the first point of the domain.
87 //! The exception DomainError is raised if HasFirstPoint
89 const gp_Pnt2d& FirstPoint() const;
91 //! Returns the tolerance of the first (left) bound.
92 //! The exception DomainError is raised if HasFirstPoint
94 Standard_Real FirstTolerance() const;
96 //! Returns True if the domain has a last point, i-e
97 //! a point defining the highest admitted parameter on the
99 Standard_Boolean HasLastPoint() const;
101 //! Returns the parameter of the last point of the domain.
102 //! The exception DomainError is raised if HasLastPoint
104 Standard_Real LastParameter() const;
106 //! Returns the last point of the domain.
107 //! The exception DomainError is raised if HasLastPoint
109 const gp_Pnt2d& LastPoint() const;
111 //! Returns the tolerance of the last (right) bound.
112 //! The exception DomainError is raised if HasLastPoint
114 Standard_Real LastTolerance() const;
116 //! Returns True if the domain is closed.
117 Standard_Boolean IsClosed() const;
119 //! Returns Equivalent parameters if the domain is closed.
120 //! Otherwise, the exception DomainError is raised.
121 void EquivalentParameters (Standard_Real& zero, Standard_Real& zeroplusperiod) const;
136 Standard_Integer status;
137 Standard_Real first_param;
138 Standard_Real last_param;
139 Standard_Real first_tol;
140 Standard_Real last_tol;
141 gp_Pnt2d first_point;
143 Standard_Real periodfirst;
144 Standard_Real periodlast;
150 #include <IntRes2d_Domain.lxx>
156 #endif // _IntRes2d_Domain_HeaderFile