Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-19 10:50:10

0001 // Created on: 1997-05-05
0002 // Created by: Joelle CHAUVET
0003 // Copyright (c) 1997-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 _GeomPlate_CurveConstraint_HeaderFile
0018 #define _GeomPlate_CurveConstraint_HeaderFile
0019 
0020 #include <Adaptor3d_CurveOnSurface.hxx>
0021 #include <GeomLProp_SLProps.hxx>
0022 
0023 class Geom2d_Curve;
0024 class Law_Function;
0025 class gp_Pnt;
0026 class gp_Vec;
0027 
0028 //! Defines curves as constraints to be used to deform a surface.
0029 class GeomPlate_CurveConstraint : public Standard_Transient
0030 {
0031 
0032 public:
0033   //! Initializes an empty curve constraint object.
0034   Standard_EXPORT GeomPlate_CurveConstraint();
0035 
0036   //! Create a constraint
0037   //! Order is the order of the constraint. The possible values for order are -1,0,1,2.
0038   //! Order i means constraints Gi
0039   //! Npt is the number of points associated with the constraint.
0040   //! TolDist is the maximum error to satisfy for G0 constraints
0041   //! TolAng is the maximum error to satisfy for G1 constraints
0042   //! TolCurv is the maximum error to satisfy for G2 constraints
0043   //! These errors can be replaced by laws of criterion.
0044   //! Raises ConstructionError if Order is not -1 , 0, 1, 2
0045   Standard_EXPORT GeomPlate_CurveConstraint(const occ::handle<Adaptor3d_Curve>& Boundary,
0046                                             const int                           Order,
0047                                             const int                           NPt     = 10,
0048                                             const double                        TolDist = 0.0001,
0049                                             const double                        TolAng  = 0.01,
0050                                             const double                        TolCurv = 0.1);
0051 
0052   //! Allows you to set the order of continuity required for
0053   //! the constraints: G0, G1, and G2, controlled
0054   //! respectively by G0Criterion G1Criterion and G2Criterion.
0055   Standard_EXPORT void SetOrder(const int Order);
0056 
0057   //! Returns the order of constraint, one of G0, G1 or G2.
0058   Standard_EXPORT int Order() const;
0059 
0060   //! Returns the number of points on the curve used as a
0061   //! constraint. The default setting is 10. This parameter
0062   //! affects computation time, which increases by the cube of
0063   //! the number of points.
0064   Standard_EXPORT int NbPoints() const;
0065 
0066   //! Allows you to set the number of points on the curve
0067   //! constraint. The default setting is 10. This parameter
0068   //! affects computation time, which increases by the cube of
0069   //! the number of points.
0070   Standard_EXPORT void SetNbPoints(const int NewNb);
0071 
0072   //! Allows you to set the G0 criterion. This is the law
0073   //! defining the greatest distance allowed between the
0074   //! constraint and the target surface for each point of the
0075   //! constraint. If this criterion is not set, TolDist, the
0076   //! distance tolerance from the constructor, is used.
0077   Standard_EXPORT void SetG0Criterion(const occ::handle<Law_Function>& G0Crit);
0078 
0079   //! Allows you to set the G1 criterion. This is the law
0080   //! defining the greatest angle allowed between the
0081   //! constraint and the target surface. If this criterion is not
0082   //! set, TolAng, the angular tolerance from the constructor, is used.
0083   //! Raises ConstructionError if the curve is not on a surface
0084   Standard_EXPORT void SetG1Criterion(const occ::handle<Law_Function>& G1Crit);
0085 
0086   Standard_EXPORT void SetG2Criterion(const occ::handle<Law_Function>& G2Crit);
0087 
0088   //! Returns the G0 criterion at the parametric point U on
0089   //! the curve. This is the greatest distance allowed between
0090   //! the constraint and the target surface at U.
0091   Standard_EXPORT double G0Criterion(const double U) const;
0092 
0093   //! Returns the G1 criterion at the parametric point U on
0094   //! the curve. This is the greatest angle allowed between
0095   //! the constraint and the target surface at U.
0096   //! Raises ConstructionError if the curve is not on a surface
0097   Standard_EXPORT double G1Criterion(const double U) const;
0098 
0099   //! Returns the G2 criterion at the parametric point U on
0100   //! the curve. This is the greatest difference in curvature
0101   //! allowed between the constraint and the target surface at U.
0102   //! Raises ConstructionError if the curve is not on a surface
0103   Standard_EXPORT double G2Criterion(const double U) const;
0104 
0105   Standard_EXPORT double FirstParameter() const;
0106 
0107   Standard_EXPORT double LastParameter() const;
0108 
0109   Standard_EXPORT double Length() const;
0110 
0111   Standard_EXPORT GeomLProp_SLProps& LPropSurf(const double U);
0112 
0113   Standard_EXPORT void D0(const double U, gp_Pnt& P) const;
0114 
0115   Standard_EXPORT void D1(const double U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const;
0116 
0117   Standard_EXPORT void D2(const double U,
0118                           gp_Pnt&      P,
0119                           gp_Vec&      V1,
0120                           gp_Vec&      V2,
0121                           gp_Vec&      V3,
0122                           gp_Vec&      V4,
0123                           gp_Vec&      V5) const;
0124 
0125   Standard_EXPORT occ::handle<Adaptor3d_Curve> Curve3d() const;
0126 
0127   //! loads a 2d curve associated the surface resulting of the constraints
0128   Standard_EXPORT void SetCurve2dOnSurf(const occ::handle<Geom2d_Curve>& Curve2d);
0129 
0130   //! Returns a 2d curve associated the surface resulting of the constraints
0131   Standard_EXPORT occ::handle<Geom2d_Curve> Curve2dOnSurf() const;
0132 
0133   //! loads a 2d curve resulting from the normal projection of
0134   //! the curve on the initial surface
0135   Standard_EXPORT void SetProjectedCurve(const occ::handle<Adaptor2d_Curve2d>& Curve2d,
0136                                          const double                          TolU,
0137                                          const double                          TolV);
0138 
0139   //! Returns the projected curve resulting from the normal projection of the
0140   //! curve on the initial surface
0141   Standard_EXPORT occ::handle<Adaptor2d_Curve2d> ProjectedCurve() const;
0142 
0143   DEFINE_STANDARD_RTTIEXT(GeomPlate_CurveConstraint, Standard_Transient)
0144 
0145 protected:
0146   occ::handle<Adaptor3d_CurveOnSurface> myFrontiere;
0147   int                                   myNbPoints;
0148   int                                   myOrder;
0149   occ::handle<Adaptor3d_Curve>          my3dCurve;
0150   int                                   myTang;
0151   occ::handle<Geom2d_Curve>             my2dCurve;
0152   occ::handle<Adaptor2d_Curve2d>        myHCurve2d;
0153   occ::handle<Law_Function>             myG0Crit;
0154   occ::handle<Law_Function>             myG1Crit;
0155   occ::handle<Law_Function>             myG2Crit;
0156   bool                                  myConstG0;
0157   bool                                  myConstG1;
0158   bool                                  myConstG2;
0159   GeomLProp_SLProps                     myLProp;
0160   double                                myTolDist;
0161   double                                myTolAng;
0162   double                                myTolCurv;
0163   double                                myTolU;
0164   double                                myTolV;
0165 };
0166 
0167 #endif // _GeomPlate_CurveConstraint_HeaderFile