Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-23 08:17:02

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