NURBS in OpenVX

 

For the remainder of this section let us assume that zCrv is a local structure of type VsNurbCurv.
 

In OpenVX the use of weights is optional. If (zCrv.cp.rat == 0) OpenVX assumes the curve is non-rational and that weights are NOT included otherwise it assumes they are. If weights are given then they occur are stored with their associated control point in a "homogeneous coordinate" format. This means that if a weight W is associated with the coordinate (X,Y,Z) then we store it as (W*X, W*Y, W*Z, W). Note that the weight becomes an extra coordinate to the control point ( { (x0,y0,z0,w0), (x1,y1,z1,w1), ..., (xn,yn,zn,wn) } ). The value of zCrv.cp.dim includes the weight as a coordinate.
 

zCrv.t.knots points to the curves knot vector. zCrv.t.bnd.min and zCrv.t.bnd.max define the portion of the parameter space the makes up the curve.
 

 

0331.gifIf N is the index of the last knot value, then

zCrv.t.knots[0] <= zCrv.t.bnd.min < zCrv.t.bnd.max <= zCrv.t.knots[N]

 

That is, the maximum parameter space values are determined by the first and last knot [ zCrv.t.knots[0], zCrv.t.knots[N] ]. But our curve may only need a small sub portion of this domain.
 

Even though we have separate pointers, zCrv.t.knots (for knot data) and zCrv.cp.list (for homogeneous control point data), most of the OpenVX utilities assume that these areas were created with a single dynamic allocation, knot values occurring before the control point data. If you use the included OpenVX utilities this will be done automatically for you, otherwise you should be careful to do this yourself. For the example above the single area would contain the following data:
 

double aGeomDat[48] = { 0, 0, 0, 0.25, 0.25, 0.5, 0.5,

0.75, 0.75, 1, 1, 1, 10,0,0,1, 7.071,-7.071,0,0.7071,0,-10,

0,1, -7.071,-7.071,0,0.7071, -10,0,0,1, -7.071,7.071,0,0.7071,

0,10,0,1, 7.071,7.071,0,0.7071, 10,0,0,1 }

 

and zCrv.t.knots = aGeomDat, zCrv.cp.list = aGeomDat + 12.

 

 

The following utilities should be useful:
 

 

AllocNurbKntCP()

function to do dynamic allocation and assign pointers. VmCurvDeallocGeomData() - macro to free geom data.

VmCurvDealloc()

macro to free geom data and curve structure.

VmParmBnds()

macro to get absolute upper and lower bounds of parameter space.

VmIthControlPoint()

macro to get Ith control point (non homogeneous format).

Return to VX CAD/CAM Index