1 // Created on: 1997-12-19
2 // Created by: Philippe MANGIN
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _GeomFill_CorrectedFrenet_HeaderFile
18 #define _GeomFill_CorrectedFrenet_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <TColStd_HArray1OfReal.hxx>
26 #include <TColgp_HArray1OfVec.hxx>
27 #include <GeomFill_TrihedronLaw.hxx>
28 #include <Standard_Real.hxx>
29 #include <TColStd_SequenceOfReal.hxx>
30 #include <TColgp_SequenceOfVec.hxx>
31 #include <Standard_Integer.hxx>
32 #include <GeomAbs_Shape.hxx>
33 #include <TColStd_Array1OfReal.hxx>
34 #include <GeomFill_Trihedron.hxx>
35 class GeomFill_Frenet;
37 class Standard_OutOfRange;
38 class Standard_ConstructionError;
39 class GeomFill_TrihedronLaw;
41 class Adaptor3d_HCurve;
44 class GeomFill_CorrectedFrenet;
45 DEFINE_STANDARD_HANDLE(GeomFill_CorrectedFrenet, GeomFill_TrihedronLaw)
47 //! Defined an Corrected Frenet Trihedron Law It is
48 //! like Frenet with an Torsion's minimization
49 class GeomFill_CorrectedFrenet : public GeomFill_TrihedronLaw
55 Standard_EXPORT GeomFill_CorrectedFrenet();
57 Standard_EXPORT GeomFill_CorrectedFrenet(const Standard_Boolean ForEvaluation);
59 Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const Standard_OVERRIDE;
61 Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_HCurve)& C) Standard_OVERRIDE;
63 Standard_EXPORT virtual void SetInterval (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE;
65 //! compute Triedrhon on curve at parameter <Param>
66 Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, gp_Vec& Tangent, gp_Vec& Normal, gp_Vec& BiNormal) Standard_OVERRIDE;
68 //! compute Triedrhon and derivative Trihedron on curve
69 //! at parameter <Param>
70 //! Warning : It used only for C1 or C2 aproximation
71 Standard_EXPORT virtual Standard_Boolean D1 (const Standard_Real Param, gp_Vec& Tangent, gp_Vec& DTangent, gp_Vec& Normal, gp_Vec& DNormal, gp_Vec& BiNormal, gp_Vec& DBiNormal) Standard_OVERRIDE;
73 //! compute Trihedron on curve
74 //! first and seconde derivatives.
75 //! Warning : It used only for C2 aproximation
76 Standard_EXPORT virtual Standard_Boolean D2 (const Standard_Real Param, gp_Vec& Tangent, gp_Vec& DTangent, gp_Vec& D2Tangent, gp_Vec& Normal, gp_Vec& DNormal, gp_Vec& D2Normal, gp_Vec& BiNormal, gp_Vec& DBiNormal, gp_Vec& D2BiNormal) Standard_OVERRIDE;
78 //! Returns the number of intervals for continuity
80 //! May be one if Continuity(me) >= <S>
81 Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
83 //! Stores in <T> the parameters bounding the intervals
84 //! of continuity <S>.
86 //! The array must provide enough room to accomodate
87 //! for the parameters. i.e. T.Length() > NbIntervals()
88 Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
90 //! Tries to define the best trihedron mode
91 //! for the curve. It can be:
94 //! - DiscreteTrihedron
95 //! Warning: the CorrectedFrenet must be constructed
96 //! with option ForEvaluation = True,
97 //! the curve must be set by method SetCurve.
98 Standard_EXPORT GeomFill_Trihedron EvaluateBestMode();
100 //! Get average value of Tangent(t) and Normal(t) it is usfull to
101 //! make fast approximation of rational surfaces.
102 Standard_EXPORT virtual void GetAverageLaw (gp_Vec& ATangent, gp_Vec& ANormal, gp_Vec& ABiNormal) Standard_OVERRIDE;
104 //! Say if the law is Constant.
105 Standard_EXPORT virtual Standard_Boolean IsConstant() const Standard_OVERRIDE;
108 Standard_EXPORT virtual Standard_Boolean IsOnlyBy3dCurve() const Standard_OVERRIDE;
113 DEFINE_STANDARD_RTTIEXT(GeomFill_CorrectedFrenet,GeomFill_TrihedronLaw)
123 Standard_EXPORT void Init();
125 //! Computes BSpline representation of Normal evolution at one
126 //! interval of continuity of Frenet. Returns True if FuncInt = 0
127 Standard_EXPORT Standard_Boolean InitInterval (const Standard_Real First, const Standard_Real Last, const Standard_Real Step, Standard_Real& startAng, gp_Vec& prevTangent, gp_Vec& prevNormal, gp_Vec& aT, gp_Vec& aN, Handle(Law_Function)& FuncInt, TColStd_SequenceOfReal& SeqPoles, TColStd_SequenceOfReal& SeqAngle, TColgp_SequenceOfVec& SeqTangent, TColgp_SequenceOfVec& SeqNormal) const;
129 //! Computes angle of Normal evolution of Frenet between any two points on the curve.
130 Standard_EXPORT Standard_Real CalcAngleAT (const gp_Vec& Tangent, const gp_Vec& Normal, const gp_Vec& prevTangent, const gp_Vec& prevNormal) const;
132 //! Get corrected value of angle of Normal evolution of Frenet
133 Standard_EXPORT Standard_Real GetAngleAT (const Standard_Real P) const;
135 Handle(GeomFill_Frenet) frenet;
136 Handle(Law_Function) EvolAroundT;
137 Handle(Law_Function) TLaw;
140 Standard_Boolean isFrenet;
141 Standard_Boolean myForEvaluation;
142 Handle(TColStd_HArray1OfReal) HArrPoles;
143 Handle(TColStd_HArray1OfReal) HArrAngle;
144 Handle(TColgp_HArray1OfVec) HArrTangent;
145 Handle(TColgp_HArray1OfVec) HArrNormal;
156 #endif // _GeomFill_CorrectedFrenet_HeaderFile