Spline C reference
These private geometry services use caller-owned arrays, not vector handles. See Spline interpolation and graph smoothing for parameter formats, failure behavior and graph integration.
-
int Rbc_NaturalSpline(const Point2D *origPts, Tcl_Size nOrigPts, Point2D *intpPts, Tcl_Size nIntpPts)
Evaluate a natural cubic spline at caller-supplied abscissas.
Preserves exact source-knot values and extrapolates with the first/last interval outside the source domain. Allocates and frees private workspace; does not own either caller array or invoke Tcl callbacks.
- Parameters:
origPts – [in] Borrowed, separate source array with finite coordinates and strictly increasing X; at least three points are required.
nOrigPts – [in] Number of source points.
intpPts – [inout] Caller-owned non-NULL array; X supplies finite query positions in any order and is retained, Y receives interpolated values.
nIntpPts – [in] Number of queries, nonnegative; zero succeeds after validation.
- Returns:
TRUE on success, FALSE on invalid input, allocation or arithmetic failure. Output may be partially modified on failure; no Tcl diagnostic.
-
int Rbc_QuadraticSpline(const Point2D *origPts, Tcl_Size nOrigPts, Point2D *intpPts, Tcl_Size nIntpPts)
Evaluate a shape-preserving quadratic spline at caller-supplied abscissas.
Preserves exact source-knot values and extrapolates with the first/last interval outside the source domain. Allocates and frees private workspace; does not own either caller array or invoke Tcl callbacks.
- Parameters:
origPts – [in] Borrowed, separate source array with finite coordinates and strictly increasing X; at least three points are required.
nOrigPts – [in] Number of source points.
intpPts – [inout] Caller-owned non-NULL array; X supplies finite query positions in any order and is retained, Y receives interpolated values.
nIntpPts – [in] Number of queries, nonnegative; zero succeeds after validation.
- Returns:
TRUE on success, FALSE on invalid input, allocation or arithmetic failure. Output may be partially modified on failure; no Tcl diagnostic.
-
int Rbc_NaturalParametricSplineEval(const Point2D *origPts, Tcl_Size nOrigPts, Point2D *intpPts, Tcl_Size nIntpPts)
Evaluate an open natural cubic path at interval/fraction parameters.
Uses isotropic Euclidean chord lengths, rejecting degenerate intervals or unusable accumulated lengths. Source knots are copied exactly. Stages output separately before copying it back; releases all private workspace and invokes no Tcl callbacks. Caller retains ownership of both arrays.
- Parameters:
origPts – [in] Borrowed finite source points, at least three; X need not increase.
nOrigPts – [in] Number of source points.
intpPts – [inout] Caller-owned non-NULL array. On entry X is an integral source interval and Y is a fraction in [0,1]; on success both become coordinates. The final knot is represented by interval nOrigPts-1 and fraction zero.
nIntpPts – [in] Nonnegative number of parameters; zero succeeds after validation.
- Returns:
TRUE on success, FALSE on invalid input, allocation or arithmetic failure. Output parameters are unchanged on failure; no Tcl diagnostic.
-
int Rbc_QuadraticParametricSplineEval(const Point2D *origPts, Tcl_Size nOrigPts, Point2D *intpPts, Tcl_Size nIntpPts)
Evaluate an open quadratic path at interval/fraction parameters.
Uses isotropic Euclidean chord lengths, rejecting degenerate intervals or unusable accumulated lengths. Source knots are copied exactly. Stages output separately before copying it back; releases all private workspace and invokes no Tcl callbacks. Caller retains ownership of both arrays.
- Parameters:
origPts – [in] Borrowed finite source points, at least three; X need not increase.
nOrigPts – [in] Number of source points.
intpPts – [inout] Caller-owned non-NULL array. On entry X is an integral source interval and Y is a fraction in [0,1]; on success both become coordinates. The final knot is represented by interval nOrigPts-1 and fraction zero.
nIntpPts – [in] Nonnegative number of parameters; zero succeeds after validation.
- Returns:
TRUE on success, FALSE on invalid input, allocation or arithmetic failure. Output parameters are unchanged on failure; no Tcl diagnostic.
-
Tcl_Size Rbc_NaturalParametricSpline(const Point2D *origPts, Tcl_Size nOrigPts, const Extents2D *extsPtr, int isClosed, Point2D *intpPts, Tcl_Size nIntpPts)
Sample a natural parametric path using an extent-scaled chord metric.
Samples approximately uniformly in chord parameter, not exact curve arc length. Copies the first point and makes the last exact when the full count is produced. Frees internal coefficients and any closure copy. No Tcl callbacks or diagnostic.
- Parameters:
origPts – [in] Borrowed finite source array, separate from output; at least three points.
nOrigPts – [in] Number of source points.
extsPtr – [in] Required extents defining X/Y metric scales. Absolute spans smaller than FLT_EPSILON or non-finite spans are replaced by FLT_EPSILON.
isClosed – [in] Nonzero requests a closed curve; a missing final copy of the first point is appended in private storage.
intpPts – [out] Caller-owned output array with room for nIntpPts coordinates.
nIntpPts – [in] Requested sample count, at least two.
- Returns:
Generated count, or zero on failure. Require the full requested count before accepting output; partial output may remain on failure.
-
int Rbc_CatromParametricSpline(const Point2D *origPts, Tcl_Size nOrigPts, Point2D *intpPts, Tcl_Size nIntpPts)
Evaluate a Catmull-Rom path at interval/fraction parameters.
Validates parameters before writing, copies and extends source endpoints privately, then evaluates cubic coefficients. Does not use chord-length parameterization. Caller retains both arrays; no Tcl callbacks or diagnostic.
- Parameters:
origPts – [in] Borrowed finite source points; at least one is required.
nOrigPts – [in] Number of source points.
intpPts – [inout] Non-NULL caller-owned parameters, replaced by coordinates. X is an integral interval and Y is in [0,1]; the final knot uses interval nOrigPts-1 with fraction zero.
nIntpPts – [in] Nonnegative number of evaluations.
- Returns:
TRUE on success, FALSE on validation, allocation or arithmetic failure. Arithmetic failure may leave partially replaced output.
Parameter directions follow C calling conventions. Array capacities are caller obligations; counts describe used records, not byte sizes. The numerical entry points below do not acquire vector ownership or publish notifications.
Implementation helpers
- group Spline implementation helpers
Private implementation helpers; not installed C API entry points.
Functions
-
static int GetSplineArrayByteCount(Tcl_Size count, size_t elementSize, size_t *byteCountPtr)
Check the byte size of a spline workspace array.
Accepts zero count but rejects negative count, zero elementSize or SIZE_MAX overflow. Returns TCL_OK and writes byteCountPtr on success; otherwise returns TCL_ERROR without changing the output. No allocation or interpreter result.
- Parameters:
count – [in] Nonnegative number of array elements; zero is allowed.
elementSize – [in] Nonzero size of one element in bytes.
byteCountPtr – [out] Required size output, written only on TCL_OK.
-
static int SplinePointsAreFinite(const Point2D *points, Tcl_Size nPoints)
Validate both coordinates of a point array.
Returns FALSE for NULL storage, negative count or a non-finite coordinate. A non-NULL array with zero points is valid. Does not modify the array.
- Parameters:
points – [in] Coordinates to validate; NULL is rejected.
nPoints – [in] Number of accessible records; negative counts are rejected and zero is allowed.
-
static int SplinePointsHaveIncreasingX(const Point2D *points, Tcl_Size nPoints)
Validate finite source points with strictly increasing X.
Requires at least two points and validates both coordinates before comparing adjacent abscissas. Returns boolean; the interpolation wrappers impose their own stronger minimum of three source points. Does not modify storage.
- Parameters:
points – [in] Source coordinates to validate for finiteness and strictly increasing X.
nPoints – [in] Number of accessible source records, at least two for success.
-
static int SplineEvaluationPointsAreFinite(const Point2D *points, Tcl_Size nPoints)
Validate Cartesian query abscissas without inspecting ordinates.
Rejects NULL storage, negative count and non-finite X. Accepts zero queries with a non-NULL pointer. Query Y may be uninitialized because kernels replace it. Returns boolean and does not change the array.
- Parameters:
points – [in] Query records; only X is inspected, and Y need not be initialized.
nPoints – [in] Number of accessible query records; negative counts are rejected and zero is allowed.
-
static Tcl_Size Search(const Point2D points[], Tcl_Size nPoints, double key, int *foundPtr)
Find an exact knot or insertion position in sorted source X.
Requires strictly increasing source abscissas and finite key. Callers search inside the source domain. Sets foundPtr TRUE for an exact knot, otherwise FALSE and returns the first position whose abscissa exceeds key (possibly nPoints for an out-of-domain caller). Reads only X; no allocation or mutation.
- Parameters:
points – [in] Source array with strictly increasing finite abscissas.
nPoints – [in] Number of source points.
key – [in] Finite abscissa to locate.
foundPtr – [out] Required boolean output distinguishing an exact knot from an insertion position.
-
static int QuadChoose(const Point2D *p, const Point2D *q, double m1, double m2, double epsilon)
Choose one of four quadratic interval constructions.
p and q are ordered knots with distinct X; m1 and m2 are endpoint slopes. epsilon is a relative tolerance for slope comparisons (zero in the current Cartesian wrapper). Returns case 1 through 4 without modifying inputs. Case 4 uses two interior knots; the other cases use one. Assumes valid finite inputs; intermediate arithmetic is not checked here.
- Parameters:
p – [in] Borrowed left endpoint of an ordered interval.
q – [in] Borrowed right endpoint, with q->x greater than p->x.
m1 – [in] Finite slope at the left endpoint.
m2 – [in] Finite slope at the right endpoint.
epsilon – [in] Relative tolerance for slope comparisons; current Cartesian calls use zero.
-
static void QuadCases(const Point2D *p, const Point2D *q, double m1, double m2, double param[], int which)
Populate the ten parameters of a selected quadratic interval.
Requires the case returned by QuadChoose for p, q, m1 and m2. Clears all QUAD_PARAM_COUNT entries before filling the case-dependent knot/control-point pairs V, W, Z, E and Y. The caller owns param and must supply ten doubles. No allocation or finite-result validation; QuadSpline consumes the same case.
- Parameters:
p – [in] Borrowed left endpoint of an ordered interval.
q – [in] Borrowed right endpoint, with q->x greater than p->x.
m1 – [in] Finite slope at the left endpoint.
m2 – [in] Finite slope at the right endpoint.
param – [out] Caller-owned array of QUAD_PARAM_COUNT (ten) doubles, fully initialized here.
which – [in] Case 1 through 4 returned by QuadChoose for these endpoints and slopes.
-
static int QuadSelect(const Point2D *p, const Point2D *q, double m1, double m2, double epsilon, double param[])
Choose a quadratic case and fill its parameter array.
Combines QuadChoose and QuadCases. Returns the case number and writes ten caller-owned doubles to param. Preconditions and unchecked intermediate arithmetic are the same as those helpers; no allocation or callbacks.
- Parameters:
p – [in] Borrowed left endpoint of an ordered interval.
q – [in] Borrowed right endpoint, with q->x greater than p->x.
m1 – [in] Finite slope at the left endpoint.
m2 – [in] Finite slope at the right endpoint.
epsilon – [in] Relative slope-comparison tolerance passed to QuadChoose.
param – [out] Caller-owned array of ten doubles for the returned case.
-
static double QuadGetImage(double p1, double p2, double p3, double x1, double x2, double x3)
Evaluate the quadratic blend used within one spline piece.
Uses weights from x1-x2 and x2-x3 over the squared span x1-x3; p1, p2 and p3 are the corresponding ordinates/control value. Requires distinct x1 and x3. Returns a scalar without finite checks, allocation or side effects.
- Parameters:
p1 – [in] Ordinate weighted by (x1-x2) squared.
p2 – [in] Control ordinate weighted by twice (x2-x3)*(x1-x2).
p3 – [in] Ordinate weighted by (x2-x3) squared.
x1 – [in] First endpoint abscissa, distinct from x3.
x2 – [in] Evaluation abscissa.
x3 – [in] Other endpoint abscissa.
-
static void QuadSpline(Point2D *intp, const Point2D *left, const Point2D *right, const double param[], int ncase)
Replace one query ordinate using a prepared quadratic interval.
Reads intp->x and writes only intp->y. left/right, param and ncase must describe the same interval selected by QuadSelect. Selects the appropriate subpiece, preserving an internal knot ordinate exactly. Allows extrapolation and performs no allocation or finite-result check.
- Parameters:
intp – [inout] One query record: X is read and retained; Y is replaced.
left – [in] Borrowed left source endpoint.
right – [in] Borrowed right source endpoint.
param – [in] Ten prepared parameters matching the endpoints and case.
ncase – [in] Case returned by QuadSelect for this interval.
-
static void QuadSlopes(const Point2D points[], double *m, Tcl_Size nPoints)
Estimate shape-preserving quadratic knot derivatives.
Requires at least three finite points with strictly increasing X and caller storage for nPoints derivatives. Uses adjacent secants, sets interior slopes to zero at flat or sign-changing joins, then derives endpoint slopes. Fills m without allocation; the caller must reject non-finite derivatives afterward. The construction preserves shape where compatible with the supplied data.
- Parameters:
points – [in] Finite source points with strictly increasing X.
m – [out] Caller-owned storage for nPoints knot derivatives.
nPoints – [in] Number of source points, at least three.
-
static int QuadEval(const Point2D origPts[], Tcl_Size nOrigPts, Point2D intpPts[], Tcl_Size nIntpPts, const double *m, double epsilon)
Evaluate ordered-source quadratic splines at arbitrary query X.
Source X must increase strictly and m must supply one derivative per source knot. Query X need not be sorted. Preserves exact source knots, uses binary search otherwise, and caches parameters only for the last used interval. Outside-domain queries use the first or final interval for extrapolation.
Returns 0 for interpolation only, 1 if any query extrapolated, or 2 for an internal interval lookup failure. Replaces query Y incrementally, never X; outputs can be partially written on failure. The wrapper validates finite results afterward. No allocation or callbacks.
- Parameters:
origPts – [in] Borrowed source array, disjoint from output.
nOrigPts – [in] Number of source records.
intpPts – [inout] Caller-owned queries: X supplies abscissas and is retained; Y receives results.
nIntpPts – [in] Number of query records, nonnegative.
m – [in] One prepared derivative per source knot; source X must strictly increase.
epsilon – [in] Relative slope-comparison tolerance for interval preparation.
-
static int GetRealSplineVector(Tcl_Interp *interp, const char *name, Rbc_Vector **vecPtrPtr)
Look up a real vector for the spline command.
Returns TCL_OK for an existing real vector, otherwise TCL_ERROR with an interpreter message. vecPtrPtr is borrowed and may already be assigned if the type check fails. Does not create, resize, preserve or check writability.
- Parameters:
interp – [in] Lookup/diagnostic interpreter; see Interpreter arguments.
name – [in] Borrowed vector name resolved in the interpreter.
vecPtrPtr – [out] Required output for a borrowed real vector. May already be assigned when type validation fails; no lifetime reference is acquired.
-
static int GetComplexSplineVector(Tcl_Interp *interp, const char *name, Rbc_Vector **vecPtrPtr)
Look up a complex vector for the parametric command.
Returns TCL_OK for an existing complex vector, otherwise TCL_ERROR with an interpreter message. vecPtrPtr is borrowed and may already be assigned if the type check fails. Does not create, resize, preserve or check writability.
- Parameters:
interp – [in] Lookup/diagnostic interpreter; see Interpreter arguments.
name – [in] Borrowed vector name resolved in the interpreter.
vecPtrPtr – [out] Required output for a borrowed complex vector. May already be assigned when type validation fails; no lifetime reference is acquired.
-
static int SplineStoreResult(Tcl_Interp *interp, const char *name, Rbc_VectorType type, const Point2D *points, Tcl_Size length)
Copy completed points and commit a typed spline result.
Requires validated points and a real or complex type. Copies Y into real storage, or X/Y into complex storage, before resolving or creating the output. Existing outputs must match type and be writable. Installs the complete owned buffer before custom old-storage release, array mapping/traces or notification. Preserves record/interpreter lifetime and checks destruction after callbacks.
New real outputs receive automatic mapping unless their names contain an opening parenthesis. Mapping failure deletes only the newly created original record, never a callback-created replacement. Returns TCL_OK with an empty result or TCL_ERROR with diagnostics. Precommit failures leave an existing output unchanged; callback mutations after commit are not rolled back. The caller retains ownership of points.
- Parameters:
interp – [in] Destination interpreter, preserved across commit callbacks; see Interpreter arguments.
name – [in] Borrowed destination name used for the initial lookup or creation, never re-resolved after commit.
type – [in] Required output type: RBC_VECTOR_REAL or RBC_VECTOR_COMPLEX.
points – [in] Borrowed completed coordinates; Y becomes real data, or X/Y become complex real/imaginary components.
length – [in] Nonnegative number of completed points to copy; caller retains the input array.
-
static int ParametricSplineObjCmd(Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[])
Evaluate the six-argument complex-vector spline command.
The dispatcher must validate objc before entry. Accepts natural or quadratic, at least three finite source points without consecutive duplicates, and at least two output samples. Copies source coordinates before computation, stages the complete output and commits through SplineStoreResult only if the requested sample count was produced. Supports source/result aliasing. Frees both scratch arrays on every path; returns Tcl status and diagnostics.
- Parameters:
interp – [in] Command interpreter; see Interpreter arguments.
objc – [in] Must be six, already validated by SplineObjCmd; not checked again here.
objv – [in] Full words: command, parametric, natural|quadratic, source, result, samples. Borrowed as in Tcl command arguments.
-
static int SplineObjCmd(ClientData clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[])
Dispatch Cartesian or parametric Tcl spline operations.
Validates operation/arity through splineOps. Cartesian inputs are real vectors with equal X/Y lengths, at least three finite source points, strictly increasing X, and finite query X in any order. Empty queries are supported. Copies all source/query values before running a kernel, so output may alias any input.
Commits only a completely successful numerical result through SplineStoreResult; all temporary arrays remain owned by this call and are released on exit. Returns TCL_OK with an empty result or TCL_ERROR with diagnostics. clientData is unused. Parametric operations delegate after argument-count validation.
- Parameters:
clientData – [in] Unused command client data; see Callback client data.
interp – [in] Command interpreter; see Interpreter arguments.
objc – [in] Count including the command name; see Tcl command arguments.
objv – [in] Borrowed full command argument array; see Tcl command arguments.
-
int Rbc_SplineInit(Tcl_Interp *interp)
Register the Tcl spline command.
Creates ::rbc::spline with SplineObjCmd and no client data or delete callback. Returns TCL_OK. Package initialization supplies the namespace; this routine allocates no persistent spline workspace.
- Parameters:
interp – [in] Target interpreter with the rbc namespace already available; see Interpreter arguments.
-
static int SolveCubic1(TriDiagonalMatrix A[], Tcl_Size n)
Factor a cyclic symmetric tridiagonal system in place.
A stores lower/diagonal/upper entries in slots 0/1/2, including the cyclic corner entries A[0][0] and A[n-1][2]. Requires symmetric positive-definite input and n >= 1. Forms C-transpose * D * C with unit-diagonal upper C, overwriting A. Returns FALSE on detected invalid pivots and may leave partial factors. No allocation; later stages still must validate numerical finiteness.
- Parameters:
A – [inout] Caller-owned n-row cyclic symmetric tridiagonal matrix, overwritten with factors; partial factors may remain on failure.
n – [in] Matrix dimension, at least one for success.
-
static void SolveCubic2(const TriDiagonalMatrix A[], CubicSpline spline[], Tcl_Size nIntervals)
Solve two right-hand sides using the cyclic factors.
Requires factors from successful SolveCubic1 and nIntervals >= 1. Forward, diagonal and backward substitution replace spline[].x and spline[].y with solutions, leaving t unchanged. Does not allocate, check finiteness or return status; CubicSlopes validates the solved values before using them.
- Parameters:
A – [in] Borrowed successful SolveCubic1 factors for nIntervals rows.
spline – [inout] Caller-owned rows: X/Y right-hand sides become solutions; t fields are retained.
nIntervals – [in] System dimension, at least one.
-
static CubicSpline *CubicSlopes(const Point2D points[], Tcl_Size nPoints, int isClosed, double unitX, double unitY)
Build chord lengths and limited parametric cubic derivatives.
Requires at least three finite points and positive finite unitX/unitY. Closed paths must already repeat the first point at the end. Divides coordinate differences by those units for the chord metric and rejects lengths no greater than DBL_EPSILON. Builds and solves a cyclic or open tridiagonal system.
The historical construction limits the scaled derivative right-hand-side norm to 8.5. Open endpoints copy adjacent solved derivatives rather than imposing zero second derivatives; this is distinct from the Cartesian natural kernel. Returns an owned nPoints CubicSpline array to release with ckfree, or NULL on validation, allocation or detected arithmetic failure. Only the first nPoints-1 t entries are interval lengths. Inputs are never modified.
- Parameters:
points – [in] Finite source path; closed paths must already repeat the first point at the end.
nPoints – [in] Number of source points, at least three.
isClosed – [in] Nonzero selects closed-path matrix construction.
unitX – [in] Positive finite X scale used as a divisor in chord lengths.
unitY – [in] Positive finite Y scale used as a divisor in chord lengths.
-
static int CubicEvalPoint(const Point2D origPts[], const CubicSpline spline[], Tcl_Size interval, double t, Point2D *pointPtr)
Evaluate one parametric cubic at local chord distance.
Caller guarantees valid interval and interval+1 indices in origPts/spline. Validates positive finite interval length and local t in [0,length], preserving endpoint coordinates exactly. Writes pointPtr and returns finite-result status; FALSE can follow non-finite output writes. No allocation or vector callbacks.
- Parameters:
origPts – [in] Source points containing interval and interval+1.
spline – [in] Matching coefficient array containing interval and interval+1.
interval – [in] Caller-validated source interval index.
t – [in] Local chord distance in [0,spline[interval].t], not a normalized fraction.
pointPtr – [out] Required coordinate output. Arithmetic failure may write nonfinite components before returning FALSE.
-
static Tcl_Size CubicEval(const Point2D origPts[], Tcl_Size nOrigPts, Point2D intpPts[], Tcl_Size nIntpPts, const CubicSpline spline[])
Sample a cubic path uniformly in its chord parameter.
Requires non-NULL arrays, at least two source points and two output slots, and spline interval lengths matching the source. Validates the accumulated length, then uses (1-1e-7)*total/(samples-1) to avoid losing the last sample. Returns the number generated, or zero for detected failure. Failure can leave partial output; the caller must compare the count with its request. Does not restore the exact final endpoint (NaturalParametricSplineCore does that). No allocation; output must not overwrite source or coefficient storage.
- Parameters:
origPts – [in] Borrowed source array, disjoint from output.
nOrigPts – [in] Number of source records.
intpPts – [out] Caller-owned output array, disjoint from source and coefficients; partial writes may remain on failure.
nIntpPts – [in] Requested output count, at least two.
spline – [in] Matching coefficients; the first nOrigPts-1 t fields hold positive finite interval lengths.
-
static Tcl_Size QuadraticParametricSplineCore(const Point2D origPts[], Tcl_Size nOrigPts, Point2D intpPts[], Tcl_Size nIntpPts)
Sample coordinate splines on a shared Euclidean chord parameter.
Requires at least three finite source points and two output slots. Allocates private coordinate/imaginary-query arrays, rejects degenerate chords and non-increasing cumulative parameters, and evaluates both quadratic coordinates. Uses intpPts itself as real-query workspace before converting to X/Y, so a zero failure result may leave temporary parameters or partial coordinates there. Returns nIntpPts on success and restores both endpoints exactly. Releases all private arrays; caller-owned source and output must not overlap.
- Parameters:
origPts – [in] Borrowed source array, disjoint from output.
nOrigPts – [in] Number of source records.
intpPts – [inout] Caller-owned output also used as query workspace; failure may leave parameters or partial coordinates.
nIntpPts – [in] Requested output count, at least two.
-
static Tcl_Size NaturalParametricSplineCore(const Point2D origPts[], Tcl_Size nOrigPts, double unitX, double unitY, int isClosed, Point2D intpPts[], Tcl_Size nIntpPts)
Sample an open or closed limited cubic path.
Requires at least three finite source points, two output slots and positive finite metric units. Appends a private closing point if requested and missing, then owns/reclaims CubicSlopes workspace. Returns the CubicEval count (zero on detected failure); restores the last endpoint exactly only for a full result. Output may be partially written on failure and must not overlap input. No vector lookup, notification or Tcl callback occurs.
- Parameters:
origPts – [in] Borrowed source array, disjoint from output.
nOrigPts – [in] Number of source records.
unitX – [in] Positive finite X scale used as a divisor in chord lengths.
unitY – [in] Positive finite Y scale used as a divisor in chord lengths.
isClosed – [in] Nonzero requests a closed curve, appending a closing point privately if needed.
intpPts – [out] Caller-owned output array, disjoint from source and coefficients; partial writes may remain on failure.
nIntpPts – [in] Requested output count, at least two.
-
static void CatromCoeffs(const Point2D *p, Point2D *a, Point2D *b, Point2D *c, Point2D *d)
Build twice-scaled Catmull-Rom polynomial coefficients.
Reads four consecutive control points and writes X/Y coefficients to a, b, c and d. The caller evaluates (d+t*(c+t*(b+t*a)))/2. Output records must be distinct and must not overlap control points. No validation or allocation; the caller handles non-finite evaluation results.
- Parameters:
p – [in] Four consecutive borrowed control points.
a – [out] Twice-scaled cubic coefficient pair.
b – [out] Twice-scaled quadratic coefficient pair.
c – [out] Twice-scaled linear coefficient pair.
d – [out] Twice-scaled constant coefficient pair; all four outputs must be distinct and disjoint from p.
-
static int GetSplineArrayByteCount(Tcl_Size count, size_t elementSize, size_t *byteCountPtr)
Data records and member contracts
These records describe stored state and resource ownership. Their presence in the reference does not make private layouts part of the installed C API.
-
struct Cubic2D
Polynomial coefficients of a cubic spline segment.
-
struct CubicSpline
Parameterized cubic spline with component coefficients.
-
struct Quint2D
Polynomial coefficients of a quintic spline segment.
-
struct SplineOpSpec
Typed command dispatch entry with shared argument validation metadata.
Public Members
-
Rbc_OpSpecHeader header
Operation name, total argument bounds and usage suffix.
-
Rbc_SplineOp proc
Typed command handler for this operation.
-
Rbc_OpSpecHeader header