Open CASCADE Technology Reference Manual 8.0.2
Loading...
Searching...
No Matches
MathSys_Newton3D.hxx File Reference

Optimized 3D Newton-Raphson solver for systems of 3 equations in 3 unknowns. More...

#include <MathSys_NewtonTypes.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <algorithm>
#include <array>
#include <cmath>

Namespaces

namespace  MathSys
 Shared types for specialized small-dimension Newton solvers.
namespace  MathSys::detail

Functions

bool MathSys::detail::IsBoundsValid3D (const NewtonBoundsN< 3 > &theBounds)
 Check that NewtonBoundsN<3> has valid (min <= max) ranges.
bool MathSys::detail::IsOptionsValid3D (const NewtonOptions &theOptions)
 Check that NewtonOptions fields are positive and valid.
double MathSys::detail::MaxDomainSize3D (const NewtonBoundsN< 3 > &theBounds)
 Return the largest domain extent across all 3 dimensions (min 1.0).
void MathSys::detail::Clamp3D (std::array< double, 3 > &theX, const NewtonBoundsN< 3 > &theBounds, bool theUseSoftBounds, double theSoftExtRatio)
 Clamp solution array to bounds, optionally extending by soft-bounds ratio.
bool MathSys::detail::Solve3x3 (const double theJ[3][3], const double theF[3], double theDelta[3])
 Solve 3x3 linear system J*x = -F using Cramer's rule with cofactor expansion.
template<typename Function>
NewtonResultN< 3 > MathSys::Solve3D (const Function &theFunc, const std::array< double, 3 > &theX0, const NewtonBoundsN< 3 > &theBounds, const NewtonOptions &theOptions=NewtonOptions())
 Solve a 3x3 nonlinear system by Newton iteration with bounds.
template<typename CurveEvaluator, typename SurfaceEvaluator>
NewtonResultN< 3 > MathSys::SolveCurveSurfaceExtrema3D (const CurveEvaluator &theCurve, const SurfaceEvaluator &theSurface, const std::array< double, 3 > &theX0, const NewtonBoundsN< 3 > &theBounds, const NewtonOptions &theOptions=NewtonOptions())
 Optimized 3D Newton solver for curve-surface extrema.

Detailed Description

Optimized 3D Newton-Raphson solver for systems of 3 equations in 3 unknowns.

This solver is specifically optimized for 3D problems like:

  • Curve-surface extrema (find t, u, v where distance is extremal)
  • Curve intersection with surface plus a constraint
  • Point-surface with additional constraint

Optimizations compared to general Newton:

  • No math_Vector/math_Matrix allocation overhead
  • Cramer's rule with precomputed cofactors for 3x3 system
  • Squared norm comparisons (avoid sqrt in convergence check)
  • Step limiting to prevent wild oscillations
  • Gradient descent fallback for singular Jacobian