Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-19 08:21:51

0001 // Created on: 1993-04-01
0002 // Created by: Modelistation
0003 // Copyright (c) 1993-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 _HLRBRep_Curve_HeaderFile
0018 #define _HLRBRep_Curve_HeaderFile
0019 
0020 #include <BRepAdaptor_Curve.hxx>
0021 #include <GeomAbs_Shape.hxx>
0022 #include <gp_Pnt.hxx>
0023 #include <gp_Pnt2d.hxx>
0024 #include <Standard.hxx>
0025 #include <Standard_DefineAlloc.hxx>
0026 #include <Standard_Handle.hxx>
0027 #include <Standard_Integer.hxx>
0028 #include <TColgp_Array1OfPnt2d.hxx>
0029 #include <TColStd_Array1OfInteger.hxx>
0030 #include <TColStd_Array1OfReal.hxx>
0031 
0032 class TopoDS_Edge;
0033 class gp_Pnt;
0034 class gp_Vec;
0035 class gp_Pnt2d;
0036 class gp_Dir2d;
0037 class gp_Vec2d;
0038 class gp_Lin2d;
0039 class gp_Circ2d;
0040 class gp_Elips2d;
0041 class gp_Hypr2d;
0042 class gp_Parab2d;
0043 class Geom_BSplineCurve;
0044 class HLRAlgo_Projector;
0045 
0046 //! Defines a 2d curve by projection of  a 3D curve on
0047 //! a    plane     with  an     optional   perspective
0048 //! transformation.
0049 class HLRBRep_Curve
0050 {
0051 public:
0052   DEFINE_STANDARD_ALLOC
0053 
0054   //! Creates an undefined Curve.
0055   Standard_EXPORT HLRBRep_Curve();
0056 
0057   void Projector(const HLRAlgo_Projector* Proj) { myProj = Proj; }
0058 
0059   //! Returns the 3D curve.
0060   BRepAdaptor_Curve& Curve();
0061 
0062   //! Sets the 3D curve to be projected.
0063   Standard_EXPORT void Curve(const TopoDS_Edge& E);
0064 
0065   //! Returns the 3D curve.
0066   const BRepAdaptor_Curve& GetCurve() const;
0067 
0068   //! Returns the parameter   on the 2d  curve  from the
0069   //! parameter on the 3d curve.
0070   Standard_EXPORT Standard_Real Parameter2d(const Standard_Real P3d) const;
0071 
0072   //! Returns the parameter   on the 3d  curve  from the
0073   //! parameter on the 2d curve.
0074   Standard_EXPORT Standard_Real Parameter3d(const Standard_Real P2d) const;
0075 
0076   //! Update the minmax and the internal data
0077   Standard_EXPORT Standard_Real Update(Standard_Real TotMin[16], Standard_Real TotMax[16]);
0078 
0079   //! Update the minmax returns tol for enlarge;
0080   Standard_EXPORT Standard_Real UpdateMinMax(Standard_Real TotMin[16], Standard_Real TotMax[16]);
0081 
0082   //! Computes the Z    coordinate  of the  point  of
0083   //! parameter U on the curve in the viewing coordinate system
0084   Standard_EXPORT Standard_Real Z(const Standard_Real U) const;
0085 
0086   //! Computes the 3D point   of parameter U  on the
0087   //! curve.
0088   gp_Pnt Value3D(const Standard_Real U) const;
0089 
0090   //! Computes the 3D point   of parameter U  on the
0091   //! curve.
0092   void D0(const Standard_Real U, gp_Pnt& P) const;
0093 
0094   //! Computes the point of parameter  U on the curve
0095   //! with its first derivative.
0096   void D1(const Standard_Real U, gp_Pnt& P, gp_Vec& V) const;
0097 
0098   //! Depending on <AtStart> computes the 2D point and
0099   //! tangent on the curve  at sart (or at  end).  If the  first
0100   //! derivative is null look after  at start (or before at end)
0101   //! with the second derivative.
0102   Standard_EXPORT void Tangent(const Standard_Boolean AtStart, gp_Pnt2d& P, gp_Dir2d& D) const;
0103 
0104   Standard_Real FirstParameter() const;
0105 
0106   Standard_Real LastParameter() const;
0107 
0108   GeomAbs_Shape Continuity() const;
0109 
0110   //! If necessary,  breaks the  curve in  intervals  of
0111   //! continuity  <S>.    And  returns   the number   of
0112   //! intervals.
0113   Standard_Integer NbIntervals(const GeomAbs_Shape S) const;
0114 
0115   //! Stores in <T> the  parameters bounding the intervals
0116   //! of continuity <S>.
0117   //!
0118   //! The array must provide  enough room to  accommodate
0119   //! for the parameters. i.e. T.Length() > NbIntervals()
0120   void Intervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const;
0121 
0122   Standard_Boolean IsClosed() const;
0123 
0124   Standard_Boolean IsPeriodic() const;
0125 
0126   Standard_Real Period() const;
0127 
0128   //! Computes the point of parameter U on the curve.
0129   gp_Pnt2d Value(const Standard_Real U) const;
0130 
0131   //! Computes the point of parameter U on the curve.
0132   Standard_EXPORT void D0(const Standard_Real U, gp_Pnt2d& P) const;
0133 
0134   //! Computes the point  of  parameter U on the curve
0135   //! with its first derivative.
0136   //! Raised if the continuity of the current interval
0137   //! is not C1.
0138   Standard_EXPORT void D1(const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V) const;
0139 
0140   //! Raised if the continuity of the current interval
0141   //! is not C2.
0142   Standard_EXPORT void D2(const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const;
0143 
0144   //! Returns the point P of parameter U, the first, the second
0145   //! and the third derivative.
0146   //! Raised if the continuity of the current interval
0147   //! is not C3.
0148   Standard_EXPORT void D3(const Standard_Real U,
0149                           gp_Pnt2d&           P,
0150                           gp_Vec2d&           V1,
0151                           gp_Vec2d&           V2,
0152                           gp_Vec2d&           V3) const;
0153 
0154   //! The returned vector gives the value of the derivative for the
0155   //! order of derivation N.
0156   //! Raised if the continuity of the current interval
0157   //! is not CN.
0158   //! Raised if N < 1.
0159   Standard_EXPORT gp_Vec2d DN(const Standard_Real U, const Standard_Integer N) const;
0160 
0161   //! Returns the parametric  resolution corresponding
0162   //! to the real space resolution <R3d>.
0163   Standard_Real Resolution(const Standard_Real R3d) const;
0164 
0165   //! Returns  the  type of the   curve  in the  current
0166   //! interval :   Line,   Circle,   Ellipse, Hyperbola,
0167   //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
0168   GeomAbs_CurveType GetType() const;
0169 
0170   Standard_EXPORT gp_Lin2d Line() const;
0171 
0172   Standard_EXPORT gp_Circ2d Circle() const;
0173 
0174   Standard_EXPORT gp_Elips2d Ellipse() const;
0175 
0176   Standard_EXPORT gp_Hypr2d Hyperbola() const;
0177 
0178   Standard_EXPORT gp_Parab2d Parabola() const;
0179 
0180   Standard_Boolean IsRational() const;
0181 
0182   Standard_Integer Degree() const;
0183 
0184   Standard_Integer NbPoles() const;
0185 
0186   Standard_EXPORT void Poles(TColgp_Array1OfPnt2d& TP) const;
0187 
0188   Standard_EXPORT void Poles(const Handle(Geom_BSplineCurve)& aCurve,
0189                              TColgp_Array1OfPnt2d&            TP) const;
0190 
0191   Standard_EXPORT void PolesAndWeights(TColgp_Array1OfPnt2d& TP, TColStd_Array1OfReal& TW) const;
0192 
0193   Standard_EXPORT void PolesAndWeights(const Handle(Geom_BSplineCurve)& aCurve,
0194                                        TColgp_Array1OfPnt2d&            TP,
0195                                        TColStd_Array1OfReal&            TW) const;
0196 
0197   Standard_Integer NbKnots() const;
0198 
0199   Standard_EXPORT void Knots(TColStd_Array1OfReal& kn) const;
0200 
0201   Standard_EXPORT void Multiplicities(TColStd_Array1OfInteger& mu) const;
0202 
0203 protected:
0204 private:
0205   BRepAdaptor_Curve        myCurve;
0206   GeomAbs_CurveType        myType;
0207   const HLRAlgo_Projector* myProj;
0208   Standard_Real            myOX;
0209   Standard_Real            myOZ;
0210   Standard_Real            myVX;
0211   Standard_Real            myVZ;
0212   Standard_Real            myOF;
0213 };
0214 
0215 #include <HLRBRep_Curve.lxx>
0216 
0217 #endif // _HLRBRep_Curve_HeaderFile