Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:17:42

0001 // Created on: 1996-08-09
0002 // Created by: Herve LOUESSARD
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 _LocalAnalysis_CurveContinuity_HeaderFile
0018 #define _LocalAnalysis_CurveContinuity_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <GeomAbs_Shape.hxx>
0025 #include <LocalAnalysis_StatusErrorType.hxx>
0026 class Geom_Curve;
0027 #include <GeomLProp_CLProps.hxx>
0028 
0029 //! This class gives tools to check local continuity C0
0030 //! C1 C2 G1 G2 between two points situated on two curves
0031 class LocalAnalysis_CurveContinuity
0032 {
0033 public:
0034   DEFINE_STANDARD_ALLOC
0035 
0036   //! -u1 is the parameter of the point on Curv1
0037   //! -u2 is the parameter of the point on Curv2
0038   //! -Order is the required continuity:
0039   //! GeomAbs_C0 GeomAbs_C1 GeomAbs_C2
0040   //! GeomAbs_G1 GeomAbs_G2
0041   //!
0042   //! -EpsNul is used to detect a vector with null
0043   //! magnitude (in mm)
0044   //!
0045   //! -EpsC0 is used for C0 continuity to confuse two
0046   //! points (in mm)
0047   //!
0048   //! -EpsC1 is an angular tolerance in radians used
0049   //! for C1 continuity to compare the angle between
0050   //! the first derivatives
0051   //!
0052   //! -EpsC2 is an angular tolerance in radians used
0053   //! for C2 continuity to compare the angle between
0054   //! the second derivatives
0055   //!
0056   //! -EpsG1 is an angular tolerance in radians used
0057   //! for G1 continuity to compare the angle between
0058   //! the tangents
0059   //!
0060   //! -EpsG2 is an angular tolerance in radians used
0061   //! for G2 continuity to compare the angle between
0062   //! the normals
0063   //!
0064   //! - percent: percentage of curvature variation (unitless)
0065   //! used for G2 continuity
0066   //!
0067   //! - Maxlen is the maximum length of Curv1 or Curv2 in
0068   //! meters used to detect nul curvature (in mm)
0069   //!
0070   //! the constructor computes the quantities which are
0071   //! necessary to check the continuity in the following cases:
0072   //!
0073   //! case C0
0074   //! -------
0075   //! - the distance between P1 and P2 with P1=Curv1 (u1) and
0076   //! P2=Curv2(u2)
0077   //!
0078   //! case C1
0079   //! -------
0080   //!
0081   //! - the angle between the first derivatives
0082   //! dCurv1(u1)           dCurv2(u2)
0083   //! --------     and     ---------
0084   //! du                   du
0085   //!
0086   //! - the ratio between the magnitudes of the first
0087   //! derivatives
0088   //!
0089   //! the angle value is between 0 and PI/2
0090   //!
0091   //! case C2
0092   //! -------
0093   //! - the angle between the second derivatives
0094   //! 2                   2
0095   //! d  Curv1(u1)       d Curv2(u2)
0096   //! ----------        ----------
0097   //! 2                   2
0098   //! du                  du
0099   //!
0100   //! the angle value is between 0 and PI/2
0101   //!
0102   //! - the ratio between the magnitudes of the second
0103   //! derivatives
0104   //!
0105   //! case G1
0106   //! -------
0107   //! the angle between the tangents at each point
0108   //!
0109   //! the angle value is between 0 and PI/2
0110   //!
0111   //! case G2
0112   //! -------
0113   //! -the angle between the normals at each point
0114   //!
0115   //! the angle value is between 0 and PI/2
0116   //!
0117   //! - the relative variation of curvature:
0118   //! |curvat1-curvat2|
0119   //! ------------------
0120   //! 1/2
0121   //! (curvat1*curvat2)
0122   //!
0123   //! where curvat1 is the curvature at the first point
0124   //! and curvat2 the curvature at the second point
0125   Standard_EXPORT LocalAnalysis_CurveContinuity(const occ::handle<Geom_Curve>& Curv1,
0126                                                 const double                   u1,
0127                                                 const occ::handle<Geom_Curve>& Curv2,
0128                                                 const double                   u2,
0129                                                 const GeomAbs_Shape            Order,
0130                                                 const double                   EpsNul  = 0.001,
0131                                                 const double                   EpsC0   = 0.001,
0132                                                 const double                   EpsC1   = 0.001,
0133                                                 const double                   EpsC2   = 0.001,
0134                                                 const double                   EpsG1   = 0.001,
0135                                                 const double                   EpsG2   = 0.001,
0136                                                 const double                   Percent = 0.01,
0137                                                 const double                   Maxlen  = 10000);
0138 
0139   Standard_EXPORT bool IsDone() const;
0140 
0141   Standard_EXPORT LocalAnalysis_StatusErrorType StatusError() const;
0142 
0143   Standard_EXPORT GeomAbs_Shape ContinuityStatus() const;
0144 
0145   Standard_EXPORT double C0Value() const;
0146 
0147   Standard_EXPORT double C1Angle() const;
0148 
0149   Standard_EXPORT double C1Ratio() const;
0150 
0151   Standard_EXPORT double C2Angle() const;
0152 
0153   Standard_EXPORT double C2Ratio() const;
0154 
0155   Standard_EXPORT double G1Angle() const;
0156 
0157   Standard_EXPORT double G2Angle() const;
0158 
0159   Standard_EXPORT double G2CurvatureVariation() const;
0160 
0161   Standard_EXPORT bool IsC0() const;
0162 
0163   Standard_EXPORT bool IsC1() const;
0164 
0165   Standard_EXPORT bool IsC2() const;
0166 
0167   Standard_EXPORT bool IsG1() const;
0168 
0169   Standard_EXPORT bool IsG2() const;
0170 
0171 private:
0172   Standard_EXPORT void CurvC0(GeomLProp_CLProps& Curv1, GeomLProp_CLProps& Curv2);
0173 
0174   Standard_EXPORT void CurvC1(GeomLProp_CLProps& Curv1, GeomLProp_CLProps& Curv2);
0175 
0176   Standard_EXPORT void CurvC2(GeomLProp_CLProps& Curv1, GeomLProp_CLProps& Curv2);
0177 
0178   Standard_EXPORT void CurvG1(GeomLProp_CLProps& Curv1, GeomLProp_CLProps& Curv2);
0179 
0180   Standard_EXPORT void CurvG2(GeomLProp_CLProps& Curv1, GeomLProp_CLProps& Curv2);
0181 
0182   double                        myContC0;
0183   double                        myContC1;
0184   double                        myContC2;
0185   double                        myContG1;
0186   double                        myContG2;
0187   double                        myCourbC1;
0188   double                        myCourbC2;
0189   double                        myG2Variation;
0190   double                        myLambda1;
0191   double                        myLambda2;
0192   GeomAbs_Shape                 myTypeCont;
0193   double                        myepsnul;
0194   double                        myepsC0;
0195   double                        myepsC1;
0196   double                        myepsC2;
0197   double                        myepsG1;
0198   double                        myepsG2;
0199   double                        myMaxLon;
0200   double                        myperce;
0201   bool                          myIsDone;
0202   LocalAnalysis_StatusErrorType myErrorStatus;
0203 };
0204 
0205 #endif // _LocalAnalysis_CurveContinuity_HeaderFile