Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/ProjLib_ProjectOnPlane.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Created on: 1994-09-02
0002 // Created by: Bruno DUMORTIER
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 _ProjLib_ProjectOnPlane_HeaderFile
0018 #define _ProjLib_ProjectOnPlane_HeaderFile
0019 
0020 #include <Adaptor3d_Curve.hxx>
0021 #include <gp_Ax3.hxx>
0022 #include <gp_Dir.hxx>
0023 #include <GeomAbs_CurveType.hxx>
0024 #include <GeomAdaptor_Curve.hxx>
0025 #include <GeomAbs_Shape.hxx>
0026 #include <NCollection_Array1.hxx>
0027 
0028 class gp_Pnt;
0029 class gp_Vec;
0030 class gp_Lin;
0031 class gp_Circ;
0032 class gp_Elips;
0033 class gp_Hypr;
0034 class gp_Parab;
0035 class Geom_BezierCurve;
0036 class Geom_BSplineCurve;
0037 
0038 //! Class used to project a 3d curve on a plane. The
0039 //! result will be a 3d curve.
0040 //!
0041 //! You can ask the projected curve to have the same
0042 //! parametrization as the original curve.
0043 //!
0044 //! The projection can be done along every direction not
0045 //! parallel to the plane.
0046 class ProjLib_ProjectOnPlane : public Adaptor3d_Curve
0047 {
0048 public:
0049   DEFINE_STANDARD_ALLOC
0050 
0051   //! Empty constructor.
0052   Standard_EXPORT ProjLib_ProjectOnPlane();
0053 
0054   //! The projection will be normal to the Plane defined
0055   //! by the Ax3 <Pl>.
0056   Standard_EXPORT ProjLib_ProjectOnPlane(const gp_Ax3& Pl);
0057 
0058   //! The projection will be along the direction <D> on
0059   //! the plane defined by the Ax3 <Pl>.
0060   //! raises if the direction <D> is parallel to the
0061   //! plane <Pl>.
0062   Standard_EXPORT ProjLib_ProjectOnPlane(const gp_Ax3& Pl, const gp_Dir& D);
0063 
0064   //! Shallow copy of adaptor
0065   Standard_EXPORT occ::handle<Adaptor3d_Curve> ShallowCopy() const override;
0066 
0067   //! Sets the Curve and perform the projection.
0068   //! if <KeepParametrization> is true, the parametrization
0069   //! of the Projected Curve <PC> will be the same as
0070   //! the parametrization of the initial curve <C>.
0071   //! It means: proj(C(u)) = PC(u) for each u.
0072   //! Otherwise, the parametrization may change.
0073   Standard_EXPORT void Load(const occ::handle<Adaptor3d_Curve>& C,
0074                             const double                        Tolerance,
0075                             const bool                          KeepParametrization = true);
0076 
0077   Standard_EXPORT const gp_Ax3& GetPlane() const;
0078 
0079   Standard_EXPORT const gp_Dir& GetDirection() const;
0080 
0081   Standard_EXPORT const occ::handle<Adaptor3d_Curve>& GetCurve() const;
0082 
0083   Standard_EXPORT const occ::handle<GeomAdaptor_Curve>& GetResult() const;
0084 
0085   Standard_EXPORT double FirstParameter() const override;
0086 
0087   Standard_EXPORT double LastParameter() const override;
0088 
0089   Standard_EXPORT GeomAbs_Shape Continuity() const override;
0090 
0091   //! If necessary, breaks the curve in intervals of
0092   //! continuity <S>. And returns the number of
0093   //! intervals.
0094   Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override;
0095 
0096   //! Stores in <T> the parameters bounding the intervals of continuity <S>.
0097   //!
0098   //! The array must provide enough room to accommodate
0099   //! for the parameters. i.e. T.Length() > NbIntervals()
0100   Standard_EXPORT void Intervals(NCollection_Array1<double>& T,
0101                                  const GeomAbs_Shape         S) const override;
0102 
0103   //! Returns a curve equivalent of <me> between
0104   //! parameters <First> and <Last>. <Tol> is used to
0105   //! test for 3d points confusion.
0106   //! If <First> >= <Last>
0107   Standard_EXPORT occ::handle<Adaptor3d_Curve> Trim(const double First,
0108                                                     const double Last,
0109                                                     const double Tol) const override;
0110 
0111   Standard_EXPORT bool IsClosed() const override;
0112 
0113   Standard_EXPORT bool IsPeriodic() const override;
0114 
0115   Standard_EXPORT double Period() const override;
0116 
0117   //! Computes the point of parameter theU on the curve.
0118   [[nodiscard]] Standard_EXPORT gp_Pnt EvalD0(const double theU) const final;
0119 
0120   //! Computes the point of parameter theU on the curve with its first derivative.
0121   //! Raised if the continuity of the current interval is not C1.
0122   [[nodiscard]] Standard_EXPORT Geom_Curve::ResD1 EvalD1(const double theU) const final;
0123 
0124   //! Returns the point and the first and second derivatives at parameter theU.
0125   //! Raised if the continuity of the current interval is not C2.
0126   [[nodiscard]] Standard_EXPORT Geom_Curve::ResD2 EvalD2(const double theU) const final;
0127 
0128   //! Returns the point and the first, second and third derivatives at parameter theU.
0129   //! Raised if the continuity of the current interval is not C3.
0130   [[nodiscard]] Standard_EXPORT Geom_Curve::ResD3 EvalD3(const double theU) const final;
0131 
0132   //! Returns the derivative of order theN at parameter theU.
0133   //! Raised if the continuity of the current interval is not CN.
0134   //! Raised if theN < 1.
0135   [[nodiscard]] Standard_EXPORT gp_Vec EvalDN(const double theU, const int theN) const final;
0136 
0137   //! Returns the parametric resolution corresponding
0138   //! to the real space resolution <R3d>.
0139   Standard_EXPORT double Resolution(const double R3d) const override;
0140 
0141   //! Returns the type of the curve in the current
0142   //! interval: Line, Circle, Ellipse, Hyperbola,
0143   //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
0144   Standard_EXPORT GeomAbs_CurveType GetType() const override;
0145 
0146   Standard_EXPORT gp_Lin Line() const override;
0147 
0148   Standard_EXPORT gp_Circ Circle() const override;
0149 
0150   Standard_EXPORT gp_Elips Ellipse() const override;
0151 
0152   Standard_EXPORT gp_Hypr Hyperbola() const override;
0153 
0154   Standard_EXPORT gp_Parab Parabola() const override;
0155 
0156   Standard_EXPORT int Degree() const override;
0157 
0158   Standard_EXPORT bool IsRational() const override;
0159 
0160   Standard_EXPORT int NbPoles() const override;
0161 
0162   Standard_EXPORT int NbKnots() const override;
0163 
0164   //! Warning ! this will NOT make a copy of the
0165   //! Bezier Curve : If you want to modify
0166   //! the Curve please make a copy yourself
0167   //! Also it will NOT trim the surface to
0168   //! myFirst/Last.
0169   Standard_EXPORT occ::handle<Geom_BezierCurve> Bezier() const override;
0170 
0171   //! Warning ! this will NOT make a copy of the
0172   //! BSpline Curve : If you want to modify
0173   //! the Curve please make a copy yourself
0174   //! Also it will NOT trim the surface to
0175   //! myFirst/Last.
0176   Standard_EXPORT occ::handle<Geom_BSplineCurve> BSpline() const override;
0177 
0178 protected:
0179   void GetTrimmedResult(const occ::handle<Geom_Curve>& theProjCurve);
0180 
0181   bool BuildParabolaByApex(occ::handle<Geom_Curve>& theGeomParabolaPtr);
0182   bool BuildHyperbolaByApex(occ::handle<Geom_Curve>& theGeomParabolaPtr);
0183 
0184   void BuildByApprox(const double theLimitParameter);
0185 
0186 private:
0187   occ::handle<Adaptor3d_Curve>   myCurve;
0188   gp_Ax3                         myPlane;
0189   gp_Dir                         myDirection;
0190   bool                           myKeepParam;
0191   double                         myFirstPar;
0192   double                         myLastPar;
0193   double                         myTolerance;
0194   GeomAbs_CurveType              myType;
0195   occ::handle<GeomAdaptor_Curve> myResult;
0196   bool                           myIsApprox;
0197 };
0198 
0199 #endif // _ProjLib_ProjectOnPlane_HeaderFile