Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-25 09:19:01

0001 // Created on: 1994-01-10
0002 // Created by: Yves FRICAUD
0003 // Copyright (c) 1994-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 _Bisector_BisecPC_HeaderFile
0018 #define _Bisector_BisecPC_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <gp_Pnt2d.hxx>
0023 #include <NCollection_Sequence.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <Bisector_Curve.hxx>
0026 #include <GeomAbs_Shape.hxx>
0027 class Geom2d_Curve;
0028 class Geom2d_Geometry;
0029 class gp_Trsf2d;
0030 class gp_Vec2d;
0031 
0032 //! Provides the bisector between a point and a curve.
0033 //! the curvature on the curve has to be monoton.
0034 //! the point can't be on the curve except at the extremities.
0035 class Bisector_BisecPC : public Bisector_Curve
0036 {
0037 
0038 public:
0039   Standard_EXPORT Bisector_BisecPC();
0040 
0041   //! Constructs the bisector between the point <P> and
0042   //! the curve <Cu>.
0043   //! <Side> = 1. if the bisector curve is on the Left of <Cu>
0044   //! else <Side> = -1.
0045   //! <DistMax> is used to trim the bisector.The distance
0046   //! between the points of the bisector and <Cu> is smaller
0047   //! than <DistMax>.
0048   Standard_EXPORT Bisector_BisecPC(const occ::handle<Geom2d_Curve>& Cu,
0049                                    const gp_Pnt2d&                  P,
0050                                    const double                     Side,
0051                                    const double                     DistMax = 500);
0052 
0053   //! Constructs the bisector between the point <P> and
0054   //! the curve <Cu> Trimmed by <UMin> and <UMax>
0055   //! <Side> = 1. if the bisector curve is on the Left of <Cu>
0056   //! else <Side> = -1.
0057   //! Warning: the bisector is supposed all over defined between
0058   //! <UMin> and <UMax>.
0059   Standard_EXPORT Bisector_BisecPC(const occ::handle<Geom2d_Curve>& Cu,
0060                                    const gp_Pnt2d&                  P,
0061                                    const double                     Side,
0062                                    const double                     UMin,
0063                                    const double                     UMax);
0064 
0065   //! Construct the bisector between the point <P> and
0066   //! the curve <Cu>.
0067   //! <Side> = 1. if the bisector curve is on the Left of <Cu>
0068   //! else <Side> = -1.
0069   //! <DistMax> is used to trim the bisector.The distance
0070   //! between the points of the bisector and <Cu> is smaller
0071   //! than <DistMax>.
0072   Standard_EXPORT void Perform(const occ::handle<Geom2d_Curve>& Cu,
0073                                const gp_Pnt2d&                  P,
0074                                const double                     Side,
0075                                const double                     DistMax = 500);
0076 
0077   //! Returns True if the bisector is extended at start.
0078   Standard_EXPORT bool IsExtendAtStart() const override;
0079 
0080   //! Returns True if the bisector is extended at end.
0081   Standard_EXPORT bool IsExtendAtEnd() const override;
0082 
0083   //! Changes the direction of parametrization of <me>.
0084   //! The orientation of the curve is modified. If the curve
0085   //! is bounded the StartPoint of the initial curve becomes the
0086   //! EndPoint of the reversed curve and the EndPoint of the initial
0087   //! curve becomes the StartPoint of the reversed curve.
0088   Standard_EXPORT void Reverse() override;
0089 
0090   //! Returns the parameter on the reversed curve for
0091   //! the point of parameter U on <me>.
0092   Standard_EXPORT double ReversedParameter(const double U) const override;
0093 
0094   Standard_EXPORT occ::handle<Geom2d_Geometry> Copy() const override;
0095 
0096   //! Transformation of a geometric object. This transformation
0097   //! can be a translation, a rotation, a symmetry, a scaling
0098   //! or a complex transformation obtained by combination of
0099   //! the previous elementaries transformations.
0100   Standard_EXPORT void Transform(const gp_Trsf2d& T) override;
0101 
0102   //! Returns the order of continuity of the curve.
0103   //! Raised if N < 0.
0104   Standard_EXPORT bool IsCN(const int N) const override;
0105 
0106   //! Value of the first parameter.
0107   Standard_EXPORT double FirstParameter() const override;
0108 
0109   //! Value of the last parameter.
0110   Standard_EXPORT double LastParameter() const override;
0111 
0112   Standard_EXPORT GeomAbs_Shape Continuity() const override;
0113 
0114   //! If necessary, breaks the curve in intervals of
0115   //! continuity <C1>. And returns the number of
0116   //! intervals.
0117   Standard_EXPORT int NbIntervals() const override;
0118 
0119   //! Returns the first parameter of the current
0120   //! interval.
0121   Standard_EXPORT double IntervalFirst(const int Index) const override;
0122 
0123   //! Returns the last parameter of the current
0124   //! interval.
0125   Standard_EXPORT double IntervalLast(const int Index) const override;
0126 
0127   Standard_EXPORT GeomAbs_Shape IntervalContinuity() const;
0128 
0129   Standard_EXPORT bool IsClosed() const override;
0130 
0131   Standard_EXPORT bool IsPeriodic() const override;
0132 
0133   //! Returns the distance between the point of
0134   //! parameter U on <me> and my point or my curve.
0135   Standard_EXPORT double Distance(const double U) const;
0136 
0137   Standard_EXPORT gp_Pnt2d EvalD0(const double U) const override;
0138 
0139   Standard_EXPORT Geom2d_Curve::ResD1 EvalD1(const double U) const override;
0140 
0141   Standard_EXPORT Geom2d_Curve::ResD2 EvalD2(const double U) const override;
0142 
0143   Standard_EXPORT Geom2d_Curve::ResD3 EvalD3(const double U) const override;
0144 
0145   Standard_EXPORT gp_Vec2d EvalDN(const double U, const int N) const override;
0146 
0147   Standard_EXPORT void Dump(const int Deep = 0, const int Offset = 0) const;
0148 
0149   //! Returns the parameter on the curve1 of the projection
0150   //! of the point of parameter U on <me>.
0151   Standard_EXPORT double LinkBisCurve(const double U) const;
0152 
0153   //! Returns the reciproque of LinkBisCurve.
0154   Standard_EXPORT double LinkCurveBis(const double U) const;
0155 
0156   //! Returns the parameter on <me> corresponding to <P>.
0157   Standard_EXPORT double Parameter(const gp_Pnt2d& P) const override;
0158 
0159   //! Returns <True> if the bisector is empty.
0160   Standard_EXPORT bool IsEmpty() const;
0161 
0162   DEFINE_STANDARD_RTTIEXT(Bisector_BisecPC, Bisector_Curve)
0163 
0164 private:
0165   Standard_EXPORT void Values(const double U,
0166                               const int    N,
0167                               gp_Pnt2d&    P,
0168                               gp_Vec2d&    V1,
0169                               gp_Vec2d&    V2,
0170                               gp_Vec2d&    V3) const;
0171 
0172   Standard_EXPORT void Extension(const double U,
0173                                  gp_Pnt2d&    P,
0174                                  gp_Vec2d&    V1,
0175                                  gp_Vec2d&    V2,
0176                                  gp_Vec2d&    V3) const;
0177 
0178   //! Computes the interval where the bisector is defined.
0179   Standard_EXPORT void ComputeIntervals();
0180 
0181   Standard_EXPORT void CuspFilter();
0182 
0183   Standard_EXPORT double SearchBound(const double U1, const double U2) const;
0184 
0185   Standard_EXPORT void Init(const occ::handle<Geom2d_Curve>&    Curve,
0186                             const gp_Pnt2d&                     Point,
0187                             const double                        Sign,
0188                             const NCollection_Sequence<double>& StartIntervals,
0189                             const NCollection_Sequence<double>& EndIntervals,
0190                             const int                           BisInterval,
0191                             const int                           CurrentInterval,
0192                             const double                        ShiftParameter,
0193                             const double                        DistMax,
0194                             const bool                          IsEmpty,
0195                             const bool                          IsConvex,
0196                             const bool                          ExtensionStart,
0197                             const bool                          ExtensionEnd,
0198                             const gp_Pnt2d&                     PointStartBis,
0199                             const gp_Pnt2d&                     PointEndBis);
0200 
0201   occ::handle<Geom2d_Curve>    curve;
0202   gp_Pnt2d                     point;
0203   double                       sign;
0204   NCollection_Sequence<double> startIntervals;
0205   NCollection_Sequence<double> endIntervals;
0206   int                          bisInterval;
0207   int                          currentInterval;
0208   double                       shiftParameter;
0209   double                       distMax;
0210   bool                         isEmpty;
0211   bool                         isConvex;
0212   bool                         extensionStart;
0213   bool                         extensionEnd;
0214   gp_Pnt2d                     pointStartBis;
0215   gp_Pnt2d                     pointEndBis;
0216 };
0217 
0218 #endif // _Bisector_BisecPC_HeaderFile