Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-16 09:47:17

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