::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? ?-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; defaults to 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 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.-output list|vector:Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to 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.
Vector names resolve in the caller’s namespace; destination namespaces must already exist. Each unnamed
output, including fields omitted from -names, is created with ::rbc::vector create #auto. 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 by default 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? ?-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; defaults to 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 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.-output list|vector:Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to 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.
Vector names resolve in the caller’s namespace; destination namespaces must already exist. Each unnamed
output, including fields omitted from -names, is created with ::rbc::vector create #auto. 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 by default 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? ?-name name? ?-names dictionary? ?-ifexists error|replace?
Parameters
-ifexists error|replace:Policy for existing destination vectors; defaults to 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 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.-output list|vector:Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to 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.
Vector names resolve in the caller’s namespace; destination namespaces must already exist. Each unnamed
output, including fields omitted from -names, is created with ::rbc::vector create #auto. 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 by default 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? ?-name name? ?-names dictionary? ?-ifexists error|replace?
Parameters
-ifexists error|replace:Policy for existing destination vectors; defaults to 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 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.-output list|vector:Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to 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.
Vector names resolve in the caller’s namespace; destination namespaces must already exist. Each unnamed
output, including fields omitted from -names, is created with ::rbc::vector create #auto. 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 by default or an
RBC vector name with -output vector.
Copyright (c) George Yashin