::tclinterp::approximation¶
Commands¶
bezier¶
Evaluates a Bezier polynomial on an interval.
bezier -n integer -a value -b value -x values -y values ?-input list|vector? ?-output list|vector? ?-namespace name? ?-name name? ?-names dictionary? ?-ifexists error|replace?
Parameters
-a value:Start of the interval; must differ from -b.
-b value:End of the interval; must differ from -a.
-ifexists error|replace:Policy for existing destination vectors; uses the package default (initially error). With replace, an existing real vector is resized and overwritten.
-input list|vector:Input representation for all array arguments: Tcl lists or real RBC vector names. Defaults to the package setting (initially list).
-n integer:Polynomial degree; must be zero or greater.
-name name:Destination vector name for yi; requires -output vector. Omit it or use #auto to create an automatically named vector.
-names dictionary:Dictionary mapping output fields to destination vector names; requires -output vector. Valid fields:
yi.-namespace name:Destination namespace for vector output; relative to the caller, created with missing parents.
-output list|vector:Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to the package setting (initially list); independent of -input.
-x values:Evaluation positions; must not be empty.
-y values:Control values; exactly n+1 values.
Description
Every array argument marked values uses the representation selected by -input. Scalar options remain
ordinary Tcl numbers. Numeric inputs must be finite. RBC support must be enabled in the build to use
vectors.
Omitted -input, -output and -ifexists use ::tclinterp::configure defaults at call time. Explicit options take precedence. Input vector names resolve in the caller’s namespace. Output names use -namespace, or the caller’s namespace when omitted. Empty namespace names are rejected; -namespace requires -output vector. Fully qualified output names override this location; their parent namespace must already exist. Each unnamed output, including fields omitted from -names, uses RBC’s #auto mechanism in the selected namespace. A final #auto component also works in qualified names; auto without # is an ordinary name. Returned vector names are fully qualified.
Do not specify both -name and the yi entry of -names. Unknown output fields and duplicate destinations
are errors. The caller owns returned vectors and can release them with ::rbc::vector destroy
$vectorName.
Return value
The interpolated values yi, as a Tcl list with list output or an RBC vector name with -output
vector.
cubicBetaSpline1d¶
Evaluates a cubic beta-spline approximant.
cubicBetaSpline1d -beta1 value -beta2 value -t values -y values -ti values ?-input list|vector? ?-output list|vector? ?-namespace name? ?-name name? ?-names dictionary? ?-ifexists error|replace?
Parameters
-beta1 value:Required skew or bias parameter; 1 means no skew or bias.
-beta2 value:Required tension parameter; 0 means no tension.
-ifexists error|replace:Policy for existing destination vectors; uses the package default (initially error). With replace, an existing real vector is resized and overwritten.
-input list|vector:Input representation for all array arguments: Tcl lists or real RBC vector names. Defaults to the package setting (initially list).
-name name:Destination vector name for yi; requires -output vector. Omit it or use #auto to create an automatically named vector.
-names dictionary:Dictionary mapping output fields to destination vector names; requires -output vector. Valid fields:
yi.-namespace name:Destination namespace for vector output; relative to the caller, created with missing parents.
-output list|vector:Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to the package setting (initially list); independent of -input.
-t values:Strictly increasing sample positions; at least two values. Alias: -x.
-ti values:Evaluation positions; must not be empty. Alias: -xi.
-y values:Sample values; must have the same length as -t.
Description
Every array argument marked values uses the representation selected by -input. Scalar options remain
ordinary Tcl numbers. Numeric inputs must be finite. RBC support must be enabled in the build to use
vectors.
Omitted -input, -output and -ifexists use ::tclinterp::configure defaults at call time. Explicit options take precedence. Input vector names resolve in the caller’s namespace. Output names use -namespace, or the caller’s namespace when omitted. Empty namespace names are rejected; -namespace requires -output vector. Fully qualified output names override this location; their parent namespace must already exist. Each unnamed output, including fields omitted from -names, uses RBC’s #auto mechanism in the selected namespace. A final #auto component also works in qualified names; auto without # is an ordinary name. Returned vector names are fully qualified.
Do not specify both -name and the yi entry of -names. Unknown output fields and duplicate destinations
are errors. The caller owns returned vectors and can release them with ::rbc::vector destroy
$vectorName.
The parameters must produce a finite, nonzero beta-spline normalization.
Return value
The approximated values yi, as a Tcl list with list output or an RBC vector name with -output
vector.
cubicBSpline1d¶
Evaluates a cubic B-spline approximant.
cubicBSpline1d -t values -y values -ti values ?-input list|vector? ?-output list|vector? ?-namespace name? ?-name name? ?-names dictionary? ?-ifexists error|replace?
Parameters
-ifexists error|replace:Policy for existing destination vectors; uses the package default (initially error). With replace, an existing real vector is resized and overwritten.
-input list|vector:Input representation for all array arguments: Tcl lists or real RBC vector names. Defaults to the package setting (initially list).
-name name:Destination vector name for yi; requires -output vector. Omit it or use #auto to create an automatically named vector.
-names dictionary:Dictionary mapping output fields to destination vector names; requires -output vector. Valid fields:
yi.-namespace name:Destination namespace for vector output; relative to the caller, created with missing parents.
-output list|vector:Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to the package setting (initially list); independent of -input.
-t values:Strictly increasing sample positions; at least two values. Alias: -x.
-ti values:Evaluation positions; must not be empty. Alias: -xi.
-y values:Sample values; must have the same length as -t.
Description
Every array argument marked values uses the representation selected by -input. Scalar options remain
ordinary Tcl numbers. Numeric inputs must be finite. RBC support must be enabled in the build to use
vectors.
Omitted -input, -output and -ifexists use ::tclinterp::configure defaults at call time. Explicit options take precedence. Input vector names resolve in the caller’s namespace. Output names use -namespace, or the caller’s namespace when omitted. Empty namespace names are rejected; -namespace requires -output vector. Fully qualified output names override this location; their parent namespace must already exist. Each unnamed output, including fields omitted from -names, uses RBC’s #auto mechanism in the selected namespace. A final #auto component also works in qualified names; auto without # is an ordinary name. Returned vector names are fully qualified.
Do not specify both -name and the yi entry of -names. Unknown output fields and duplicate destinations
are errors. The caller owns returned vectors and can release them with ::rbc::vector destroy
$vectorName.
Return value
The approximated values yi, as a Tcl list with list output or an RBC vector name with -output
vector.
genBezier¶
Evaluates a parametric Bezier curve.
genBezier -n integer -x values -y values -t values ?-input list|vector? ?-output list|vector? ?-namespace name? ?-name name? ?-names dictionary? ?-ifexists error|replace?
Parameters
-ifexists error|replace:Policy for existing destination vectors; uses the package default (initially error). With replace, an existing real vector is resized and overwritten.
-input list|vector:Input representation for all array arguments: Tcl lists or real RBC vector names. Defaults to the package setting (initially list).
-n integer:Curve degree; must be zero or greater.
-name name:Destination vector name for yi; requires -output vector. Omit it or use #auto to create an automatically named vector.
-names dictionary:Dictionary mapping output fields to destination vector names; requires -output vector. Valid fields:
xi,yi.-namespace name:Destination namespace for vector output; relative to the caller, created with missing parents.
-output list|vector:Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to the package setting (initially list); independent of -input.
-t values:Nonempty evaluation parameters; normally between 0 and 1.
-x values:X control coordinates; exactly n+1 values.
-y values:Y control coordinates; exactly n+1 values.
Description
Every array argument marked values uses the representation selected by -input. Scalar options remain
ordinary Tcl numbers. Numeric inputs must be finite. RBC support must be enabled in the build to use
vectors.
Omitted -input, -output and -ifexists use ::tclinterp::configure defaults at call time. Explicit options take precedence. Input vector names resolve in the caller’s namespace. Output names use -namespace, or the caller’s namespace when omitted. Empty namespace names are rejected; -namespace requires -output vector. Fully qualified output names override this location; their parent namespace must already exist. Each unnamed output, including fields omitted from -names, uses RBC’s #auto mechanism in the selected namespace. A final #auto component also works in qualified names; auto without # is an ordinary name. Returned vector names are fully qualified.
Do not specify both -name and the yi entry of -names. Unknown output fields and duplicate destinations
are errors. The caller owns returned vectors and can release them with ::rbc::vector destroy
$vectorName.
Return value
A dictionary with xi and yi coordinates. Each numeric array is a Tcl list with list output or an
RBC vector name with -output vector.
Copyright (c) George Yashin