File indexing completed on 2026-09-19 09:27:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _GeomLProp_CLProps_HeaderFile
0018 #define _GeomLProp_CLProps_HeaderFile
0019
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 #include <Standard_OutOfRange.hxx>
0024
0025 #include <gp_Pnt.hxx>
0026 #include <gp_Pnt2d.hxx>
0027 #include <gp_Vec.hxx>
0028 #include <gp_Vec2d.hxx>
0029 #include <gp_Dir.hxx>
0030 #include <gp_Dir2d.hxx>
0031 #include <LProp_Status.hxx>
0032
0033 #include <Geom_Curve.hxx>
0034 #include <Geom2d_Curve.hxx>
0035 #include <LProp_CurveUtils.hxx>
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 template <typename Pnt,
0047 typename Vec,
0048 typename Dir,
0049 typename CurveType,
0050 typename Access = LProp_CurveUtils::DirectAccess>
0051 class GeomLProp_CLPropsBase
0052 {
0053 public:
0054 DEFINE_STANDARD_ALLOC
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 GeomLProp_CLPropsBase(const CurveType& C, const int N, const double Resolution)
0066 : myCurve(C),
0067 myU(RealLast()),
0068 myDerOrder(N),
0069 myCN(4),
0070 myLinTol(Resolution),
0071 myTangentStatus(LProp_Undecided)
0072 {
0073 Standard_OutOfRange_Raise_if(N < 0 || N > 3, "GeomLProp_CLProps::GeomLProp_CLProps()");
0074 }
0075
0076
0077
0078
0079 GeomLProp_CLPropsBase(const CurveType& C, const double U, const int N, const double Resolution)
0080 : myCurve(C),
0081 myDerOrder(N),
0082 myCN(4),
0083 myLinTol(Resolution),
0084 myTangentStatus(LProp_Undecided)
0085 {
0086 Standard_OutOfRange_Raise_if(N < 0 || N > 3, "GeomLProp_CLProps::GeomLProp_CLProps()");
0087 SetParameter(U);
0088 }
0089
0090
0091
0092
0093
0094
0095
0096 GeomLProp_CLPropsBase(const int N, const double Resolution)
0097 : myCurve{},
0098 myU(RealLast()),
0099 myDerOrder(N),
0100 myCN(0),
0101 myLinTol(Resolution),
0102 myTangentStatus(LProp_Undecided)
0103 {
0104 Standard_OutOfRange_Raise_if(N < 0 || N > 3, "GeomLProp_CLProps() - invalid input");
0105 }
0106
0107
0108
0109 void SetParameter(const double U)
0110 {
0111 LProp_CurveUtils::SetParameter<Access>(myCurve,
0112 U,
0113 myU,
0114 myDerOrder,
0115 myPnt,
0116 myDerivArr,
0117 myTangentStatus);
0118 }
0119
0120
0121
0122 void SetCurve(const CurveType& C)
0123 {
0124 myCurve = C;
0125 myCN = 4;
0126 }
0127
0128
0129 const Pnt& Value() const { return myPnt; }
0130
0131
0132
0133 const Vec& D1()
0134 {
0135 return LProp_CurveUtils::EnsureDeriv<Access>(myCurve, myU, myDerOrder, 1, myPnt, myDerivArr);
0136 }
0137
0138
0139
0140 const Vec& D2()
0141 {
0142 return LProp_CurveUtils::EnsureDeriv<Access>(myCurve, myU, myDerOrder, 2, myPnt, myDerivArr);
0143 }
0144
0145
0146
0147 const Vec& D3()
0148 {
0149 return LProp_CurveUtils::EnsureDeriv<Access>(myCurve, myU, myDerOrder, 3, myPnt, myDerivArr);
0150 }
0151
0152
0153
0154
0155 bool IsTangentDefined()
0156 {
0157 return LProp_CurveUtils::IsTangentDefined<Vec>(*this,
0158 myCN,
0159 myLinTol,
0160 mySignificantFirstDerivativeOrder,
0161 myTangentStatus);
0162 }
0163
0164
0165 void Tangent(Dir& D)
0166 {
0167 LProp_CurveUtils::Tangent<Access>(*this,
0168 myCurve,
0169 myU,
0170 myDerivArr,
0171 myPnt,
0172 mySignificantFirstDerivativeOrder,
0173 D);
0174 }
0175
0176
0177 double Curvature()
0178 {
0179 return LProp_CurveUtils::Curvature(*this,
0180 myDerivArr[0],
0181 myDerivArr[1],
0182 myLinTol,
0183 mySignificantFirstDerivativeOrder,
0184 myCurvature);
0185 }
0186
0187
0188 void Normal(Dir& N)
0189 {
0190 LProp_CurveUtils::Normal(*this, myDerivArr[0], myDerivArr[1], myLinTol, N);
0191 }
0192
0193
0194 void CentreOfCurvature(Pnt& P)
0195 {
0196 LProp_CurveUtils::CentreOfCurvature(*this,
0197 myPnt,
0198 myDerivArr[0],
0199 myDerivArr[1],
0200 myLinTol,
0201 myCurvature,
0202 P);
0203 }
0204
0205 private:
0206 CurveType myCurve;
0207 double myU;
0208 int myDerOrder;
0209 int myCN;
0210 double myLinTol;
0211 Pnt myPnt;
0212 Vec myDerivArr[3];
0213 double myCurvature = 0.0;
0214 LProp_Status myTangentStatus;
0215 int mySignificantFirstDerivativeOrder = 0;
0216 };
0217
0218
0219 using GeomLProp_CLProps = GeomLProp_CLPropsBase<gp_Pnt, gp_Vec, gp_Dir, occ::handle<Geom_Curve>>;
0220
0221
0222 using GeomLProp_CLProps2d =
0223 GeomLProp_CLPropsBase<gp_Pnt2d, gp_Vec2d, gp_Dir2d, occ::handle<Geom2d_Curve>>;
0224
0225 #endif