Project
Loading...
Searching...
No Matches
o2::cad::surface Namespace Reference

Classes

class  BoundedSurface
 Abstract analytic surface patch: one support surface plus its trim, with the kernels the navigation needs. More...
 
struct  ClosureReport
 Whether a set of bounded surfaces forms a closed, consistently oriented 2-manifold, by half-edges, rims and edge identities. More...
 
class  ConicalBoundedSurface
 A cone whose radius varies linearly with height, trimmed as the cylinder; one radius may be zero (an apex) and slope 0 is a cylinder. More...
 
struct  Curve2D
 One trimmed boundary curve in a surface's (u, v) domain: a line segment, a circular arc or a clamped (rational) B-spline. More...
 
class  CurvedPlanarBoundedSurface
 A plane trimmed by curved (line/arc/B-spline) loops in an orthonormal frame: exact caps, disks and annuli. More...
 
struct  CurveWire
 One closed, oriented boundary loop of Curve2D segments: outer loops wind counter-clockwise, holes clockwise. More...
 
class  CylindricalBoundedSurface
 A cylinder of given radius around an axis, trimmed to a (phi, h) rectangle or by curve wires; innerWall points the normal to the axis. More...
 
class  DummyBoundedSurface
 A trivial bounded surface, a single 3D triangle, to exercise the BoundedSurface interface. More...
 
struct  ParametricMetric
 How a wire converts a parametric separation into a 3D length: the owning surface's first fundamental form, or the identity. More...
 
class  PlanarBoundedSurface
 
struct  QuarticRoots
 The real roots of a quartic: at most four, held inline. More...
 
struct  RayHit
 One ray/surface intersection: the ray parameter and the outward normal; a quadric patch can give several per ray. More...
 
struct  RimRecord
 One trim loop of one face as measureRimClosure saw it, naming the rim and its worst chord. More...
 
class  SphericalBoundedSurface
 A sphere of given radius trimmed to a (theta, phi) rectangle or by curve wires; innerWall points the normal to the centre. More...
 
struct  SurfaceEdge
 One straight line segment of a polygon wire, in a surface's parametric (u, v) domain. More...
 
struct  SurfaceRim
 One trim loop of one face as an ordered 3D polyline, compared with other faces' rims as a curve. More...
 
struct  SurfaceWire
 One closed, oriented polygon loop in a surface's parametric domain: outer loops wind counter-clockwise, holes clockwise. More...
 
class  TorusBoundedSurface
 
struct  Vec2
 A 2D point/vector in a surface's parametric (u, v) domain. More...
 
struct  Vec3
 A 3D point/vector in the solid's local frame. More...
 

Enumerations

enum class  WireClassification { Outside , Boundary , Inside }
 Classification of a parametric point against a closed wire. More...
 
enum class  WireRole { Outer , Inner }
 
enum class  WireStatus {
  Valid , Reversed , NonFinite , Open ,
  TooFewVertices , DegenerateVertex , ZeroArea
}
 
enum class  QuarticBranch { NotAQuartic , Biquadratic , Resolvent }
 Which of solveQuarticReal's branches produced its roots, for the tests. More...
 
enum class  CurveKind { Line , Arc , BSpline }
 Kind of a 2D trimmed boundary curve. More...
 
enum class  RimState { Matched = 0 , Reversed , Boundary , NonManifold }
 

Functions

Vec3 operator+ (const Vec3 &firstVector, const Vec3 &secondVector)
 
Vec3 operator- (const Vec3 &firstVector, const Vec3 &secondVector)
 
Vec3 operator* (const Vec3 &vector, double scale)
 
Vec3 operator* (double scale, const Vec3 &vector)
 
Vec2 operator- (const Vec2 &firstPoint, const Vec2 &secondPoint)
 
double parametricLengthSq (double gUU, double gUV, double gVV, const Vec2 &delta)
 The 3D length squared of parametric displacement delta under the first fundamental form (gUU, gUV, gVV).
 
template<typename Surface >
ParametricMetric parametricMetricOf (const Surface &surface)
 
double dot (const Vec3 &firstVector, const Vec3 &secondVector)
 
Vec3 cross (const Vec3 &firstVector, const Vec3 &secondVector)
 
double normSq (const Vec3 &vector)
 
double norm (const Vec3 &vector)
 
Vec3 normalized (const Vec3 &vector)
 
double component (const Vec3 &vector, int dimension)
 
void assignComponent (Vec3 &vector, int dimension, double value)
 
bool finite (const Vec2 &point)
 
bool finite (const Vec3 &point)
 
double distanceSq (const Vec2 &firstPoint, const Vec2 &secondPoint)
 
double distanceSq (const Vec3 &firstPoint, const Vec3 &secondPoint)
 
double cross2D (const Vec2 &firstVector, const Vec2 &secondVector)
 
double pointSegmentDistanceSq (const Vec2 &point, const Vec2 &segmentStart, const Vec2 &segmentEnd)
 
double pointSegmentDistanceSq (const Vec3 &point, const Vec3 &segmentStart, const Vec3 &segmentEnd)
 
bool sameIntersection (double firstDistance, double secondDistance)
 
const charwireStatusMessage (WireStatus status)
 Human-readable description of a wire status, for logging.
 
double trimLengthFloor (const ParametricMetric &metric, const Vec2 &uv)
 kTolerance as a parametric separation at uv: the floor of every trim's on-boundary band.
 
bool pointInTriangle (const Vec2 &point, const Vec2 &firstVertex, const Vec2 &secondVertex, const Vec2 &thirdVertex)
 
std::vector< std::array< int, 3 > > triangulateSimpleWire (const SurfaceWire &wire)
 Ear-clipping triangulation of a simple (non-self-intersecting) parametric wire.
 
double angularTolerance (double radius)
 Angular tolerance equivalent to a kTolerance arc length at the given radius.
 
int coverChunkCount (double span)
 
void sinusoidRange (double a, double b, double t0, double t1, double &minimum, double &maximum)
 Exact range of a cos(t) + b sin(t) over [t0, t1], at most a turn: the endpoint values, widened to the amplitude at a crest.
 
bool angleInSweepRange (double angle, double start, double sweep, double tolerance)
 
void gaussLegendre (int n, std::vector< double > &nodes, std::vector< double > &weights)
 The n-point Gauss-Legendre nodes and weights on [-1, 1], by Newton iteration on P_n.
 
int solveDepressedCubic (double coeffP, double coeffQ, std::array< double, 3 > &roots)
 
QuarticRoots solveQuarticReal (double a4, double a3, double a2, double a1, double a0, QuarticBranch *takenBranch=nullptr)
 
void assembleRims (const std::vector< std::pair< Vec3, Vec3 > > &edges, std::vector< SurfaceRim > &rims)
 Chain a face's directed chords into rims by matching endpoints within kTolerance, appending them to rims.
 
void appendArcBandCoverBoxes (const Vec3 &center, const Vec3 &axisU, const Vec3 &axisV, const Vec3 &axisW, double phiStart, double phiSweep, double heightMin, double heightMax, double radiusAtMin, double radiusAtMax, std::vector< BoundedSurface::CoverBox > &boxes)
 Cover boxes of a band of revolution between two rim circles: the phi window in chunks, each the box of its two rim arcs.
 
void measureSharedEdgeDeviation (const std::vector< std::unique_ptr< BoundedSurface > > &surfaces, ClosureReport &report)
 Measure the Hausdorff distance between the two faces of each shared edge into report; it decides nothing.
 
void measureRimClosure (const std::vector< std::unique_ptr< BoundedSurface > > &surfaces, double epsilon, ClosureReport &report)
 Measure the face-to-face gaps of surfaces as curves into report, probing chord midpoints against other faces' chords.
 
void applyEdgeIdentityClosure (const std::vector< std::unique_ptr< BoundedSurface > > &surfaces, ClosureReport &report)
 
ClosureReport validateClosure (const std::vector< std::unique_ptr< BoundedSurface > > &surfaces, double modelTolerance=0.)
 Validate closure and orientation of surfaces by half-edges, measure the rims, and count edge identities when present.
 
First fundamental forms by surface family, shared by the surfaces and the sidecar reader
void planeParametricMetric (const Vec3 &axisU, const Vec3 &axisV, double &gUU, double &gUV, double &gVV)
 
void cylinderParametricMetric (double radius, double &gUU, double &gUV, double &gVV)
 Cylinder, (u, v) = (phi[rad], h[cm]).
 
void coneParametricMetric (double radiusAtHeight, double slope, double &gUU, double &gUV, double &gVV)
 
void sphereParametricMetric (double radius, double theta, double &gUU, double &gUV, double &gVV)
 
void torusParametricMetric (double majorRadius, double minorRadius, double phiTube, double &gUU, double &gUV, double &gVV)
 Torus, (u, v) = (phiRing[rad], phiTube[rad]). The ring scale runs from R - r to R + r.
 
double sinusoidMinimum (double a, double b, double t0, double t1)
 
double sinusoidMaximum (double a, double b, double t0, double t1)
 

Variables

constexpr double kCoverChunkAngle = kPi / 4.
 Widest angular span of one cover box: pi/4, eight boxes per full turn.
 
Angular constants for parametric arc curves
constexpr double kPi = 3.14159265358979323846
 
constexpr double kTwoPi = 2. * kPi
 
constexpr double kHalfPi = 0.5 * kPi
 
constexpr int kArcSamples = 24
 Chords per full-circle arc for display and rims, shared by all surfaces so shared rims match; divisible by 4.
 

Numerical conventions: the tolerances shared by all bounded-surface code

constexpr double kTolerance = 1.e-9
 generic length tolerance
 
constexpr double kToleranceSq = kTolerance * kTolerance
 
constexpr double kAreaTolerance = 1.e-18
 degenerate (zero) parametric area
 
constexpr double kRayTolerance = 1.e-9
 minimum positive ray parameter t
 
constexpr double kIntersectionTolerance = 1.e-7
 clustering of near-equal intersections
 
constexpr double kClosureQuantum = 1.e-7
 
constexpr double kWireJoinTolerance = 1.e-6
 Wire-closure tolerance, a 3D length in cm through the surface metric: the CAD extractor's endpoint precision.
 
constexpr double kBSplineFlatness = 1.e-5
 Chord flatness of the adaptive B-spline sampler, in the curve's parametric units; a B-spline trim is this polyline.
 
constexpr double kBSplineFlatnessSq = kBSplineFlatness * kBSplineFlatness
 
constexpr double kRimMatchTolerance = 1.e-6
 Rim-matching distance in cm when the model states no tolerance: the extractor precision, as kWireJoinTolerance.
 
constexpr double kBVHBoxTolerance = 1.e-3
 Widening of the BVH leaf boxes before the outward float rounding; it dominates every navigation length tolerance.
 
constexpr double kQuarticEpsilon = 32. * 2.220446049250313e-16
 Zero threshold of solveQuarticReal's branch tests, in machine epsilons relative to the normalised terms: dimensionless.
 
constexpr double wireJoinToleranceFor (double modelTolerance)
 The wire-join band for a model with a declared tolerance: that tolerance when looser than kWireJoinTolerance, else the floor.
 

Curve-wire trim helpers for quadric parametric domains (u = phi, v = height or theta)

constexpr int kContourQuadratureOrder = 20
 Gauss-Legendre nodes per contour sub-interval, and the widest u span one sub-interval covers.
 
constexpr double kContourMaxSpanU = 0.25 * kPi
 
constexpr int kSharedEdgeSamples = 33
 Samples per trim curve when measuring a shared edge's deviation; it never enters a verdict.
 
double unwrapAngleInto (double angle, double uMin, double uMax)
 Shift angle by whole turns to lie as close as possible to the window [uMin, uMax].
 
bool curveTrimContains (const CurveWire &outerWire, const std::vector< CurveWire > &innerWires, const Vec2 &point, bool *boundary=nullptr, const ParametricMetric &metric={})
 Whether a parametric point is in a curve-wire trim (outer loop minus holes); boundary reports an on-boundary hit.
 
template<typename Antiderivative >
double contourIntegralAlongCurve (const Curve2D &curve, const Antiderivative &antiderivative, double from, double to)
 
template<typename Antiderivative >
double integrateOverCurveTrimByParts (const CurveWire &outerWire, const std::vector< CurveWire > &innerWires, const Antiderivative &antiderivative)
 Green's theorem over a wire-trimmed patch: the double integral of f is the contour integral of F dv, F the u-antiderivative of f; seams are bridged.
 
template<typename Integrand >
double integrateOverCurveTrim (const CurveWire &outerWire, const std::vector< CurveWire > &innerWires, const Integrand &integrand, int samplesPerAxis=128)
 Midpoint-rule integral of integrand over the trimmed region; kept as the independent check of the contour form.
 
bool buildCurveTrim (const std::vector< Curve2D > &outerTrim, const std::vector< std::vector< Curve2D > > &innerTrims, CurveWire &outerWire, std::vector< CurveWire > &innerWires, Vec2 &lower, Vec2 &upper, std::string &errorMessage, const ParametricMetric &metric={}, double joinTolerance=kWireJoinTolerance)
 Build validated outer and inner trim wires and the outer loop's parametric bounds; rejects a trim wider than a turn in u.
 
std::vector< Vec2sampleCurveWireByU (const CurveWire &wire, int segmentsPerTurn=kArcSamples)
 Sub-sample a curve-wire loop so its u span is chorded at segmentsPerTurn per turn, matching neighbouring rims.
 
template<typename MapUV >
void appendCurveTrimMesh (const CurveWire &outerWire, const MapUV &mapUV, std::vector< Vec3 > &vertices, std::vector< std::array< int, 3 > > &triangles)
 Append the display triangulation of a wire-trimmed quadric patch: the sampled outer loop, ear-clipped; holes are omitted.
 
template<typename MapUV >
void appendCurveTrimEdges (const CurveWire &outerWire, const std::vector< CurveWire > &innerWires, const MapUV &mapUV, double orientationSign, std::vector< std::pair< Vec3, Vec3 > > &edges)
 Append the directed 3D boundary edges of a wire-trimmed quadric patch; a negative orientationSign reverses them.
 
template<typename MapUV >
bool sampleTrimCurveOfCurveWires (const CurveWire &outerWire, const std::vector< CurveWire > &innerWires, size_t index, const MapUV &mapUV, std::vector< Vec3 > &samples)
 Sample input curve index of a curve-wire trim into 3D through mapUV; false when out of range or not traceable.
 
template<typename MapUV >
bool sampleTrimCurveOfSurfaceWires (const SurfaceWire &outerWire, const std::vector< SurfaceWire > &innerWires, size_t index, const MapUV &mapUV, std::vector< Vec3 > &samples)
 The same for a polygon (vertex-ring) trim, whose curves are all straight segments.
 

Enumeration Type Documentation

◆ CurveKind

enum class o2::cad::surface::CurveKind
strong

Kind of a 2D trimmed boundary curve.

Enumerator
Line 

straight line segment

Arc 

circular arc

BSpline 

clamped (rational) B-spline curve

Definition at line 975 of file BoundedSurface.h.

◆ QuarticBranch

Which of solveQuarticReal's branches produced its roots, for the tests.

Enumerator
NotAQuartic 

the leading coefficient vanishes; no roots are produced

Biquadratic 

the depressed quartic's odd term is zero, so y^4 + p y^2 + r = 0 is solved directly

Resolvent 

Ferrari's general branch, through the resolvent cubic.

Definition at line 834 of file BoundedSurface.h.

◆ RimState

enum class o2::cad::surface::RimState
strong

How one rim came out of the closure measurement. The four states are exhaustive, and they are exactly the four the ClosureReport rim counters tally.

Enumerator
Matched 

every chord has another face within its match band, traversed the other way

Reversed 

matched, but the partner traverses the shared curve the same way

Boundary 

some chord has no other face within its match band

NonManifold 

some chord has two or more other faces within the declared tolerance

Definition at line 4652 of file BoundedSurface.h.

◆ WireClassification

Classification of a parametric point against a closed wire.

Enumerator
Outside 
Boundary 
Inside 

Definition at line 383 of file BoundedSurface.h.

◆ WireRole

enum class o2::cad::surface::WireRole
strong

The role a wire plays for a bounded surface. Outer wires bound the material, inner wires (holes) subtract from it. The role fixes the expected winding relative to the surface normal.

Enumerator
Outer 
Inner 

Definition at line 389 of file BoundedSurface.h.

◆ WireStatus

enum class o2::cad::surface::WireStatus
strong

Outcome of wire construction / validation. Valid and Reversed are both usable results; Reversed additionally signals that the orientation had to be normalized (a logged repair).

Enumerator
Valid 

well-formed and already correctly oriented

Reversed 

well-formed but re-oriented to match its role (simple, logged repair)

NonFinite 

a vertex/edge contained a non-finite coordinate

Open 

an explicit edge list did not form a closed loop

TooFewVertices 

fewer than three distinct vertices after cleanup

DegenerateVertex 

a non-adjacent vertex coincided (self-touching / pinched loop)

ZeroArea 

the loop encloses no area

Definition at line 394 of file BoundedSurface.h.

Function Documentation

◆ angleInSweepRange()

bool o2::cad::surface::angleInSweepRange ( double  angle,
double  start,
double  sweep,
double  tolerance 
)
inline

True if angle lies within the angular range [start, start + sweep] (sweep in (0, 2pi]), allowing tolerance on both ends and treating a >= 2pi sweep as the full circle.

Definition at line 772 of file BoundedSurface.h.

◆ angularTolerance()

double o2::cad::surface::angularTolerance ( double  radius)
inline

Angular tolerance equivalent to a kTolerance arc length at the given radius.

Definition at line 713 of file BoundedSurface.h.

◆ appendArcBandCoverBoxes()

void o2::cad::surface::appendArcBandCoverBoxes ( const Vec3 center,
const Vec3 axisU,
const Vec3 axisV,
const Vec3 axisW,
double  phiStart,
double  phiSweep,
double  heightMin,
double  heightMax,
double  radiusAtMin,
double  radiusAtMax,
std::vector< BoundedSurface::CoverBox > &  boxes 
)
inline

Cover boxes of a band of revolution between two rim circles: the phi window in chunks, each the box of its two rim arcs.

Definition at line 3100 of file BoundedSurface.h.

◆ appendCurveTrimEdges()

template<typename MapUV >
void o2::cad::surface::appendCurveTrimEdges ( const CurveWire outerWire,
const std::vector< CurveWire > &  innerWires,
const MapUV &  mapUV,
double  orientationSign,
std::vector< std::pair< Vec3, Vec3 > > &  edges 
)

Append the directed 3D boundary edges of a wire-trimmed quadric patch; a negative orientationSign reverses them.

Definition at line 2274 of file BoundedSurface.h.

◆ appendCurveTrimMesh()

template<typename MapUV >
void o2::cad::surface::appendCurveTrimMesh ( const CurveWire outerWire,
const MapUV &  mapUV,
std::vector< Vec3 > &  vertices,
std::vector< std::array< int, 3 > > &  triangles 
)

Append the display triangulation of a wire-trimmed quadric patch: the sampled outer loop, ear-clipped; holes are omitted.

Definition at line 2254 of file BoundedSurface.h.

◆ applyEdgeIdentityClosure()

void o2::cad::surface::applyEdgeIdentityClosure ( const std::vector< std::unique_ptr< BoundedSurface > > &  surfaces,
ClosureReport report 
)
inline

Decide closure by counting edge identities when every surface states them: twice opposite is shared, once is open, three or more is non-manifold, twice same-sense is reversed; degenerate edges are excluded.

Definition at line 5039 of file BoundedSurface.h.

◆ assembleRims()

void o2::cad::surface::assembleRims ( const std::vector< std::pair< Vec3, Vec3 > > &  edges,
std::vector< SurfaceRim > &  rims 
)
inline

Chain a face's directed chords into rims by matching endpoints within kTolerance, appending them to rims.

Definition at line 2380 of file BoundedSurface.h.

◆ assignComponent()

void o2::cad::surface::assignComponent ( Vec3 vector,
int  dimension,
double  value 
)
inline

Definition at line 205 of file BoundedSurface.h.

◆ buildCurveTrim()

bool o2::cad::surface::buildCurveTrim ( const std::vector< Curve2D > &  outerTrim,
const std::vector< std::vector< Curve2D > > &  innerTrims,
CurveWire outerWire,
std::vector< CurveWire > &  innerWires,
Vec2 lower,
Vec2 upper,
std::string &  errorMessage,
const ParametricMetric metric = {},
double  joinTolerance = kWireJoinTolerance 
)
inline

Build validated outer and inner trim wires and the outer loop's parametric bounds; rejects a trim wider than a turn in u.

Definition at line 2176 of file BoundedSurface.h.

◆ component()

double o2::cad::surface::component ( const Vec3 vector,
int  dimension 
)
inline

Definition at line 194 of file BoundedSurface.h.

◆ coneParametricMetric()

void o2::cad::surface::coneParametricMetric ( double  radiusAtHeight,
double  slope,
double &  gUU,
double &  gUV,
double &  gVV 
)
inline

Cone, (u, v) = (phi[rad], h[cm]). radiusAtHeight is r(v), which reaches zero at an apex; a step in h also walks along the slope, hence gVV > 1.

Definition at line 294 of file BoundedSurface.h.

◆ contourIntegralAlongCurve()

template<typename Antiderivative >
double o2::cad::surface::contourIntegralAlongCurve ( const Curve2D curve,
const Antiderivative &  antiderivative,
double  from,
double  to 
)

Integrate F(u, v) dv along one directed curve of a trim wire, from from to to in the curve's own [0, 1] parameter.

Definition at line 2077 of file BoundedSurface.h.

◆ coverChunkCount()

int o2::cad::surface::coverChunkCount ( double  span)
inline

The number of kCoverChunkAngle chunks covering an angular span: at least one, and never more than a full turn takes, since a sweep may overshoot 2pi by a rounding hair.

Definition at line 723 of file BoundedSurface.h.

◆ cross()

Vec3 o2::cad::surface::cross ( const Vec3 firstVector,
const Vec3 secondVector 
)
inline

Definition at line 168 of file BoundedSurface.h.

◆ cross2D()

double o2::cad::surface::cross2D ( const Vec2 firstVector,
const Vec2 secondVector 
)
inline

Definition at line 238 of file BoundedSurface.h.

◆ curveTrimContains()

bool o2::cad::surface::curveTrimContains ( const CurveWire outerWire,
const std::vector< CurveWire > &  innerWires,
const Vec2 point,
bool *  boundary = nullptr,
const ParametricMetric metric = {} 
)
inline

Whether a parametric point is in a curve-wire trim (outer loop minus holes); boundary reports an on-boundary hit.

Definition at line 2037 of file BoundedSurface.h.

◆ cylinderParametricMetric()

void o2::cad::surface::cylinderParametricMetric ( double  radius,
double &  gUU,
double &  gUV,
double &  gVV 
)
inline

Cylinder, (u, v) = (phi[rad], h[cm]).

Definition at line 285 of file BoundedSurface.h.

◆ distanceSq() [1/2]

double o2::cad::surface::distanceSq ( const Vec2 firstPoint,
const Vec2 secondPoint 
)
inline

Definition at line 226 of file BoundedSurface.h.

◆ distanceSq() [2/2]

double o2::cad::surface::distanceSq ( const Vec3 firstPoint,
const Vec3 secondPoint 
)
inline

Definition at line 233 of file BoundedSurface.h.

◆ dot()

double o2::cad::surface::dot ( const Vec3 firstVector,
const Vec3 secondVector 
)
inline

Definition at line 162 of file BoundedSurface.h.

◆ finite() [1/2]

bool o2::cad::surface::finite ( const Vec2 point)
inline

Definition at line 216 of file BoundedSurface.h.

◆ finite() [2/2]

bool o2::cad::surface::finite ( const Vec3 point)
inline

Definition at line 221 of file BoundedSurface.h.

◆ gaussLegendre()

void o2::cad::surface::gaussLegendre ( int  n,
std::vector< double > &  nodes,
std::vector< double > &  weights 
)
inline

The n-point Gauss-Legendre nodes and weights on [-1, 1], by Newton iteration on P_n.

Definition at line 783 of file BoundedSurface.h.

◆ integrateOverCurveTrim()

template<typename Integrand >
double o2::cad::surface::integrateOverCurveTrim ( const CurveWire outerWire,
const std::vector< CurveWire > &  innerWires,
const Integrand &  integrand,
int  samplesPerAxis = 128 
)

Midpoint-rule integral of integrand over the trimmed region; kept as the independent check of the contour form.

Definition at line 2150 of file BoundedSurface.h.

◆ integrateOverCurveTrimByParts()

template<typename Antiderivative >
double o2::cad::surface::integrateOverCurveTrimByParts ( const CurveWire outerWire,
const std::vector< CurveWire > &  innerWires,
const Antiderivative &  antiderivative 
)

Green's theorem over a wire-trimmed patch: the double integral of f is the contour integral of F dv, F the u-antiderivative of f; seams are bridged.

Definition at line 2121 of file BoundedSurface.h.

◆ measureRimClosure()

void o2::cad::surface::measureRimClosure ( const std::vector< std::unique_ptr< BoundedSurface > > &  surfaces,
double  epsilon,
ClosureReport report 
)
inline

Measure the face-to-face gaps of surfaces as curves into report, probing chord midpoints against other faces' chords.

< how far this chord can sit from the smooth rim it samples, in cm

Another face's chord lies within this chord's match band.

The distinct faces found within the declared tolerance alone. Room for three is enough: only none, one and "more than one" are distinguished, and only the last is used.

Definition at line 4795 of file BoundedSurface.h.

◆ measureSharedEdgeDeviation()

void o2::cad::surface::measureSharedEdgeDeviation ( const std::vector< std::unique_ptr< BoundedSurface > > &  surfaces,
ClosureReport report 
)
inline

Measure the Hausdorff distance between the two faces of each shared edge into report; it decides nothing.

Definition at line 4730 of file BoundedSurface.h.

◆ norm()

double o2::cad::surface::norm ( const Vec3 vector)
inline

Definition at line 180 of file BoundedSurface.h.

◆ normalized()

Vec3 o2::cad::surface::normalized ( const Vec3 vector)
inline

Definition at line 185 of file BoundedSurface.h.

◆ normSq()

double o2::cad::surface::normSq ( const Vec3 vector)
inline

Definition at line 175 of file BoundedSurface.h.

◆ operator*() [1/2]

Vec3 o2::cad::surface::operator* ( const Vec3 vector,
double  scale 
)
inline

Definition at line 88 of file BoundedSurface.h.

◆ operator*() [2/2]

Vec3 o2::cad::surface::operator* ( double  scale,
const Vec3 vector 
)
inline

Definition at line 93 of file BoundedSurface.h.

◆ operator+()

Vec3 o2::cad::surface::operator+ ( const Vec3 firstVector,
const Vec3 secondVector 
)
inline

Definition at line 76 of file BoundedSurface.h.

◆ operator-() [1/2]

Vec2 o2::cad::surface::operator- ( const Vec2 firstPoint,
const Vec2 secondPoint 
)
inline

Definition at line 98 of file BoundedSurface.h.

◆ operator-() [2/2]

Vec3 o2::cad::surface::operator- ( const Vec3 firstVector,
const Vec3 secondVector 
)
inline

Definition at line 82 of file BoundedSurface.h.

◆ parametricLengthSq()

double o2::cad::surface::parametricLengthSq ( double  gUU,
double  gUV,
double  gVV,
const Vec2 delta 
)
inline

The 3D length squared of parametric displacement delta under the first fundamental form (gUU, gUV, gVV).

Definition at line 104 of file BoundedSurface.h.

◆ parametricMetricOf()

template<typename Surface >
ParametricMetric o2::cad::surface::parametricMetricOf ( const Surface &  surface)
inline

A ParametricMetric that defers to surface, which must outlive it. Every use here is a surface building its own wires inside initialize(), so that holds by construction.

Definition at line 154 of file BoundedSurface.h.

◆ planeParametricMetric()

void o2::cad::surface::planeParametricMetric ( const Vec3 axisU,
const Vec3 axisV,
double &  gUU,
double &  gUV,
double &  gVV 
)
inline

Plane: the frame axes carry the domain's units and need be neither unit nor orthogonal, which makes this the only family with a cross term.

Definition at line 277 of file BoundedSurface.h.

◆ pointInTriangle()

bool o2::cad::surface::pointInTriangle ( const Vec2 point,
const Vec2 firstVertex,
const Vec2 secondVertex,
const Vec2 thirdVertex 
)
inline

Definition at line 632 of file BoundedSurface.h.

◆ pointSegmentDistanceSq() [1/2]

double o2::cad::surface::pointSegmentDistanceSq ( const Vec2 point,
const Vec2 segmentStart,
const Vec2 segmentEnd 
)
inline

Definition at line 243 of file BoundedSurface.h.

◆ pointSegmentDistanceSq() [2/2]

double o2::cad::surface::pointSegmentDistanceSq ( const Vec3 point,
const Vec3 segmentStart,
const Vec3 segmentEnd 
)
inline

Definition at line 259 of file BoundedSurface.h.

◆ sameIntersection()

bool o2::cad::surface::sameIntersection ( double  firstDistance,
double  secondDistance 
)
inline

Definition at line 322 of file BoundedSurface.h.

◆ sampleCurveWireByU()

std::vector< Vec2 > o2::cad::surface::sampleCurveWireByU ( const CurveWire wire,
int  segmentsPerTurn = kArcSamples 
)
inline

Sub-sample a curve-wire loop so its u span is chorded at segmentsPerTurn per turn, matching neighbouring rims.

Definition at line 2223 of file BoundedSurface.h.

◆ sampleTrimCurveOfCurveWires()

template<typename MapUV >
bool o2::cad::surface::sampleTrimCurveOfCurveWires ( const CurveWire outerWire,
const std::vector< CurveWire > &  innerWires,
size_t  index,
const MapUV &  mapUV,
std::vector< Vec3 > &  samples 
)

Sample input curve index of a curve-wire trim into 3D through mapUV; false when out of range or not traceable.

Definition at line 2304 of file BoundedSurface.h.

◆ sampleTrimCurveOfSurfaceWires()

template<typename MapUV >
bool o2::cad::surface::sampleTrimCurveOfSurfaceWires ( const SurfaceWire outerWire,
const std::vector< SurfaceWire > &  innerWires,
size_t  index,
const MapUV &  mapUV,
std::vector< Vec3 > &  samples 
)

The same for a polygon (vertex-ring) trim, whose curves are all straight segments.

Definition at line 2340 of file BoundedSurface.h.

◆ sinusoidMaximum()

double o2::cad::surface::sinusoidMaximum ( double  a,
double  b,
double  t0,
double  t1 
)
inline

Definition at line 761 of file BoundedSurface.h.

◆ sinusoidMinimum()

double o2::cad::surface::sinusoidMinimum ( double  a,
double  b,
double  t0,
double  t1 
)
inline

One end of sinusoidRange, for the doubly swept covers of the sphere and the torus.

Definition at line 753 of file BoundedSurface.h.

◆ sinusoidRange()

void o2::cad::surface::sinusoidRange ( double  a,
double  b,
double  t0,
double  t1,
double &  minimum,
double &  maximum 
)
inline

Exact range of a cos(t) + b sin(t) over [t0, t1], at most a turn: the endpoint values, widened to the amplitude at a crest.

Definition at line 730 of file BoundedSurface.h.

◆ solveDepressedCubic()

int o2::cad::surface::solveDepressedCubic ( double  coeffP,
double  coeffQ,
std::array< double, 3 > &  roots 
)
inline

Fill roots with the real roots of w^3 + P w + Q = 0 and return their count: Cardano, or the trigonometric form for three. The branch is chosen by the sign of P, not by a tolerance, so every input is covered.

Definition at line 815 of file BoundedSurface.h.

◆ solveQuarticReal()

QuarticRoots o2::cad::surface::solveQuarticReal ( double  a4,
double  a3,
double  a2,
double  a1,
double  a0,
QuarticBranch takenBranch = nullptr 
)
inline

Real roots of a4 x^4 + a3 x^3 + a2 x^2 + a1 x + a0 = 0 (a4 != 0) by Ferrari's method and Newton polishing; a tangential root is a near-equal pair. The root variable is first rescaled by a power of two, exactly, so all branch tests are dimensionless; takenBranch reports the branch.

Definition at line 860 of file BoundedSurface.h.

◆ sphereParametricMetric()

void o2::cad::surface::sphereParametricMetric ( double  radius,
double  theta,
double &  gUU,
double &  gUV,
double &  gVV 
)
inline

Sphere, (u, v) = (phi[rad], theta[rad]). The azimuthal scale is the radius of the parallel at theta, so it vanishes at either pole.

Definition at line 303 of file BoundedSurface.h.

◆ torusParametricMetric()

void o2::cad::surface::torusParametricMetric ( double  majorRadius,
double  minorRadius,
double  phiTube,
double &  gUU,
double &  gUV,
double &  gVV 
)
inline

Torus, (u, v) = (phiRing[rad], phiTube[rad]). The ring scale runs from R - r to R + r.

Definition at line 312 of file BoundedSurface.h.

◆ triangulateSimpleWire()

std::vector< std::array< int, 3 > > o2::cad::surface::triangulateSimpleWire ( const SurfaceWire wire)
inline

Ear-clipping triangulation of a simple (non-self-intersecting) parametric wire.

Definition at line 642 of file BoundedSurface.h.

◆ trimLengthFloor()

double o2::cad::surface::trimLengthFloor ( const ParametricMetric metric,
const Vec2 uv 
)
inline

kTolerance as a parametric separation at uv: the floor of every trim's on-boundary band.

Definition at line 427 of file BoundedSurface.h.

◆ unwrapAngleInto()

double o2::cad::surface::unwrapAngleInto ( double  angle,
double  uMin,
double  uMax 
)
inline

Shift angle by whole turns to lie as close as possible to the window [uMin, uMax].

Definition at line 2030 of file BoundedSurface.h.

◆ validateClosure()

ClosureReport o2::cad::surface::validateClosure ( const std::vector< std::unique_ptr< BoundedSurface > > &  surfaces,
double  modelTolerance = 0. 
)
inline

Validate closure and orientation of surfaces by half-edges, measure the rims, and count edge identities when present.

Definition at line 5166 of file BoundedSurface.h.

◆ wireJoinToleranceFor()

constexpr double o2::cad::surface::wireJoinToleranceFor ( double  modelTolerance)
inlineconstexpr

The wire-join band for a model with a declared tolerance: that tolerance when looser than kWireJoinTolerance, else the floor.

Definition at line 47 of file BoundedSurface.h.

◆ wireStatusMessage()

const char * o2::cad::surface::wireStatusMessage ( WireStatus  status)
inline

Human-readable description of a wire status, for logging.

Definition at line 405 of file BoundedSurface.h.

Variable Documentation

◆ kArcSamples

constexpr int o2::cad::surface::kArcSamples = 24
inlineconstexpr

Chords per full-circle arc for display and rims, shared by all surfaces so shared rims match; divisible by 4.

Definition at line 709 of file BoundedSurface.h.

◆ kAreaTolerance

constexpr double o2::cad::surface::kAreaTolerance = 1.e-18
inlineconstexpr

degenerate (zero) parametric area

Definition at line 40 of file BoundedSurface.h.

◆ kBSplineFlatness

constexpr double o2::cad::surface::kBSplineFlatness = 1.e-5
inlineconstexpr

Chord flatness of the adaptive B-spline sampler, in the curve's parametric units; a B-spline trim is this polyline.

Definition at line 52 of file BoundedSurface.h.

◆ kBSplineFlatnessSq

constexpr double o2::cad::surface::kBSplineFlatnessSq = kBSplineFlatness * kBSplineFlatness
inlineconstexpr

Definition at line 53 of file BoundedSurface.h.

◆ kBVHBoxTolerance

constexpr double o2::cad::surface::kBVHBoxTolerance = 1.e-3
inlineconstexpr

Widening of the BVH leaf boxes before the outward float rounding; it dominates every navigation length tolerance.

Definition at line 58 of file BoundedSurface.h.

◆ kClosureQuantum

constexpr double o2::cad::surface::kClosureQuantum = 1.e-7
inlineconstexpr

vertex quantization for closure matching

Definition at line 43 of file BoundedSurface.h.

◆ kContourMaxSpanU

constexpr double o2::cad::surface::kContourMaxSpanU = 0.25 * kPi
inlineconstexpr

Definition at line 2072 of file BoundedSurface.h.

◆ kContourQuadratureOrder

constexpr int o2::cad::surface::kContourQuadratureOrder = 20
inlineconstexpr

Gauss-Legendre nodes per contour sub-interval, and the widest u span one sub-interval covers.

Definition at line 2071 of file BoundedSurface.h.

◆ kCoverChunkAngle

constexpr double o2::cad::surface::kCoverChunkAngle = kPi / 4.
inlineconstexpr

Widest angular span of one cover box: pi/4, eight boxes per full turn.

Definition at line 719 of file BoundedSurface.h.

◆ kHalfPi

constexpr double o2::cad::surface::kHalfPi = 0.5 * kPi
inlineconstexpr

Definition at line 707 of file BoundedSurface.h.

◆ kIntersectionTolerance

constexpr double o2::cad::surface::kIntersectionTolerance = 1.e-7
inlineconstexpr

clustering of near-equal intersections

Definition at line 42 of file BoundedSurface.h.

◆ kPi

constexpr double o2::cad::surface::kPi = 3.14159265358979323846
inlineconstexpr

Definition at line 705 of file BoundedSurface.h.

◆ kQuarticEpsilon

constexpr double o2::cad::surface::kQuarticEpsilon = 32. * 2.220446049250313e-16
inlineconstexpr

Zero threshold of solveQuarticReal's branch tests, in machine epsilons relative to the normalised terms: dimensionless.

Definition at line 60 of file BoundedSurface.h.

◆ kRayTolerance

constexpr double o2::cad::surface::kRayTolerance = 1.e-9
inlineconstexpr

minimum positive ray parameter t

Definition at line 41 of file BoundedSurface.h.

◆ kRimMatchTolerance

constexpr double o2::cad::surface::kRimMatchTolerance = 1.e-6
inlineconstexpr

Rim-matching distance in cm when the model states no tolerance: the extractor precision, as kWireJoinTolerance.

Definition at line 55 of file BoundedSurface.h.

◆ kSharedEdgeSamples

constexpr int o2::cad::surface::kSharedEdgeSamples = 33
inlineconstexpr

Samples per trim curve when measuring a shared edge's deviation; it never enters a verdict.

Definition at line 2300 of file BoundedSurface.h.

◆ kTolerance

constexpr double o2::cad::surface::kTolerance = 1.e-9
inlineconstexpr

generic length tolerance

Definition at line 38 of file BoundedSurface.h.

◆ kToleranceSq

constexpr double o2::cad::surface::kToleranceSq = kTolerance * kTolerance
inlineconstexpr

Definition at line 39 of file BoundedSurface.h.

◆ kTwoPi

constexpr double o2::cad::surface::kTwoPi = 2. * kPi
inlineconstexpr

Definition at line 706 of file BoundedSurface.h.

◆ kWireJoinTolerance

constexpr double o2::cad::surface::kWireJoinTolerance = 1.e-6
inlineconstexpr

Wire-closure tolerance, a 3D length in cm through the surface metric: the CAD extractor's endpoint precision.

Definition at line 45 of file BoundedSurface.h.