| 1 | // Created on: 2002-08-02 |
| 2 | // Created by: Alexander KARTOMIN (akm) |
| 3 | // Copyright (c) 2002-2014 OPEN CASCADE SAS |
| 4 | // |
| 5 | // This file is part of Open CASCADE Technology software library. |
| 6 | // |
| 7 | // This library is free software; you can redistribute it and/or modify it under |
| 8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
| 9 | // by the Free Software Foundation, with special exception defined in the file |
| 10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
| 11 | // distribution for complete text of the license and disclaimer of any warranty. |
| 12 | // |
| 13 | // Alternatively, this file may be used under the terms of Open CASCADE |
| 14 | // commercial license or contractual agreement. |
| 15 | |
| 16 | #ifndef _LProp3d_SLProps_HeaderFile |
| 17 | #define _LProp3d_SLProps_HeaderFile |
| 18 | |
| 19 | #include <Standard.hxx> |
| 20 | #include <Standard_DefineAlloc.hxx> |
| 21 | #include <Standard_Handle.hxx> |
| 22 | |
| 23 | #include <Standard_Real.hxx> |
| 24 | #include <Standard_Integer.hxx> |
| 25 | #include <gp_Pnt.hxx> |
| 26 | #include <gp_Vec.hxx> |
| 27 | #include <gp_Dir.hxx> |
| 28 | #include <LProp_Status.hxx> |
| 29 | #include <Standard_Boolean.hxx> |
| 30 | class Adaptor3d_HSurface; |
| 31 | class LProp_BadContinuity; |
| 32 | class Standard_DomainError; |
| 33 | class Standard_OutOfRange; |
| 34 | class LProp_NotDefined; |
| 35 | class LProp3d_SurfaceTool; |
| 36 | class gp_Pnt; |
| 37 | class gp_Vec; |
| 38 | class gp_Dir; |
| 39 | |
| 40 | |
| 41 | |
| 42 | class LProp3d_SLProps |
| 43 | { |
| 44 | public: |
| 45 | |
| 46 | DEFINE_STANDARD_ALLOC |
| 47 | |
| 48 | |
| 49 | //! Initializes the local properties of the surface <S> |
| 50 | //! for the parameter values (<U>, <V>). |
| 51 | //! The current point and the derivatives are |
| 52 | //! computed at the same time, which allows an |
| 53 | //! optimization of the computation time. |
| 54 | //! <N> indicates the maximum number of derivations to |
| 55 | //! be done (0, 1, or 2). For example, to compute |
| 56 | //! only the tangent, N should be equal to 1. |
| 57 | //! <Resolution> is the linear tolerance (it is used to test |
| 58 | //! if a vector is null). |
| 59 | Standard_EXPORT LProp3d_SLProps(const Handle(Adaptor3d_HSurface)& S, const Standard_Real U, const Standard_Real V, const Standard_Integer N, const Standard_Real Resolution); |
| 60 | |
| 61 | //! idem as previous constructor but without setting the value |
| 62 | //! of parameters <U> and <V>. |
| 63 | Standard_EXPORT LProp3d_SLProps(const Handle(Adaptor3d_HSurface)& S, const Standard_Integer N, const Standard_Real Resolution); |
| 64 | |
| 65 | //! idem as previous constructor but without setting the value |
| 66 | //! of parameters <U> and <V> and the surface. |
| 67 | //! the surface can have an empty constructor. |
| 68 | Standard_EXPORT LProp3d_SLProps(const Standard_Integer N, const Standard_Real Resolution); |
| 69 | |
| 70 | //! Initializes the local properties of the surface S |
| 71 | //! for the new surface. |
| 72 | Standard_EXPORT void SetSurface (const Handle(Adaptor3d_HSurface)& S); |
| 73 | |
| 74 | //! Initializes the local properties of the surface S |
| 75 | //! for the new parameter values (<U>, <V>). |
| 76 | Standard_EXPORT void SetParameters (const Standard_Real U, const Standard_Real V); |
| 77 | |
| 78 | //! Returns the point. |
| 79 | Standard_EXPORT const gp_Pnt& Value() const; |
| 80 | |
| 81 | //! Returns the first U derivative. |
| 82 | //! The derivative is computed if it has not been yet. |
| 83 | Standard_EXPORT const gp_Vec& D1U(); |
| 84 | |
| 85 | //! Returns the first V derivative. |
| 86 | //! The derivative is computed if it has not been yet. |
| 87 | Standard_EXPORT const gp_Vec& D1V(); |
| 88 | |
| 89 | //! Returns the second U derivatives |
| 90 | //! The derivative is computed if it has not been yet. |
| 91 | Standard_EXPORT const gp_Vec& D2U(); |
| 92 | |
| 93 | //! Returns the second V derivative. |
| 94 | //! The derivative is computed if it has not been yet. |
| 95 | Standard_EXPORT const gp_Vec& D2V(); |
| 96 | |
| 97 | //! Returns the second UV cross-derivative. |
| 98 | //! The derivative is computed if it has not been yet. |
| 99 | Standard_EXPORT const gp_Vec& DUV(); |
| 100 | |
| 101 | //! returns True if the U tangent is defined. |
| 102 | //! For example, the tangent is not defined if the |
| 103 | //! two first U derivatives are null. |
| 104 | Standard_EXPORT Standard_Boolean IsTangentUDefined(); |
| 105 | |
| 106 | //! Returns the tangent direction <D> on the iso-V. |
| 107 | Standard_EXPORT void TangentU (gp_Dir& D); |
| 108 | |
| 109 | //! returns if the V tangent is defined. |
| 110 | //! For example, the tangent is not defined if the |
| 111 | //! two first V derivatives are null. |
| 112 | Standard_EXPORT Standard_Boolean IsTangentVDefined(); |
| 113 | |
| 114 | //! Returns the tangent direction <D> on the iso-V. |
| 115 | Standard_EXPORT void TangentV (gp_Dir& D); |
| 116 | |
| 117 | //! Tells if the normal is defined. |
| 118 | Standard_EXPORT Standard_Boolean IsNormalDefined(); |
| 119 | |
| 120 | //! Returns the normal direction. |
| 121 | Standard_EXPORT const gp_Dir& Normal(); |
| 122 | |
| 123 | //! returns True if the curvature is defined. |
| 124 | Standard_EXPORT Standard_Boolean IsCurvatureDefined(); |
| 125 | |
| 126 | //! returns True if the point is umbilic (i.e. if the |
| 127 | //! curvature is constant). |
| 128 | Standard_EXPORT Standard_Boolean IsUmbilic(); |
| 129 | |
| 130 | //! Returns the maximum curvature |
| 131 | Standard_EXPORT Standard_Real MaxCurvature(); |
| 132 | |
| 133 | //! Returns the minimum curvature |
| 134 | Standard_EXPORT Standard_Real MinCurvature(); |
| 135 | |
| 136 | //! Returns the direction of the maximum and minimum curvature |
| 137 | //! <MaxD> and <MinD> |
| 138 | Standard_EXPORT void CurvatureDirections (gp_Dir& MaxD, gp_Dir& MinD); |
| 139 | |
| 140 | //! Returns the mean curvature. |
| 141 | Standard_EXPORT Standard_Real MeanCurvature(); |
| 142 | |
| 143 | //! Returns the Gaussian curvature |
| 144 | Standard_EXPORT Standard_Real GaussianCurvature(); |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | protected: |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | private: |
| 156 | |
| 157 | |
| 158 | |
| 159 | Handle(Adaptor3d_HSurface) mySurf; |
| 160 | Standard_Real myU; |
| 161 | Standard_Real myV; |
| 162 | Standard_Integer myDerOrder; |
| 163 | Standard_Integer myCN; |
| 164 | Standard_Real myLinTol; |
| 165 | gp_Pnt myPnt; |
| 166 | gp_Vec myD1u; |
| 167 | gp_Vec myD1v; |
| 168 | gp_Vec myD2u; |
| 169 | gp_Vec myD2v; |
| 170 | gp_Vec myDuv; |
| 171 | gp_Dir myNormal; |
| 172 | Standard_Real myMinCurv; |
| 173 | Standard_Real myMaxCurv; |
| 174 | gp_Dir myDirMinCurv; |
| 175 | gp_Dir myDirMaxCurv; |
| 176 | Standard_Real myMeanCurv; |
| 177 | Standard_Real myGausCurv; |
| 178 | Standard_Integer mySignificantFirstDerivativeOrderU; |
| 179 | Standard_Integer mySignificantFirstDerivativeOrderV; |
| 180 | LProp_Status myUTangentStatus; |
| 181 | LProp_Status myVTangentStatus; |
| 182 | LProp_Status myNormalStatus; |
| 183 | LProp_Status myCurvatureStatus; |
| 184 | |
| 185 | |
| 186 | }; |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | #endif // _LProp3d_SLProps_HeaderFile |