Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Data Structures | Namespaces
ExtremaPC.hxx File Reference

Common types and utilities for Point-Curve extrema computation. More...

#include <gp_Pnt.hxx>
#include <MathUtils_Domain.hxx>
#include <NCollection_DynamicArray.hxx>
#include <Precision.hxx>
#include <limits>
#include <optional>

Data Structures

struct  ExtremaPC::ExtremumResult
 Result of a single extremum computation. More...
 
struct  ExtremaPC::Result
 Result of extrema computation containing all found extrema. Non-copyable to enforce use of const reference from Perform(). More...
 
struct  ExtremaPC::Config
 Configuration for extrema computation. More...
 

Namespaces

namespace  ExtremaPC
 

Precision Constants

Centralized tolerance and precision values used throughout the ExtremaPC package. These replace magic numbers to improve code clarity and maintainability.

enum class  ExtremaPC::Status {
  ExtremaPC::OK , ExtremaPC::NotDone , ExtremaPC::InfiniteSolutions , ExtremaPC::NoSolution ,
  ExtremaPC::NumericalError
}
 Status of extrema computation. More...
 
enum class  ExtremaPC::SearchMode { ExtremaPC::MinMax , ExtremaPC::Min , ExtremaPC::Max }
 Search mode for extrema computation. Controls which extrema to find, enabling performance optimizations. More...
 
using ExtremaPC::Domain1D = MathUtils::Domain1D
 1D parameter domain for curves (alias for MathUtils::Domain1D).
 
constexpr double ExtremaPC::THE_DEFAULT_TOLERANCE = Precision::Confusion()
 Default tolerance for root finding and distance comparison. Used when no explicit tolerance is provided.
 
constexpr double ExtremaPC::THE_PARAM_TOLERANCE = Precision::PConfusion()
 Tolerance for parameter domain comparison (cache validation). Uses PConfusion which is appropriate for parametric space.
 
constexpr double ExtremaPC::THE_NEIGHBOR_STEP_RATIO = 0.01
 Ratio of parameter range for neighbor point sampling. Used to evaluate if an endpoint is a local extremum.
 
constexpr double ExtremaPC::THE_INTERVAL_EXPAND_RATIO = 0.05
 Ratio of parameter range for search interval expansion. Used in grid-based methods to expand candidate intervals.
 
constexpr double ExtremaPC::THE_REFINEMENT_STEP_RATIO = 0.001
 Ratio of parameter range for refinement step. Used in iterative refinement algorithms.
 
constexpr double ExtremaPC::THE_NEWTON_XTOL_FACTOR = 0.01
 Multiplier for X (parameter) tolerance in Newton refinement.
 
constexpr double ExtremaPC::THE_NEWTON_FTOL_FACTOR = 0.001
 Multiplier for F (function) tolerance in Newton refinement.
 
constexpr double ExtremaPC::THE_HINT_SEARCH_RADIUS = 0.1
 Default search radius for hint-based search (fraction of parameter range).
 
constexpr double ExtremaPC::THE_RANGE_NARROWING_FACTOR = 0.25
 Factor for narrowing parameter range during refinement iterations.
 
constexpr double ExtremaPC::THE_MAX_SKIP_THRESHOLD = 0.9
 Threshold for skipping max candidates that are clearly worse. If estimated distance < best * threshold, skip candidate.
 
constexpr double ExtremaPC::THE_NEAR_ZERO_F_FACTOR = 10.0
 Multiplier for near-zero F detection during grid scan. F values smaller than tolerance * this factor are considered near-zero.
 
constexpr double ExtremaPC::THE_FALLBACK_F_FACTOR = 100.0
 Multiplier for fallback F tolerance when Newton fails. Used to accept grid points as approximate solutions.
 
constexpr int ExtremaPC::THE_MAX_NEWTON_ITERATIONS = 20
 Maximum number of Newton iterations for refinement.
 
constexpr int ExtremaPC::THE_REFINEMENT_NB_SAMPLES = 20
 Number of samples for iterative grid refinement fallback.
 
constexpr int ExtremaPC::THE_REFINEMENT_NB_PASSES = 3
 Number of refinement passes when Newton fails.
 
constexpr int ExtremaPC::THE_BEZIER_MIN_SAMPLES = 24
 Minimum number of samples for Bezier curves.
 
constexpr int ExtremaPC::THE_BEZIER_DEGREE_MULTIPLIER = 3
 Multiplier for degree to compute Bezier samples: samples = max(min, multiplier * (degree + 1)).
 
constexpr int ExtremaPC::THE_OTHER_CURVE_NB_SAMPLES = 64
 Default number of samples for general (other) curves.
 
constexpr int ExtremaPC::THE_BSPLINE_FALLBACK_SAMPLES = 32
 Fallback number of samples for BSpline curves when curve is null.
 
constexpr int ExtremaPC::THE_BSPLINE_SPAN_MULTIPLIER = 2
 Multiplier for BSpline curve samples per knot span: samples = multiplier * (degree + 1). For a degree 3 curve: 2*4 = 8 samples per span. This is higher than the surface counterpart because curves are 1D and require finer sampling to detect extrema reliably. Surfaces use degree+2 per direction, resulting in (degree+2)^2 samples per cell, which provides adequate coverage.
 
template<typename CurveEvaluator >
void ExtremaPC::AddEndpointExtrema (Result &theResult, const gp_Pnt &theP, const Domain1D &theDomain, const CurveEvaluator &theEval, double theTol, SearchMode theMode)
 Adds endpoint extrema to result for bounded curves.
 

Detailed Description

Common types and utilities for Point-Curve extrema computation.

The ExtremaPC package provides modern C++ implementation of point-curve extrema computation using std::variant for curve type dispatch and BVH-based hierarchical algorithms for numerical curves.