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

Optimized 4D Newton-Raphson solver for systems of 4 equations in 4 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::IsBoundsValid4D (const NewtonBoundsN< 4 > &theBounds)
 Check that NewtonBoundsN<4> has valid (min <= max) ranges.
bool MathSys::detail::IsOptionsValid4D (const NewtonOptions &theOptions)
 Check that NewtonOptions fields are positive and valid.
double MathSys::detail::MaxDomainSize4D (const NewtonBoundsN< 4 > &theBounds)
 Return the largest domain extent across all 4 dimensions (min 1.0).
void MathSys::detail::Clamp4D (std::array< double, 4 > &theX, const NewtonBoundsN< 4 > &theBounds, bool theUseSoftBounds, double theSoftExtRatio)
 Clamp solution array to bounds, optionally extending by soft-bounds ratio.
bool MathSys::detail::Solve4x4 (const double theJ[4][4], const double theF[4], double theDelta[4])
 Solve 4x4 linear system using Gaussian elimination with partial pivoting.
template<typename Function>
NewtonResultN< 4 > MathSys::Solve4D (const Function &theFunc, const std::array< double, 4 > &theX0, const NewtonBoundsN< 4 > &theBounds, const NewtonOptions &theOptions=NewtonOptions())
 Solve a 4x4 nonlinear system by Newton iteration with bounds.
template<typename SurfaceEvaluator1, typename SurfaceEvaluator2>
NewtonResultN< 4 > MathSys::SolveSurfaceSurfaceExtrema4D (const SurfaceEvaluator1 &theSurf1, const SurfaceEvaluator2 &theSurf2, const std::array< double, 4 > &theX0, const NewtonBoundsN< 4 > &theBounds, const NewtonOptions &theOptions=NewtonOptions())
 Optimized 4D Newton solver for surface-surface extrema.

Detailed Description

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

This solver is specifically optimized for 4D problems like:

  • Surface-surface extrema (find u1,v1,u2,v2 where distance is extremal)
  • Curve-surface intersection with tangent constraints
  • Two-curve closest point with additional constraints

Optimizations compared to general Newton:

  • No math_Vector/math_Matrix allocation overhead
  • Gaussian elimination with partial pivoting for 4x4 system
  • Squared norm comparisons (avoid sqrt in convergence check)
  • Step limiting to prevent wild oscillations
  • Gradient descent fallback for singular Jacobian