void Primitive :: GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2, ARRAY<int> & surfind, double eps) const { for (int j = 0; j < GetNSurfaces(); j++) { if (fabs (GetSurface(j).CalcFunctionValue (p)) < eps) { Vec<3> grad; GetSurface(j).CalcGradient (p, grad); if (sqr (grad * v1) < 1e-6 * v1.Length2() * grad.Length2() && sqr (grad * v2) < 1e-6 * v2.Length2() * grad.Length2() ) // new, 18032006 JS { if (!surfind.Contains (GetSurfaceId(j))) surfind.Append (GetSurfaceId(j)); } } } }
double ExplicitCurve2d :: MaxCurvature () const { double t, tmin, tmax, dt; double curv; Vec<2> tan; double maxcurv; maxcurv = 0; tmin = MinParam (); tmax = MaxParam (); dt = (tmax - tmin) / 1000; for (t = tmin; t <= tmax+dt; t += dt) if (SectionUsed (t)) { tan = EvalPrime (t); curv = fabs ( (Normal(t) * EvalPrimePrime(t)) / tan.Length2()); if (curv > maxcurv) maxcurv = curv; } return maxcurv; }
double ExplicitCurve2d :: MaxCurvatureLoc (const Point<2> & p, double rad) const { double t, tmin, tmax, dt; double curv; Vec<2> tan; double maxcurv; maxcurv = 0; tmin = MinParam (); tmax = MaxParam (); dt = (tmax - tmin) / 1000; for (t = tmin; t <= tmax+dt; t += dt) if (Dist (Eval(t), p) < rad) { tan = EvalPrime (t); curv = fabs ( (Normal(t) * EvalPrimePrime(t)) / tan.Length2()); if (curv > maxcurv) maxcurv = curv; } return maxcurv; }