1 // Created on: 1997-05-05
2 // Created by: Jerome LEMONIER
3 // Copyright (c) 1997-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 _GeomPlate_PointConstraint_HeaderFile
18 #define _GeomPlate_PointConstraint_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <GeomLProp_SLProps.hxx>
25 #include <gp_Pnt2d.hxx>
27 #include <Standard_Real.hxx>
28 #include <Standard_Integer.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <MMgt_TShared.hxx>
32 class Standard_ConstructionError;
36 class GeomLProp_SLProps;
39 class GeomPlate_PointConstraint;
40 DEFINE_STANDARD_HANDLE(GeomPlate_PointConstraint, MMgt_TShared)
43 //! Defines points as constraints to be used to deform a surface.
44 class GeomPlate_PointConstraint : public MMgt_TShared
50 //! Constructs a point constraint object defined by Pt, a 3D point
51 //! Order gives the order of constraint, one of:
52 //! - -1 i.e. none, or 0 i.e.G0 when assigned to Pt
53 //! - -1 i.e. none, 0 i.e. G0, 1 i.e. G1, 2 i.e. G2 when
54 //! assigned to U, V and Surf.
55 //! In this constructor, only TolDist is given.
56 //! Distance tolerance represents the greatest distance
57 //! allowed between the constraint and the target surface.
58 //! Angular tolerance represents the largest angle allowed
59 //! between the constraint and the target surface. Curvature
60 //! tolerance represents the greatest difference in curvature
61 //! allowed between the constraint and the target surface.
62 //! Raises ConstructionError if Order is not 0 or -1
63 Standard_EXPORT GeomPlate_PointConstraint(const gp_Pnt& Pt, const Standard_Integer Order, const Standard_Real TolDist = 0.0001);
65 //! Constructs a point constraint object defined by
66 //! the intersection point of U and V on the surface Surf.
67 //! Order gives the order of constraint, one of:
68 //! - -1 i.e. none, or 0 i.e.G0 when assigned to Pt
69 //! - -1 i.e. none, 0 i.e. G0, 1 i.e. G1, 2 i.e. G2 when
70 //! assigned to U, V and Surf.
71 //! In this constructor the surface to be generated must
72 //! respect several tolerance values only:
73 //! - the distance tolerance TolDist
74 //! - the angular tolerance TolAng
75 //! - the curvature tolerance, TolCurv.
76 //! Distance tolerance represents the greatest distance
77 //! allowed between the constraint and the target surface.
78 //! Angular tolerance represents the largest angle allowed
79 //! between the constraint and the target surface. Curvature
80 //! tolerance represents the greatest difference in curvature
81 //! allowed between the constraint and the target surface.Creates a punctual constraint.
82 Standard_EXPORT GeomPlate_PointConstraint(const Standard_Real U, const Standard_Real V, const Handle(Geom_Surface)& Surf, const Standard_Integer Order, const Standard_Real TolDist = 0.0001, const Standard_Real TolAng = 0.01, const Standard_Real TolCurv = 0.1);
84 Standard_EXPORT void SetOrder (const Standard_Integer Order);
87 //! Returns the order of constraint: G0, G1, and G2,
88 //! controlled respectively by G0Criterion G1Criterion and G2Criterion.
89 Standard_EXPORT Standard_Integer Order() const;
92 //! Allows you to set the G0 criterion. This is the law
93 //! defining the greatest distance allowed between the
94 //! constraint and the target surface. If this criterion is not
95 //! set, {TolDist, the distance tolerance from the constructor, is used
96 Standard_EXPORT void SetG0Criterion (const Standard_Real TolDist);
99 //! Allows you to set the G1 criterion. This is the law
100 //! defining the greatest angle allowed between the
101 //! constraint and the target surface. If this criterion is not
102 //! set, TolAng, the angular tolerance from the constructor, is used.
103 //! Raises ConstructionError if the point is not on the surface
104 Standard_EXPORT void SetG1Criterion (const Standard_Real TolAng);
107 //! Allows you to set the G2 criterion. This is the law
108 //! defining the greatest difference in curvature allowed
109 //! between the constraint and the target surface. If this
110 //! criterion is not set, TolCurv, the curvature tolerance from
111 //! the constructor, is used.
112 //! Raises ConstructionError if the point is not on the surface
113 Standard_EXPORT void SetG2Criterion (const Standard_Real TolCurv);
116 //! Returns the G0 criterion. This is the greatest distance
117 //! allowed between the constraint and the target surface.
118 Standard_EXPORT Standard_Real G0Criterion() const;
121 //! Returns the G1 criterion. This is the greatest angle
122 //! allowed between the constraint and the target surface.
123 //! Raises ConstructionError if the point is not on the surface.
124 Standard_EXPORT Standard_Real G1Criterion() const;
127 //! Returns the G2 criterion. This is the greatest difference
128 //! in curvature allowed between the constraint and the target surface.
129 //! Raises ConstructionError if the point is not on the surface
130 Standard_EXPORT Standard_Real G2Criterion() const;
132 Standard_EXPORT void D0 (gp_Pnt& P) const;
134 Standard_EXPORT void D1 (gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const;
136 Standard_EXPORT void D2 (gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3, gp_Vec& V4, gp_Vec& V5) const;
138 Standard_EXPORT Standard_Boolean HasPnt2dOnSurf() const;
140 Standard_EXPORT void SetPnt2dOnSurf (const gp_Pnt2d& Pnt);
142 Standard_EXPORT gp_Pnt2d Pnt2dOnSurf() const;
144 Standard_EXPORT GeomLProp_SLProps& LPropSurf();
149 DEFINE_STANDARD_RTTIEXT(GeomPlate_PointConstraint,MMgt_TShared)
154 Standard_Integer myOrder;
160 GeomLProp_SLProps myLProp;
163 Handle(Geom_Surface) mySurf;
171 Standard_Real myTolDist;
172 Standard_Real myTolAng;
173 Standard_Real myTolCurv;
174 Standard_Boolean hasPnt2dOnSurf;
185 #endif // _GeomPlate_PointConstraint_HeaderFile