CommitLineData
42cf5bc1 1// Created on: 1994-02-24
2// Created by: Laurent BOURESCHE
3// Copyright (c) 1994-1999 Matra Datavision
5//
6// This file is part of Open CASCADE Technology software library.
7//
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
25#include <Standard_Real.hxx>
26#include <Standard_Integer.hxx>
27#include <gp_Pnt.hxx>
28#include <gp_Vec.hxx>
29#include <gp_Dir.hxx>
30#include <LProp_Status.hxx>
31#include <Standard_Boolean.hxx>
33class Standard_DomainError;
34class Standard_OutOfRange;
35class LProp_NotDefined;
37class gp_Vec;
38class gp_Pnt;
39class gp_Dir;
40class BRepLProp_CurveTool;
41
42
43
44class BRepLProp_CLProps
45{
46public:
47
48 DEFINE_STANDARD_ALLOC
49
50
36b9ff75 51 //! Initializes the local properties of the curve <C>
52 //! The current point and the derivatives are
53 //! computed at the same time, which allows an
54 //! optimization of the computation time.
55 //! <N> indicates the maximum number of derivations to
56 //! be done (0, 1, 2 or 3). For example, to compute
57 //! only the tangent, N should be equal to 1.
58 //! <Resolution> is the linear tolerance (it is used to test
59 //! if a vector is null).
42cf5bc1 60 Standard_EXPORT BRepLProp_CLProps(const BRepAdaptor_Curve& C, const Standard_Integer N, const Standard_Real Resolution);
61
36b9ff75 62 //! Same as previous constructor but here the parameter is
63 //! set to the value <U>.
64 //! All the computations done will be related to <C> and <U>.
42cf5bc1 65 Standard_EXPORT BRepLProp_CLProps(const BRepAdaptor_Curve& C, const Standard_Real U, const Standard_Integer N, const Standard_Real Resolution);
66
36b9ff75 67 //! Same as previous constructor but here the parameter is
68 //! set to the value <U> and the curve is set
69 //! with SetCurve.
70 //! the curve can have a empty constructor
71 //! All the computations done will be related to <C> and <U>
72 //! when the functions "set" will be done.
42cf5bc1 73 Standard_EXPORT BRepLProp_CLProps(const Standard_Integer N, const Standard_Real Resolution);
74
36b9ff75 75 //! Initializes the local properties of the curve
76 //! for the parameter value <U>.
42cf5bc1 77 Standard_EXPORT void SetParameter (const Standard_Real U);
78
36b9ff75 79 //! Initializes the local properties of the curve
80 //! for the new curve.
42cf5bc1 81 Standard_EXPORT void SetCurve (const BRepAdaptor_Curve& C);
82
36b9ff75 83 //! Returns the Point.
42cf5bc1 84 Standard_EXPORT const gp_Pnt& Value() const;
85
36b9ff75 86 //! Returns the first derivative.
87 //! The derivative is computed if it has not been yet.
42cf5bc1 88 Standard_EXPORT const gp_Vec& D1();
89
36b9ff75 90 //! Returns the second derivative.
91 //! The derivative is computed if it has not been yet.
42cf5bc1 92 Standard_EXPORT const gp_Vec& D2();
93
36b9ff75 94 //! Returns the third derivative.
95 //! The derivative is computed if it has not been yet.
42cf5bc1 96 Standard_EXPORT const gp_Vec& D3();
97
36b9ff75 98 //! Returns True if the tangent is defined.
99 //! For example, the tangent is not defined if the
100 //! three first derivatives are all null.
42cf5bc1 101 Standard_EXPORT Standard_Boolean IsTangentDefined();
102
36b9ff75 103 //! output the tangent direction <D>
42cf5bc1 104 Standard_EXPORT void Tangent (gp_Dir& D);
105
36b9ff75 106 //! Returns the curvature.
42cf5bc1 107 Standard_EXPORT Standard_Real Curvature();
108
36b9ff75 109 //! Returns the normal direction <N>.
42cf5bc1 110 Standard_EXPORT void Normal (gp_Dir& N);
111
36b9ff75 112 //! Returns the centre of curvature <P>.
42cf5bc1 113 Standard_EXPORT void CentreOfCurvature (gp_Pnt& P);
114
115
116
117
118protected:
119
120
121
122
123
124private:
125
126
127
129 Standard_Real myU;
130 Standard_Integer myDerOrder;
131 Standard_Real myCN;
132 Standard_Real myLinTol;
133 gp_Pnt myPnt;
134 gp_Vec myDerivArr[3];
135 gp_Dir myTangent;
136 Standard_Real myCurvature;
137 LProp_Status myTangentStatus;
138 Standard_Integer mySignificantFirstDerivativeOrder;
139
140
141};
142
143
144
145
146
147
148