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