Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1996-02-26
0002 // Created by: Philippe MANGIN
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 _FairCurve_MinimalVariation_HeaderFile
0018 #define _FairCurve_MinimalVariation_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <FairCurve_Batten.hxx>
0024 #include <FairCurve_AnalysisCode.hxx>
0025 #include <Standard_OStream.hxx>
0026 class gp_Pnt2d;
0027 class gp_Vec2d;
0028 
0029 
0030 //! Computes a 2D curve using an algorithm which
0031 //! minimizes tension, sagging, and jerk energy. As in
0032 //! FairCurve_Batten, two reference points are used.
0033 //! Unlike that class, FairCurve_MinimalVariation
0034 //! requires curvature settings at the first and second
0035 //! reference points. These are defined by the rays of
0036 //! curvature desired at each point.
0037 class FairCurve_MinimalVariation  : public FairCurve_Batten
0038 {
0039 public:
0040 
0041   DEFINE_STANDARD_ALLOC
0042 
0043   
0044   //! Constructs the two contact points P1 and P2  and the geometrical
0045   //! characteristics of the batten (elastic beam)
0046   //! These include the real number values for height of
0047   //! deformation Height, slope value Slope, and kind of
0048   //! energy PhysicalRatio. The kinds of energy include:
0049   //! -   Jerk (0)
0050   //! -   Sagging (1).
0051   //! Note that the default setting for Physical Ration is in FairCurve_Batten
0052   //! Other parameters are initialized as follow :
0053   //! - FreeSliding = False
0054   //! - ConstraintOrder1 = 1
0055   //! - ConstraintOrder2 = 1
0056   //! - Angle1 = 0
0057   //! - Angle2 = 0
0058   //! - Curvature1 = 0
0059   //! - Curvature2 = 0
0060   //! - SlidingFactor = 1
0061   //! Warning
0062   //! If PhysicalRatio equals 1, you cannot impose constraints on curvature.
0063   //! Exceptions
0064   //! NegativeValue if Height is less than or equal to 0.
0065   //! NullValue if the distance between P1 and P2 is less
0066   //! than or equal to the tolerance value for distance in
0067   //! Precision::Confusion: P1.IsEqual(P2,
0068   //! Precision::Confusion()). The function
0069   //! gp_Pnt2d::IsEqual tests to see if this is the case.
0070   //! Definition of the geometricals constraints
0071   Standard_EXPORT FairCurve_MinimalVariation(const gp_Pnt2d& P1, const gp_Pnt2d& P2, const Standard_Real Heigth, const Standard_Real Slope = 0, const Standard_Real PhysicalRatio = 0);
0072   
0073   //! Allows you to set a new constraint on curvature at the first point.
0074     void SetCurvature1 (const Standard_Real Curvature);
0075   
0076   //! Allows you to set a new constraint on curvature at the second point.
0077     void SetCurvature2 (const Standard_Real Curvature);
0078   
0079   //! Allows you to set the physical ratio Ratio.
0080   //! The kinds of energy which you can specify include:
0081   //! 0 is only "Jerk" Energy
0082   //! 1 is only "Sagging" Energy like batten
0083   //! Warning: if Ratio is 1 it is impossible to impose curvature constraints.
0084   //! Raises  DomainError if Ratio < 0 or Ratio > 1
0085     void SetPhysicalRatio (const Standard_Real Ratio);
0086   
0087   //! Computes the curve with respect to the constraints,
0088   //! NbIterations and Tolerance. The tolerance setting
0089   //! allows you to control the precision of computation, and
0090   //! the maximum number of iterations allows you to set a limit on computation time.
0091   Standard_EXPORT virtual Standard_Boolean Compute (FairCurve_AnalysisCode& ACode, const Standard_Integer NbIterations = 50, const Standard_Real Tolerance = 1.0e-3) Standard_OVERRIDE;
0092   
0093   //! Returns the first established curvature.
0094     Standard_Real GetCurvature1() const;
0095   
0096   //! Returns the second established curvature.
0097     Standard_Real GetCurvature2() const;
0098   
0099   //! Returns the physical ratio, or kind of energy.
0100     Standard_Real GetPhysicalRatio() const;
0101   
0102   //! Prints on the stream o information on the current state
0103   //! of the object.
0104   //! Is used to redefine the operator <<.
0105   Standard_EXPORT virtual void Dump (Standard_OStream& o) const Standard_OVERRIDE;
0106 
0107 
0108 
0109 
0110 protected:
0111 
0112 
0113 
0114 
0115 
0116 private:
0117 
0118   
0119   //! compute the curve with respect of the delta-constraints.
0120   Standard_EXPORT Standard_Boolean Compute (const gp_Vec2d& DeltaP1, const gp_Vec2d& DeltaP2, const Standard_Real DeltaAngle1, const Standard_Real DeltaAngle2, const Standard_Real DeltaCurvature1, const Standard_Real DeltaCurvature2, FairCurve_AnalysisCode& ACode, const Standard_Integer NbIterations, const Standard_Real Tolerance);
0121 
0122 
0123   Standard_Real OldCurvature1;
0124   Standard_Real OldCurvature2;
0125   Standard_Real OldPhysicalRatio;
0126   Standard_Real NewCurvature1;
0127   Standard_Real NewCurvature2;
0128   Standard_Real NewPhysicalRatio;
0129 
0130 
0131 };
0132 
0133 
0134 #include <FairCurve_MinimalVariation.lxx>
0135 
0136 
0137 
0138 
0139 
0140 #endif // _FairCurve_MinimalVariation_HeaderFile