Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Data Structures
ExtremaPC Namespace Reference

Data Structures

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

Precision Constants

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

enum class  Status {
  OK , NotDone , InfiniteSolutions , NoSolution ,
  NumericalError
}
 Status of extrema computation. More...
 
enum class  SearchMode { MinMax , Min , Max }
 Search mode for extrema computation. Controls which extrema to find, enabling performance optimizations. More...
 
using Domain1D = MathUtils::Domain1D
 1D parameter domain for curves (alias for MathUtils::Domain1D).
 
constexpr double THE_DEFAULT_TOLERANCE = Precision::Confusion()
 Default tolerance for root finding and distance comparison. Used when no explicit tolerance is provided.
 
constexpr double THE_PARAM_TOLERANCE = Precision::PConfusion()
 Tolerance for parameter domain comparison (cache validation). Uses PConfusion which is appropriate for parametric space.
 
constexpr double 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 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 THE_REFINEMENT_STEP_RATIO = 0.001
 Ratio of parameter range for refinement step. Used in iterative refinement algorithms.
 
constexpr double THE_NEWTON_XTOL_FACTOR = 0.01
 Multiplier for X (parameter) tolerance in Newton refinement.
 
constexpr double THE_NEWTON_FTOL_FACTOR = 0.001
 Multiplier for F (function) tolerance in Newton refinement.
 
constexpr double THE_HINT_SEARCH_RADIUS = 0.1
 Default search radius for hint-based search (fraction of parameter range).
 
constexpr double THE_RANGE_NARROWING_FACTOR = 0.25
 Factor for narrowing parameter range during refinement iterations.
 
constexpr double THE_MAX_SKIP_THRESHOLD = 0.9
 Threshold for skipping max candidates that are clearly worse. If estimated distance < best * threshold, skip candidate.
 
constexpr double 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 THE_FALLBACK_F_FACTOR = 100.0
 Multiplier for fallback F tolerance when Newton fails. Used to accept grid points as approximate solutions.
 
constexpr int THE_MAX_NEWTON_ITERATIONS = 20
 Maximum number of Newton iterations for refinement.
 
constexpr int THE_REFINEMENT_NB_SAMPLES = 20
 Number of samples for iterative grid refinement fallback.
 
constexpr int THE_REFINEMENT_NB_PASSES = 3
 Number of refinement passes when Newton fails.
 
constexpr int THE_BEZIER_MIN_SAMPLES = 24
 Minimum number of samples for Bezier curves.
 
constexpr int THE_BEZIER_DEGREE_MULTIPLIER = 3
 Multiplier for degree to compute Bezier samples: samples = max(min, multiplier * (degree + 1)).
 
constexpr int THE_OTHER_CURVE_NB_SAMPLES = 64
 Default number of samples for general (other) curves.
 
constexpr int THE_BSPLINE_FALLBACK_SAMPLES = 32
 Fallback number of samples for BSpline curves when curve is null.
 
constexpr int 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 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.
 

Typedef Documentation

◆ Domain1D

1D parameter domain for curves (alias for MathUtils::Domain1D).

Enumeration Type Documentation

◆ SearchMode

Search mode for extrema computation. Controls which extrema to find, enabling performance optimizations.

Enumerator
MinMax 

Find all extrema (both minima and maxima) - default.

Min 

Find only minimum distance (enables early termination in BVH)

Max 

Find only maximum distance.

◆ Status

Status of extrema computation.

Enumerator
OK 

Computation succeeded, finite number of extrema found.

NotDone 

Computation not performed.

InfiniteSolutions 

Infinite solutions exist (e.g., point at circle center)

NoSolution 

No extrema found in the given parameter range.

NumericalError 

Numerical issues during computation.

Function Documentation

◆ AddEndpointExtrema()

void ExtremaPC::AddEndpointExtrema ( Result & theResult,
const gp_Pnt & theP,
const Domain1D & theDomain,
const CurveEvaluator & theEval,
double theTol,
SearchMode theMode )
inline

Adds endpoint extrema to result for bounded curves.

This function adds the curve endpoints as extrema when:

  • The parameter bounds are finite
  • The endpoint is a true local extremum (checked via neighbor distance)
  • The endpoint doesn't duplicate an existing extremum

An endpoint is considered a local minimum if the distance to a neighboring point on the curve is greater than the distance to the endpoint. An endpoint is considered a local maximum if the distance to a neighboring point is less than the distance to the endpoint.

Template Parameters
CurveEvaluatorType with Value(double) method returning gp_Pnt
Parameters
theResultresult to add endpoints to
thePquery point
theDomainparameter domain
theEvalcurve evaluator
theToltolerance for duplicate detection
theModesearch mode

Variable Documentation

◆ THE_BEZIER_DEGREE_MULTIPLIER

constexpr int ExtremaPC::THE_BEZIER_DEGREE_MULTIPLIER = 3
constexpr

Multiplier for degree to compute Bezier samples: samples = max(min, multiplier * (degree + 1)).

◆ THE_BEZIER_MIN_SAMPLES

constexpr int ExtremaPC::THE_BEZIER_MIN_SAMPLES = 24
constexpr

Minimum number of samples for Bezier curves.

◆ THE_BSPLINE_FALLBACK_SAMPLES

constexpr int ExtremaPC::THE_BSPLINE_FALLBACK_SAMPLES = 32
constexpr

Fallback number of samples for BSpline curves when curve is null.

◆ THE_BSPLINE_SPAN_MULTIPLIER

constexpr int ExtremaPC::THE_BSPLINE_SPAN_MULTIPLIER = 2
constexpr

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.

◆ THE_DEFAULT_TOLERANCE

constexpr double ExtremaPC::THE_DEFAULT_TOLERANCE = Precision::Confusion()
constexpr

Default tolerance for root finding and distance comparison. Used when no explicit tolerance is provided.

◆ THE_FALLBACK_F_FACTOR

constexpr double ExtremaPC::THE_FALLBACK_F_FACTOR = 100.0
constexpr

Multiplier for fallback F tolerance when Newton fails. Used to accept grid points as approximate solutions.

◆ THE_HINT_SEARCH_RADIUS

constexpr double ExtremaPC::THE_HINT_SEARCH_RADIUS = 0.1
constexpr

Default search radius for hint-based search (fraction of parameter range).

◆ THE_INTERVAL_EXPAND_RATIO

constexpr double ExtremaPC::THE_INTERVAL_EXPAND_RATIO = 0.05
constexpr

Ratio of parameter range for search interval expansion. Used in grid-based methods to expand candidate intervals.

◆ THE_MAX_NEWTON_ITERATIONS

constexpr int ExtremaPC::THE_MAX_NEWTON_ITERATIONS = 20
constexpr

Maximum number of Newton iterations for refinement.

◆ THE_MAX_SKIP_THRESHOLD

constexpr double ExtremaPC::THE_MAX_SKIP_THRESHOLD = 0.9
constexpr

Threshold for skipping max candidates that are clearly worse. If estimated distance < best * threshold, skip candidate.

◆ THE_NEAR_ZERO_F_FACTOR

constexpr double ExtremaPC::THE_NEAR_ZERO_F_FACTOR = 10.0
constexpr

Multiplier for near-zero F detection during grid scan. F values smaller than tolerance * this factor are considered near-zero.

◆ THE_NEIGHBOR_STEP_RATIO

constexpr double ExtremaPC::THE_NEIGHBOR_STEP_RATIO = 0.01
constexpr

Ratio of parameter range for neighbor point sampling. Used to evaluate if an endpoint is a local extremum.

◆ THE_NEWTON_FTOL_FACTOR

constexpr double ExtremaPC::THE_NEWTON_FTOL_FACTOR = 0.001
constexpr

Multiplier for F (function) tolerance in Newton refinement.

◆ THE_NEWTON_XTOL_FACTOR

constexpr double ExtremaPC::THE_NEWTON_XTOL_FACTOR = 0.01
constexpr

Multiplier for X (parameter) tolerance in Newton refinement.

◆ THE_OTHER_CURVE_NB_SAMPLES

constexpr int ExtremaPC::THE_OTHER_CURVE_NB_SAMPLES = 64
constexpr

Default number of samples for general (other) curves.

◆ THE_PARAM_TOLERANCE

constexpr double ExtremaPC::THE_PARAM_TOLERANCE = Precision::PConfusion()
constexpr

Tolerance for parameter domain comparison (cache validation). Uses PConfusion which is appropriate for parametric space.

◆ THE_RANGE_NARROWING_FACTOR

constexpr double ExtremaPC::THE_RANGE_NARROWING_FACTOR = 0.25
constexpr

Factor for narrowing parameter range during refinement iterations.

◆ THE_REFINEMENT_NB_PASSES

constexpr int ExtremaPC::THE_REFINEMENT_NB_PASSES = 3
constexpr

Number of refinement passes when Newton fails.

◆ THE_REFINEMENT_NB_SAMPLES

constexpr int ExtremaPC::THE_REFINEMENT_NB_SAMPLES = 20
constexpr

Number of samples for iterative grid refinement fallback.

◆ THE_REFINEMENT_STEP_RATIO

constexpr double ExtremaPC::THE_REFINEMENT_STEP_RATIO = 0.001
constexpr

Ratio of parameter range for refinement step. Used in iterative refinement algorithms.