Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:29:12

0001 // Created on: 1998-07-14
0002 // Created by: data exchange team
0003 // Copyright (c) 1998-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 _ShapeConstruct_Curve_HeaderFile
0018 #define _ShapeConstruct_Curve_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <NCollection_Array1.hxx>
0025 #include <NCollection_HArray1.hxx>
0026 class Geom_Curve;
0027 class gp_Pnt;
0028 class Geom2d_Curve;
0029 class gp_Pnt2d;
0030 class Geom_BSplineCurve;
0031 class Geom2d_BSplineCurve;
0032 
0033 //! Adjusts curve to have start and end points at the given
0034 //! points (currently works on lines and B-Splines only)
0035 class ShapeConstruct_Curve
0036 {
0037 public:
0038   DEFINE_STANDARD_ALLOC
0039 
0040   //! Modifies a curve in order to make its bounds confused with
0041   //! given points.
0042   //! Works only on lines and B-Splines, returns True in this case,
0043   //! else returns False.
0044   //! For line considers both bounding points, for B-Splines only
0045   //! specified.
0046   //!
0047   //! Warning : Does not check if curve should be reversed
0048   Standard_EXPORT bool AdjustCurve(const occ::handle<Geom_Curve>& C3D,
0049                                    const gp_Pnt&                  P1,
0050                                    const gp_Pnt&                  P2,
0051                                    const bool                     take1 = true,
0052                                    const bool                     take2 = true) const;
0053 
0054   //! Modifies a curve in order to make its bounds confused with
0055   //! given points.
0056   //! Works only on lines and B-Splines.
0057   //!
0058   //! For lines works as previous method, B-Splines are segmented
0059   //! at the given values and then are adjusted to the points.
0060   Standard_EXPORT bool AdjustCurveSegment(const occ::handle<Geom_Curve>& C3D,
0061                                           const gp_Pnt&                  P1,
0062                                           const gp_Pnt&                  P2,
0063                                           const double                   U1,
0064                                           const double                   U2) const;
0065 
0066   //! Modifies a curve in order to make its bounds confused with
0067   //! given points.
0068   //! Works only on lines and B-Splines, returns True in this case,
0069   //! else returns False.
0070   //!
0071   //! For line considers both bounding points, for B-Splines only
0072   //! specified.
0073   //!
0074   //! Warning : Does not check if curve should be reversed
0075   Standard_EXPORT bool AdjustCurve2d(const occ::handle<Geom2d_Curve>& C2D,
0076                                      const gp_Pnt2d&                  P1,
0077                                      const gp_Pnt2d&                  P2,
0078                                      const bool                       take1 = true,
0079                                      const bool                       take2 = true) const;
0080 
0081   //! Converts a curve of any type (only part from first to last)
0082   //! to bspline. The method of conversion depends on the type
0083   //! of original curve:
0084   //! BSpline -> C.Segment(first,last)
0085   //! Bezier and Line -> GeomConvert::CurveToBSplineCurve(C).Segment(first,last)
0086   //! Conic and Other -> Approx_Curve3d(C[first,last],prec,C1,9,1000)
0087   Standard_EXPORT occ::handle<Geom_BSplineCurve> ConvertToBSpline(const occ::handle<Geom_Curve>& C,
0088                                                                   const double first,
0089                                                                   const double last,
0090                                                                   const double prec) const;
0091 
0092   //! Converts a curve of any type (only part from first to last)
0093   //! to bspline. The method of conversion depends on the type
0094   //! of original curve:
0095   //! BSpline -> C.Segment(first,last)
0096   //! Bezier and Line -> GeomConvert::CurveToBSplineCurve(C).Segment(first,last)
0097   //! Conic and Other -> Approx_Curve2d(C[first,last],prec,C1,9,1000)
0098   Standard_EXPORT occ::handle<Geom2d_BSplineCurve> ConvertToBSpline(
0099     const occ::handle<Geom2d_Curve>& C,
0100     const double                     first,
0101     const double                     last,
0102     const double                     prec) const;
0103 
0104   Standard_EXPORT static bool FixKnots(occ::handle<NCollection_HArray1<double>>& knots);
0105 
0106   //! Fix bspline knots to ensure that there is enough
0107   //! gap between neighbouring values
0108   //! Returns True if something fixed (by shifting knot)
0109   Standard_EXPORT static bool FixKnots(NCollection_Array1<double>& knots);
0110 };
0111 
0112 #endif // _ShapeConstruct_Curve_HeaderFile