gCAD3D 2.40
ut_bsp_approx.c File Reference

Approximation Polygon -> B-Spline. More...

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../ut/ut_geo.h"
#include "../ut/ut_math.h"
#include "../ut/ut_bspl.h"
#include "../ut/ut_plg.h"

Functions

int UT3D_bsp_pta__ (CurvBSpl *cvo, int ptNr, Point *pTab, double tol, Memspc *memSeg, Memspc *workSeg)
 
int UT3D_bspl_l2appr (CurvBSpl *crv, Memspc *memSeg, int np, Point *pTab, int xy, int deg, int ptNr, Memspc *workSeg)
 
int UT3D_bspl_1Dl2appr (double *bcoef, int ntau, double *tau, double *gtau, double *weight, int k, int n, double *t, Memspc *workSeg)
 
int UT3D_bspl_evBas (double *biatx, double *t, int jhigh, int index, double x, int left)
 

Detailed Description

Approximation Polygon -> B-Spline.

=====================================================
List_functions_start:
UT3D_bsp_pta__ BSP-Curve from polygon (Approximation)
UT3D_bspl_l2appr l2-approximating bspline-curve
UT3D_bspl_1Dl2appr l2-approximating 1D-bspline-curve
UT3D_bspl_evBas basis-bspline-values
List_functions_end:
=====================================================

Function Documentation

int UT3D_bsp_pta__ ( CurvBSpl cvo,
int  ptNr,
Point pTab,
double  tol,
Memspc memSeg,
Memspc workSeg 
)

UT3D_bsp_pta__ approximante polygon to b-spline-curve.

int UT3D_bspl_l2appr ( CurvBSpl crv,
Memspc memSeg,
int  np,
Point pTab,
int  xy,
int  deg,
int  ptNr,
Memspc workSeg 
)
* UT3D_bspl_l2appr l2-approximating bspline-curve
*
* Computation of a bspline-curve least-square-approximating a series
* of 3D-points.
* If the number of input points equals the number of controlpoints
* of the curve, the curve is INTERPOLATING the input points.
*
* IN:
* int np ... number of points to approximate
* Point *pTab ... array of points to approximate
* int xy ... =1: use only x- and y-component of points
* int deg ... desired degree of bspline-curve (<20 !)
* int ptNr ... desired number of controlpoints of bspline-curve
* Memspc *workSeg ... temporary workspace
* OUT:
* CurvBSpl *crv ... approximating bspline-curve
* Memspc *memSeg ... space for bspline-curve
* Returncodes:
* 0 = OK
* -1 = out of space
* -2 = out of work space
* -3 = internal error
*
int UT3D_bspl_1Dl2appr ( double *  bcoef,
int  ntau,
double *  tau,
double *  gtau,
double *  weight,
int  k,
int  n,
double *  t,
Memspc workSeg 
)
* UT3D_bspl_1Dl2appr l2-approximating 1D-bspline-curve
*
* Computation of a 1D-bspline-curve which is least-square-approximating a
* given series of data points.
* ATTENTION: space for bcoef must be provided by the calling function !
*
* IN:
* int ntau ... number of data points
* double *tau ... parameter values of data points within interval
* [t[k-1],t[n]] and strongly increasing.
* double *gtau ... data points
* double *weight ... positiv weights for data points
* int k ... order of bspline curve (= degree+1)
* (must be <= 20 !)
* int n ... number of controlpoints of bspline curve
* double *t ... knotvector t[0],...,t[n+k-1] of bspline curve
* Memspc *workSeg ... temporary workspace
* OUT:
* double *bcoef ... "1D-controlpoints" of bspline curve
* (length = n)
* Returncodes:
* 0 = OK
* -1 = out of work space
* -2 = internal error
*
int UT3D_bspl_evBas ( double *  biatx,
double *  t,
int  jhigh,
int  index,
double  x,
int  left 
)
* UT3D_bspl_evBas basis-bspline-values
*
* Computation of all possibly nonzero basis-bspline-values at x of order
* jout = max(jhigh, (j+2)*(index-1)) with knotvector t.
* In general the function will be called with jhigh = order = degree+1
* of the basis-bspline-curves and with index = 1.
*
* IN:
* double *t ... knotvector of bspline curve
* int jhigh, index ... to determine the order jout
* double x ... parameter value
* int left ... such that x in [t[left-1],t[left])
* OUT:
* double *biatx ... basis-bspline-values at x of order jout
* (number = jout)
* Returncode:
* 0 = OK
*