Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:42

0001 // Created on: 1996-04-03
0002 // Created by: Stagiaire Frederic CALOONE
0003 // Copyright (c) 1996-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_BuildPlateSurface_HeaderFile
0018 #define _GeomPlate_BuildPlateSurface_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <GeomPlate_HSequenceOfCurveConstraint.hxx>
0024 #include <GeomPlate_HArray1OfSequenceOfReal.hxx>
0025 #include <GeomPlate_HSequenceOfPointConstraint.hxx>
0026 #include <Plate_Plate.hxx>
0027 #include <TColStd_HArray1OfInteger.hxx>
0028 #include <Standard_Integer.hxx>
0029 #include <Standard_Real.hxx>
0030 #include <Extrema_ExtPS.hxx>
0031 #include <GeomPlate_HArray1OfHCurve.hxx>
0032 #include <TColgp_SequenceOfXY.hxx>
0033 #include <TColgp_SequenceOfXYZ.hxx>
0034 #include <TColGeom2d_HArray1OfCurve.hxx>
0035 #include <TColStd_HArray1OfReal.hxx>
0036 class Geom_Surface;
0037 class GeomPlate_Surface;
0038 class GeomPlate_CurveConstraint;
0039 class GeomPlate_PointConstraint;
0040 class gp_Pnt2d;
0041 class gp_Pnt;
0042 class Geom2d_Curve;
0043 
0044 
0045 //! This class provides an algorithm for constructing such a plate surface that
0046 //! it conforms to given curve and/or point constraints.
0047 //! The algorithm accepts or constructs an initial surface
0048 //! and looks for a deformation of it satisfying the
0049 //! constraints and minimizing energy input.
0050 //! A BuildPlateSurface object provides a framework for:
0051 //! -   defining or setting constraints
0052 //! -   implementing the construction algorithm
0053 //! -   consulting the result.
0054 class GeomPlate_BuildPlateSurface 
0055 {
0056 public:
0057 
0058   DEFINE_STANDARD_ALLOC
0059 
0060   
0061   //! Constructor  compatible  with  the  old  version
0062   //! with this constructor the constraint are given in a Array of Curve on Surface
0063   //! The array NbPoints  contains the number of points for each constraint.
0064   //! The Array Tang contains the order of constraint for each Constraint: The possible values for this
0065   //! order has to be -1 , 0 , 1 , 2 . Order i means constraint Gi.
0066   //! NbIter is the maximum number of iteration to optimise the number of points for resolution
0067   //! Degree is the degree of resolution for Plate
0068   //! Tol2d is the tolerance used to test if two points of different constraint are identical in the
0069   //! parametric space of the initial surface
0070   //! Tol3d is used to test if two identical points in the 2d space are identical in 3d space
0071   //! TolAng is used to compare the angle between normal of two identical points in the 2d space
0072   //! Raises  ConstructionError;
0073   Standard_EXPORT GeomPlate_BuildPlateSurface(const Handle(TColStd_HArray1OfInteger)& NPoints, const Handle(GeomPlate_HArray1OfHCurve)& TabCurve, const Handle(TColStd_HArray1OfInteger)& Tang, const Standard_Integer Degree, const Standard_Integer NbIter = 3, const Standard_Real Tol2d = 0.00001, const Standard_Real Tol3d = 0.0001, const Standard_Real TolAng = 0.01, const Standard_Real TolCurv = 0.1, const Standard_Boolean Anisotropie = Standard_False);
0074   
0075   Standard_EXPORT GeomPlate_BuildPlateSurface(const Handle(Geom_Surface)& Surf, const Standard_Integer Degree = 3, const Standard_Integer NbPtsOnCur = 10, const Standard_Integer NbIter = 3, const Standard_Real Tol2d = 0.00001, const Standard_Real Tol3d = 0.0001, const Standard_Real TolAng = 0.01, const Standard_Real TolCurv = 0.1, const Standard_Boolean Anisotropie = Standard_False);
0076   
0077   //! Initializes the BuildPlateSurface framework for
0078   //! deforming plate surfaces using curve and point
0079   //! constraints. You use the first constructor if you have
0080   //! an initial surface to work with at construction time. If
0081   //! not, you use the second. You can add one later by
0082   //! using the method LoadInitSurface. If no initial
0083   //! surface is loaded, one will automatically be computed.
0084   //! The curve and point constraints will be defined by
0085   //! using the method Add.
0086   //! Before the call to the algorithm, the curve constraints
0087   //! will be transformed into sequences of discrete points.
0088   //! Each curve defined as a constraint will be given the
0089   //! value of NbPtsOnCur as the average number of points on it.
0090   //! Several arguments serve to improve performance of
0091   //! the algorithm. NbIter, for example, expresses the
0092   //! number of iterations allowed and is used to control the
0093   //! duration of computation. To optimize resolution,
0094   //! Degree will have the default value of 3.
0095   //! The surface generated must respect several tolerance values:
0096   //! -   2d tolerance given by Tol2d, with a default value of 0.00001
0097   //! -   3d tolerance expressed by Tol3d, with a default value of 0.0001
0098   //! -   angular tolerance given by TolAng, with a default
0099   //! value of 0.01, defining the greatest angle allowed
0100   //! between the constraint and the target surface.
0101   //! Exceptions
0102   //! Standard_ConstructionError if NbIter is less than 1 or Degree is less than 3.
0103   Standard_EXPORT GeomPlate_BuildPlateSurface(const Standard_Integer Degree = 3, const Standard_Integer NbPtsOnCur = 10, const Standard_Integer NbIter = 3, const Standard_Real Tol2d = 0.00001, const Standard_Real Tol3d = 0.0001, const Standard_Real TolAng = 0.01, const Standard_Real TolCurv = 0.1, const Standard_Boolean Anisotropie = Standard_False);
0104   
0105   //! Resets all constraints
0106   Standard_EXPORT void Init();
0107   
0108   //! Loads the initial Surface
0109   Standard_EXPORT void LoadInitSurface (const Handle(Geom_Surface)& Surf);
0110   
0111   //! Adds the linear constraint cont.
0112   Standard_EXPORT void Add (const Handle(GeomPlate_CurveConstraint)& Cont);
0113   
0114   Standard_EXPORT void SetNbBounds (const Standard_Integer NbBounds);
0115   
0116   //! Adds the point constraint cont.
0117   Standard_EXPORT void Add (const Handle(GeomPlate_PointConstraint)& Cont);
0118   
0119 
0120   //! Calls the algorithm and computes the plate surface using
0121   //! the loaded constraints. If no initial surface is given, the
0122   //! algorithm automatically computes one.
0123   //! Exceptions
0124   //! Standard_RangeError if the value of the constraint is
0125   //! null or if plate is not done.
0126   Standard_EXPORT void Perform(const Message_ProgressRange& theProgress = Message_ProgressRange());
0127   
0128   //! returns the CurveConstraints of order order
0129   Standard_EXPORT Handle(GeomPlate_CurveConstraint) CurveConstraint (const Standard_Integer order) const;
0130   
0131   //! returns the PointConstraint of order order
0132   Standard_EXPORT Handle(GeomPlate_PointConstraint) PointConstraint (const Standard_Integer order) const;
0133   
0134   Standard_EXPORT void Disc2dContour (const Standard_Integer nbp, TColgp_SequenceOfXY& Seq2d);
0135   
0136   Standard_EXPORT void Disc3dContour (const Standard_Integer nbp, const Standard_Integer iordre, TColgp_SequenceOfXYZ& Seq3d);
0137   
0138 
0139   //! Tests whether computation of the plate has been completed.
0140   Standard_EXPORT Standard_Boolean IsDone() const;
0141   
0142 
0143   //! Returns the result of the computation. This surface can
0144   //! then be used by GeomPlate_MakeApprox for
0145   //! converting the resulting surface into a BSpline.
0146   Standard_EXPORT Handle(GeomPlate_Surface) Surface() const;
0147   
0148   //! Returns the initial surface
0149   Standard_EXPORT Handle(Geom_Surface) SurfInit() const;
0150   
0151 
0152   //! Allows you to ensure that the array of curves returned by
0153   //! Curves2d has the correct orientation. Returns the
0154   //! orientation of the curves in the array returned by
0155   //! Curves2d. Computation changes the orientation of
0156   //! these curves. Consequently, this method returns the
0157   //! orientation prior to computation.
0158   Standard_EXPORT Handle(TColStd_HArray1OfInteger) Sense() const;
0159   
0160 
0161   //! Extracts the array of curves on the plate surface which
0162   //! correspond to the curve constraints set in Add.
0163   Standard_EXPORT Handle(TColGeom2d_HArray1OfCurve) Curves2d() const;
0164   
0165 
0166   //! Returns the order of the curves in the array returned by
0167   //! Curves2d. Computation changes this order.
0168   //! Consequently, this method returns the order of the
0169   //! curves prior to computation.
0170   Standard_EXPORT Handle(TColStd_HArray1OfInteger) Order() const;
0171   
0172   //! Returns the max distance between the result and the constraints
0173   Standard_EXPORT Standard_Real G0Error() const;
0174   
0175   //! Returns  the max angle between the result and the constraints
0176   Standard_EXPORT Standard_Real G1Error() const;
0177   
0178   //! Returns  the max difference of curvature between the result and the constraints
0179   Standard_EXPORT Standard_Real G2Error() const;
0180   
0181   //! Returns   the max distance between the result and the constraint Index
0182   Standard_EXPORT Standard_Real G0Error (const Standard_Integer Index);
0183   
0184   //! Returns the max angle between the result and the constraint Index
0185   Standard_EXPORT Standard_Real G1Error (const Standard_Integer Index);
0186   
0187   //! Returns the max difference of curvature between the result and the constraint Index
0188   Standard_EXPORT Standard_Real G2Error (const Standard_Integer Index);
0189 
0190 
0191 
0192 
0193 protected:
0194 
0195 
0196 
0197 
0198 
0199 private:
0200 
0201   
0202   //! Evaluates the distance, the angle between normals, and the "courbure"
0203   //! on middle points of constraints and corresponding points on the GeomPlate_Surface
0204   //! the results are given for a curve c
0205   Standard_EXPORT void EcartContraintesMil (const Standard_Integer c, Handle(TColStd_HArray1OfReal)& d, Handle(TColStd_HArray1OfReal)& an, Handle(TColStd_HArray1OfReal)& courb);
0206   
0207   Standard_EXPORT gp_Pnt2d ProjectPoint (const gp_Pnt& P);
0208   
0209   Standard_EXPORT Handle(Geom2d_Curve) ProjectCurve (const Handle(Adaptor3d_Curve)& Curv);
0210   
0211   Standard_EXPORT Handle(Adaptor2d_Curve2d) ProjectedCurve (Handle(Adaptor3d_Curve)& Curv);
0212   
0213   Standard_EXPORT void ComputeSurfInit(const Message_ProgressRange& theProgress);
0214   
0215   Standard_EXPORT void Intersect (Handle(GeomPlate_HArray1OfSequenceOfReal)& PntInter, Handle(GeomPlate_HArray1OfSequenceOfReal)& PntG1G1);
0216   
0217   Standard_EXPORT void Discretise (const Handle(GeomPlate_HArray1OfSequenceOfReal)& PntInter, const Handle(GeomPlate_HArray1OfSequenceOfReal)& PntG1G1);
0218   
0219   Standard_EXPORT void LoadCurve (const Standard_Integer NbBoucle, const Standard_Integer OrderMax = 2);
0220   
0221   Standard_EXPORT void LoadPoint (const Standard_Integer NbBoucle, const Standard_Integer OrderMax = 2);
0222   
0223   Standard_EXPORT void CalculNbPtsInit();
0224   
0225   Standard_EXPORT Standard_Boolean VerifSurface (const Standard_Integer NbLoop);
0226   
0227   Standard_EXPORT void VerifPoints (Standard_Real& dist, Standard_Real& ang, Standard_Real& curv) const;
0228   
0229   Standard_EXPORT Standard_Boolean CourbeJointive (const Standard_Real tolerance);
0230   
0231   Standard_EXPORT Standard_Real ComputeAnisotropie() const;
0232   
0233   Standard_EXPORT Standard_Boolean IsOrderG1() const;
0234 
0235 
0236   Handle(GeomPlate_HSequenceOfCurveConstraint) myLinCont;
0237   Handle(GeomPlate_HArray1OfSequenceOfReal) myParCont;
0238   Handle(GeomPlate_HArray1OfSequenceOfReal) myPlateCont;
0239   Handle(GeomPlate_HSequenceOfPointConstraint) myPntCont;
0240   Handle(Geom_Surface) mySurfInit;
0241   Handle(Geom_Surface) myPlanarSurfInit;
0242   Handle(GeomPlate_Surface) myGeomPlateSurface;
0243   Plate_Plate myPlate;
0244   Plate_Plate myPrevPlate;
0245   Standard_Boolean myAnisotropie;
0246   Handle(TColStd_HArray1OfInteger) mySense;
0247   Standard_Integer myDegree;
0248   Handle(TColStd_HArray1OfInteger) myInitOrder;
0249   Standard_Real myG0Error;
0250   Standard_Real myG1Error;
0251   Standard_Real myG2Error;
0252   Standard_Integer myNbPtsOnCur;
0253   Standard_Boolean mySurfInitIsGive;
0254   Standard_Integer myNbIter;
0255   Extrema_ExtPS myProj;
0256   Standard_Real myTol2d;
0257   Standard_Real myTol3d;
0258   Standard_Real myTolAng;
0259   Standard_Real myTolU;
0260   Standard_Real myTolV;
0261   Standard_Integer myNbBounds;
0262   Standard_Boolean myIsLinear;
0263   Standard_Boolean myFree;
0264 
0265 
0266 };
0267 
0268 
0269 
0270 
0271 
0272 
0273 
0274 #endif // _GeomPlate_BuildPlateSurface_HeaderFile