Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:06

0001 // Created on: 1998-08-20
0002 // Created by: Philippe MANGIN
0003 // Copyright (c) 1998-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 _BRepAdaptor_CompCurve_HeaderFile
0018 #define _BRepAdaptor_CompCurve_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopoDS_Wire.hxx>
0025 #include <Standard_Real.hxx>
0026 #include <BRepAdaptor_HArray1OfCurve.hxx>
0027 #include <TColStd_HArray1OfReal.hxx>
0028 #include <Standard_Integer.hxx>
0029 #include <Standard_Boolean.hxx>
0030 #include <Adaptor3d_Curve.hxx>
0031 #include <GeomAbs_Shape.hxx>
0032 #include <TColStd_Array1OfReal.hxx>
0033 #include <GeomAbs_CurveType.hxx>
0034 
0035 class TopoDS_Edge;
0036 class gp_Pnt;
0037 class gp_Vec;
0038 class gp_Lin;
0039 class gp_Circ;
0040 class gp_Elips;
0041 class gp_Hypr;
0042 class gp_Parab;
0043 class Geom_BezierCurve;
0044 class Geom_BSplineCurve;
0045 
0046 DEFINE_STANDARD_HANDLE(BRepAdaptor_CompCurve, Adaptor3d_Curve)
0047 
0048 //! The Curve from BRepAdaptor allows to use a Wire
0049 //! of the BRep topology like a 3D curve.
0050 //! Warning: With this  class of curve,  C0 and C1 continuities
0051 //! are not assumed. So be careful with some algorithm!
0052 //! Please note that BRepAdaptor_CompCurve cannot be
0053 //! periodic curve at all (even if it contains single 
0054 //! periodic edge).
0055 //!
0056 //! BRepAdaptor_CompCurve can only work on valid wires where all edges are
0057 //! connected to each other to make a chain.
0058 class BRepAdaptor_CompCurve  : public Adaptor3d_Curve
0059 {
0060   DEFINE_STANDARD_RTTIEXT(BRepAdaptor_CompCurve, Adaptor3d_Curve)
0061 public:
0062 
0063   //! Creates an undefined Curve with no Wire loaded.
0064   Standard_EXPORT BRepAdaptor_CompCurve();
0065   
0066   Standard_EXPORT BRepAdaptor_CompCurve(const TopoDS_Wire& W, const Standard_Boolean KnotByCurvilinearAbcissa = Standard_False);
0067   
0068   //! Creates a Curve  to  access the geometry of edge
0069   //! <W>.
0070   Standard_EXPORT BRepAdaptor_CompCurve(const TopoDS_Wire& W, const Standard_Boolean KnotByCurvilinearAbcissa, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol);
0071   
0072   //! Shallow copy of adaptor
0073   Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE;
0074 
0075   //! Sets the  wire <W>.
0076   Standard_EXPORT void Initialize (const TopoDS_Wire& W, const Standard_Boolean KnotByCurvilinearAbcissa);
0077   
0078   //! Sets wire <W> and trimmed  parameter.
0079   Standard_EXPORT void Initialize (const TopoDS_Wire& W, const Standard_Boolean KnotByCurvilinearAbcissa, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol);
0080   
0081   //! Returns the wire.
0082   Standard_EXPORT const TopoDS_Wire& Wire() const;
0083   
0084   //! returns an  edge  and   one  parameter on them
0085   //! corresponding to the parameter U.
0086   Standard_EXPORT void Edge (const Standard_Real U, TopoDS_Edge& E, Standard_Real& UonE) const;
0087   
0088   Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
0089   
0090   Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
0091   
0092   Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
0093   
0094   //! Returns  the number  of  intervals for  continuity
0095   //! <S>. May be one if Continuity(me) >= <S>
0096   Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
0097   
0098   //! Stores in <T> the  parameters bounding the intervals
0099   //! of continuity <S>.
0100   //!
0101   //! The array must provide  enough room to  accommodate
0102   //! for the parameters. i.e. T.Length() > NbIntervals()
0103   Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
0104   
0105   //! Returns    a  curve equivalent   of  <me>  between
0106   //! parameters <First>  and <Last>. <Tol>  is used  to
0107   //! test for 3d points confusion.
0108   //! If <First> >= <Last>
0109   Standard_EXPORT Handle(Adaptor3d_Curve) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
0110   
0111   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
0112   
0113   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
0114   
0115   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
0116   
0117   //! Computes the point of parameter U on the curve
0118   Standard_EXPORT gp_Pnt Value (const Standard_Real U) const Standard_OVERRIDE;
0119   
0120   //! Computes the point of parameter U.
0121   Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE;
0122   
0123   //! Computes the point of parameter U on the curve
0124   //! with its first derivative.
0125   //! Raised if the continuity of the current interval
0126   //! is not C1.
0127   Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V) const Standard_OVERRIDE;
0128   
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, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE;
0135   
0136 
0137   //! Returns the point P of parameter U, the first, the second
0138   //! and the third derivative.
0139   //! Raised if the continuity of the current interval
0140   //! is not C3.
0141   Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const Standard_OVERRIDE;
0142   
0143 
0144   //! The returned vector gives the value of the derivative for the
0145   //! order of derivation N.
0146   //! Raised if the continuity of the current interval
0147   //! is not CN.
0148   //! Raised if N < 1.
0149   Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
0150   
0151   //! returns the parametric resolution
0152   Standard_EXPORT Standard_Real Resolution (const Standard_Real R3d) const Standard_OVERRIDE;
0153   
0154   Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE;
0155   
0156   Standard_EXPORT gp_Lin Line() const Standard_OVERRIDE;
0157   
0158   Standard_EXPORT gp_Circ Circle() const Standard_OVERRIDE;
0159   
0160   Standard_EXPORT gp_Elips Ellipse() const Standard_OVERRIDE;
0161   
0162   Standard_EXPORT gp_Hypr Hyperbola() const Standard_OVERRIDE;
0163   
0164   Standard_EXPORT gp_Parab Parabola() const Standard_OVERRIDE;
0165   
0166   Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE;
0167   
0168   Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE;
0169   
0170   Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE;
0171   
0172   Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE;
0173   
0174   Standard_EXPORT Handle(Geom_BezierCurve) Bezier() const Standard_OVERRIDE;
0175   
0176   Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE;
0177 
0178 
0179 
0180 
0181 protected:
0182 
0183 
0184 
0185 
0186 
0187 private:
0188 
0189   
0190   Standard_EXPORT void Prepare (Standard_Real& W, Standard_Real& D, Standard_Integer& ind) const;
0191   
0192   Standard_EXPORT void InvPrepare (const Standard_Integer ind, Standard_Real& F, Standard_Real& D) const;
0193 
0194 
0195   TopoDS_Wire myWire;
0196   Standard_Real TFirst;
0197   Standard_Real TLast;
0198   Standard_Real PTol;
0199   Handle(BRepAdaptor_HArray1OfCurve) myCurves;
0200   Handle(TColStd_HArray1OfReal) myKnots;
0201   Standard_Integer CurIndex;
0202   Standard_Boolean Forward;
0203   Standard_Boolean IsbyAC;
0204 };
0205 
0206 
0207 
0208 
0209 
0210 
0211 
0212 #endif // _BRepAdaptor_CompCurve_HeaderFile