summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2001-03-08 17:17:28 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2001-03-08 17:17:28 +0000
commit896e8bd2d7eb1385ca89e71b7eac146577320e00 (patch)
tree6687e353985dc9ddbfabe31836616b42ce4aa4ff /src/mesa
parent417ed16a88bd6c695e9792c2023e3f1737ee1e64 (diff)
processed by indent to improve readability
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/math/m_eval.c361
1 files changed, 161 insertions, 200 deletions
diff --git a/src/mesa/math/m_eval.c b/src/mesa/math/m_eval.c
index adf5b19fec..9316625d97 100644
--- a/src/mesa/math/m_eval.c
+++ b/src/mesa/math/m_eval.c
@@ -1,4 +1,4 @@
-/* $Id: m_eval.c,v 1.3 2001/03/08 17:15:01 brianp Exp $ */
+/* $Id: m_eval.c,v 1.4 2001/03/08 17:17:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -72,32 +72,31 @@ static GLfloat inv_tab[MAX_EVAL_ORDER];
void
-_math_horner_bezier_curve(const GLfloat *cp, GLfloat *out, GLfloat t,
+_math_horner_bezier_curve(const GLfloat * cp, GLfloat * out, GLfloat t,
GLuint dim, GLuint order)
{
GLfloat s, powert, bincoeff;
GLuint i, k;
- if(order >= 2)
- {
+ if (order >= 2) {
bincoeff = (GLfloat) (order - 1);
- s = 1.0-t;
+ s = 1.0 - t;
- for(k=0; k<dim; k++)
- out[k] = s*cp[k] + bincoeff*t*cp[dim+k];
+ for (k = 0; k < dim; k++)
+ out[k] = s * cp[k] + bincoeff * t * cp[dim + k];
- for(i=2, cp+=2*dim, powert=t*t; i<order; i++, powert*=t, cp +=dim)
- {
+ for (i = 2, cp += 2 * dim, powert = t * t; i < order;
+ i++, powert *= t, cp += dim) {
bincoeff *= (GLfloat) (order - i);
bincoeff *= inv_tab[i];
- for(k=0; k<dim; k++)
- out[k] = s*out[k] + bincoeff*powert*cp[k];
+ for (k = 0; k < dim; k++)
+ out[k] = s * out[k] + bincoeff * powert * cp[k];
}
}
- else /* order=1 -> constant curve */
- {
- for(k=0; k<dim; k++)
+ else { /* order=1 -> constant curve */
+
+ for (k = 0; k < dim; k++)
out[k] = cp[k];
}
}
@@ -117,69 +116,64 @@ _math_horner_bezier_curve(const GLfloat *cp, GLfloat *out, GLfloat t,
*/
void
-_math_horner_bezier_surf(GLfloat *cn, GLfloat *out, GLfloat u, GLfloat v,
+_math_horner_bezier_surf(GLfloat * cn, GLfloat * out, GLfloat u, GLfloat v,
GLuint dim, GLuint uorder, GLuint vorder)
{
- GLfloat *cp = cn + uorder*vorder*dim;
- GLuint i, uinc = vorder*dim;
+ GLfloat *cp = cn + uorder * vorder * dim;
+ GLuint i, uinc = vorder * dim;
- if(vorder > uorder)
- {
- if(uorder >= 2)
- {
+ if (vorder > uorder) {
+ if (uorder >= 2) {
GLfloat s, poweru, bincoeff;
GLuint j, k;
/* Compute the control polygon for the surface-curve in u-direction */
- for(j=0; j<vorder; j++)
- {
- GLfloat *ucp = &cn[j*dim];
+ for (j = 0; j < vorder; j++) {
+ GLfloat *ucp = &cn[j * dim];
/* Each control point is the point for parameter u on a */
/* curve defined by the control polygons in u-direction */
bincoeff = (GLfloat) (uorder - 1);
- s = 1.0-u;
+ s = 1.0 - u;
- for(k=0; k<dim; k++)
- cp[j*dim+k] = s*ucp[k] + bincoeff*u*ucp[uinc+k];
+ for (k = 0; k < dim; k++)
+ cp[j * dim + k] = s * ucp[k] + bincoeff * u * ucp[uinc + k];
- for(i=2, ucp+=2*uinc, poweru=u*u; i<uorder;
- i++, poweru*=u, ucp +=uinc)
- {
+ for (i = 2, ucp += 2 * uinc, poweru = u * u; i < uorder;
+ i++, poweru *= u, ucp += uinc) {
bincoeff *= (GLfloat) (uorder - i);
bincoeff *= inv_tab[i];
- for(k=0; k<dim; k++)
- cp[j*dim+k] = s*cp[j*dim+k] + bincoeff*poweru*ucp[k];
+ for (k = 0; k < dim; k++)
+ cp[j * dim + k] =
+ s * cp[j * dim + k] + bincoeff * poweru * ucp[k];
}
}
/* Evaluate curve point in v */
_math_horner_bezier_curve(cp, out, v, dim, vorder);
}
- else /* uorder=1 -> cn defines a curve in v */
+ else /* uorder=1 -> cn defines a curve in v */
_math_horner_bezier_curve(cn, out, v, dim, vorder);
}
- else /* vorder <= uorder */
- {
- if(vorder > 1)
- {
+ else { /* vorder <= uorder */
+
+ if (vorder > 1) {
GLuint i;
/* Compute the control polygon for the surface-curve in u-direction */
- for(i=0; i<uorder; i++, cn += uinc)
- {
+ for (i = 0; i < uorder; i++, cn += uinc) {
/* For constant i all cn[i][j] (j=0..vorder) are located */
/* on consecutive memory locations, so we can use */
/* horner_bezier_curve to compute the control points */
- _math_horner_bezier_curve(cn, &cp[i*dim], v, dim, vorder);
+ _math_horner_bezier_curve(cn, &cp[i * dim], v, dim, vorder);
}
/* Evaluate curve point in u */
_math_horner_bezier_curve(cp, out, u, dim, uorder);
}
- else /* vorder=1 -> cn defines a curve in u */
+ else /* vorder=1 -> cn defines a curve in u */
_math_horner_bezier_curve(cn, out, u, dim, uorder);
}
}
@@ -199,15 +193,15 @@ _math_horner_bezier_surf(GLfloat *cn, GLfloat *out, GLfloat u, GLfloat v,
*/
void
-_math_de_casteljau_surf(GLfloat *cn, GLfloat *out, GLfloat *du, GLfloat *dv,
- GLfloat u, GLfloat v, GLuint dim,
+_math_de_casteljau_surf(GLfloat * cn, GLfloat * out, GLfloat * du,
+ GLfloat * dv, GLfloat u, GLfloat v, GLuint dim,
GLuint uorder, GLuint vorder)
{
- GLfloat *dcn = cn + uorder*vorder*dim;
- GLfloat us = 1.0-u, vs = 1.0-v;
+ GLfloat *dcn = cn + uorder * vorder * dim;
+ GLfloat us = 1.0 - u, vs = 1.0 - v;
GLuint h, i, j, k;
GLuint minorder = uorder < vorder ? uorder : vorder;
- GLuint uinc = vorder*dim;
+ GLuint uinc = vorder * dim;
GLuint dcuinc = vorder;
/* Each component is evaluated separately to save buffer space */
@@ -218,267 +212,234 @@ _math_de_casteljau_surf(GLfloat *cn, GLfloat *out, GLfloat *du, GLfloat *dv,
#define CN(I,J,K) cn[(I)*uinc+(J)*dim+(K)]
#define DCN(I, J) dcn[(I)*dcuinc+(J)]
- if(minorder < 3)
- {
- if(uorder==vorder)
- {
- for(k=0; k<dim; k++)
- {
+ if (minorder < 3) {
+ if (uorder == vorder) {
+ for (k = 0; k < dim; k++) {
/* Derivative direction in u */
- du[k] = vs*(CN(1,0,k) - CN(0,0,k)) +
- v*(CN(1,1,k) - CN(0,1,k));
+ du[k] = vs * (CN(1, 0, k) - CN(0, 0, k)) +
+ v * (CN(1, 1, k) - CN(0, 1, k));
/* Derivative direction in v */
- dv[k] = us*(CN(0,1,k) - CN(0,0,k)) +
- u*(CN(1,1,k) - CN(1,0,k));
+ dv[k] = us * (CN(0, 1, k) - CN(0, 0, k)) +
+ u * (CN(1, 1, k) - CN(1, 0, k));
/* bilinear de Casteljau step */
- out[k] = us*(vs*CN(0,0,k) + v*CN(0,1,k)) +
- u*(vs*CN(1,0,k) + v*CN(1,1,k));
+ out[k] = us * (vs * CN(0, 0, k) + v * CN(0, 1, k)) +
+ u * (vs * CN(1, 0, k) + v * CN(1, 1, k));
}
}
- else if(minorder == uorder)
- {
- for(k=0; k<dim; k++)
- {
+ else if (minorder == uorder) {
+ for (k = 0; k < dim; k++) {
/* bilinear de Casteljau step */
- DCN(1,0) = CN(1,0,k) - CN(0,0,k);
- DCN(0,0) = us*CN(0,0,k) + u*CN(1,0,k);
+ DCN(1, 0) = CN(1, 0, k) - CN(0, 0, k);
+ DCN(0, 0) = us * CN(0, 0, k) + u * CN(1, 0, k);
- for(j=0; j<vorder-1; j++)
- {
+ for (j = 0; j < vorder - 1; j++) {
/* for the derivative in u */
- DCN(1,j+1) = CN(1,j+1,k) - CN(0,j+1,k);
- DCN(1,j) = vs*DCN(1,j) + v*DCN(1,j+1);
+ DCN(1, j + 1) = CN(1, j + 1, k) - CN(0, j + 1, k);
+ DCN(1, j) = vs * DCN(1, j) + v * DCN(1, j + 1);
/* for the `point' */
- DCN(0,j+1) = us*CN(0,j+1,k) + u*CN(1,j+1,k);
- DCN(0,j) = vs*DCN(0,j) + v*DCN(0,j+1);
+ DCN(0, j + 1) = us * CN(0, j + 1, k) + u * CN(1, j + 1, k);
+ DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1);
}
/* remaining linear de Casteljau steps until the second last step */
- for(h=minorder; h<vorder-1; h++)
- for(j=0; j<vorder-h; j++)
- {
+ for (h = minorder; h < vorder - 1; h++)
+ for (j = 0; j < vorder - h; j++) {
/* for the derivative in u */
- DCN(1,j) = vs*DCN(1,j) + v*DCN(1,j+1);
+ DCN(1, j) = vs * DCN(1, j) + v * DCN(1, j + 1);
/* for the `point' */
- DCN(0,j) = vs*DCN(0,j) + v*DCN(0,j+1);
+ DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1);
}
/* derivative direction in v */
- dv[k] = DCN(0,1) - DCN(0,0);
+ dv[k] = DCN(0, 1) - DCN(0, 0);
/* derivative direction in u */
- du[k] = vs*DCN(1,0) + v*DCN(1,1);
+ du[k] = vs * DCN(1, 0) + v * DCN(1, 1);
/* last linear de Casteljau step */
- out[k] = vs*DCN(0,0) + v*DCN(0,1);
+ out[k] = vs * DCN(0, 0) + v * DCN(0, 1);
}
}
- else /* minorder == vorder */
- {
- for(k=0; k<dim; k++)
- {
+ else { /* minorder == vorder */
+
+ for (k = 0; k < dim; k++) {
/* bilinear de Casteljau step */
- DCN(0,1) = CN(0,1,k) - CN(0,0,k);
- DCN(0,0) = vs*CN(0,0,k) + v*CN(0,1,k);
- for(i=0; i<uorder-1; i++)
- {
+ DCN(0, 1) = CN(0, 1, k) - CN(0, 0, k);
+ DCN(0, 0) = vs * CN(0, 0, k) + v * CN(0, 1, k);
+ for (i = 0; i < uorder - 1; i++) {
/* for the derivative in v */
- DCN(i+1,1) = CN(i+1,1,k) - CN(i+1,0,k);
- DCN(i,1) = us*DCN(i,1) + u*DCN(i+1,1);
+ DCN(i + 1, 1) = CN(i + 1, 1, k) - CN(i + 1, 0, k);
+ DCN(i, 1) = us * DCN(i, 1) + u * DCN(i + 1, 1);
/* for the `point' */
- DCN(i+1,0) = vs*CN(i+1,0,k) + v*CN(i+1,1,k);
- DCN(i,0) = us*DCN(i,0) + u*DCN(i+1,0);
+ DCN(i + 1, 0) = vs * CN(i + 1, 0, k) + v * CN(i + 1, 1, k);
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
}
/* remaining linear de Casteljau steps until the second last step */
- for(h=minorder; h<uorder-1; h++)
- for(i=0; i<uorder-h; i++)
- {
+ for (h = minorder; h < uorder - 1; h++)
+ for (i = 0; i < uorder - h; i++) {
/* for the derivative in v */
- DCN(i,1) = us*DCN(i,1) + u*DCN(i+1,1);
+ DCN(i, 1) = us * DCN(i, 1) + u * DCN(i + 1, 1);
/* for the `point' */
- DCN(i,0) = us*DCN(i,0) + u*DCN(i+1,0);
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
}
/* derivative direction in u */
- du[k] = DCN(1,0) - DCN(0,0);
+ du[k] = DCN(1, 0) - DCN(0, 0);
/* derivative direction in v */
- dv[k] = us*DCN(0,1) + u*DCN(1,1);
+ dv[k] = us * DCN(0, 1) + u * DCN(1, 1);
/* last linear de Casteljau step */
- out[k] = us*DCN(0,0) + u*DCN(1,0);
+ out[k] = us * DCN(0, 0) + u * DCN(1, 0);
}
}
}
- else if(uorder == vorder)
- {
- for(k=0; k<dim; k++)
- {
+ else if (uorder == vorder) {
+ for (k = 0; k < dim; k++) {
/* first bilinear de Casteljau step */
- for(i=0; i<uorder-1; i++)
- {
- DCN(i,0) = us*CN(i,0,k) + u*CN(i+1,0,k);
- for(j=0; j<vorder-1; j++)
- {
- DCN(i,j+1) = us*CN(i,j+1,k) + u*CN(i+1,j+1,k);
- DCN(i,j) = vs*DCN(i,j) + v*DCN(i,j+1);
+ for (i = 0; i < uorder - 1; i++) {
+ DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k);
+ for (j = 0; j < vorder - 1; j++) {
+ DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k);
+ DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1);
}
}
/* remaining bilinear de Casteljau steps until the second last step */
- for(h=2; h<minorder-1; h++)
- for(i=0; i<uorder-h; i++)
- {
- DCN(i,0) = us*DCN(i,0) + u*DCN(i+1,0);
- for(j=0; j<vorder-h; j++)
- {
- DCN(i,j+1) = us*DCN(i,j+1) + u*DCN(i+1,j+1);
- DCN(i,j) = vs*DCN(i,j) + v*DCN(i,j+1);
+ for (h = 2; h < minorder - 1; h++)
+ for (i = 0; i < uorder - h; i++) {
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
+ for (j = 0; j < vorder - h; j++) {
+ DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1);
+ DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1);
}
}
/* derivative direction in u */
- du[k] = vs*(DCN(1,0) - DCN(0,0)) +
- v*(DCN(1,1) - DCN(0,1));
+ du[k] = vs * (DCN(1, 0) - DCN(0, 0)) + v * (DCN(1, 1) - DCN(0, 1));
/* derivative direction in v */
- dv[k] = us*(DCN(0,1) - DCN(0,0)) +
- u*(DCN(1,1) - DCN(1,0));
+ dv[k] = us * (DCN(0, 1) - DCN(0, 0)) + u * (DCN(1, 1) - DCN(1, 0));
/* last bilinear de Casteljau step */
- out[k] = us*(vs*DCN(0,0) + v*DCN(0,1)) +
- u*(vs*DCN(1,0) + v*DCN(1,1));
+ out[k] = us * (vs * DCN(0, 0) + v * DCN(0, 1)) +
+ u * (vs * DCN(1, 0) + v * DCN(1, 1));
}
}
- else if(minorder == uorder)
- {
- for(k=0; k<dim; k++)
- {
+ else if (minorder == uorder) {
+ for (k = 0; k < dim; k++) {
/* first bilinear de Casteljau step */
- for(i=0; i<uorder-1; i++)
- {
- DCN(i,0) = us*CN(i,0,k) + u*CN(i+1,0,k);
- for(j=0; j<vorder-1; j++)
- {
- DCN(i,j+1) = us*CN(i,j+1,k) + u*CN(i+1,j+1,k);
- DCN(i,j) = vs*DCN(i,j) + v*DCN(i,j+1);
+ for (i = 0; i < uorder - 1; i++) {
+ DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k);
+ for (j = 0; j < vorder - 1; j++) {
+ DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k);
+ DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1);
}
}
/* remaining bilinear de Casteljau steps until the second last step */
- for(h=2; h<minorder-1; h++)
- for(i=0; i<uorder-h; i++)
- {
- DCN(i,0) = us*DCN(i,0) + u*DCN(i+1,0);
- for(j=0; j<vorder-h; j++)
- {
- DCN(i,j+1) = us*DCN(i,j+1) + u*DCN(i+1,j+1);
- DCN(i,j) = vs*DCN(i,j) + v*DCN(i,j+1);
+ for (h = 2; h < minorder - 1; h++)
+ for (i = 0; i < uorder - h; i++) {
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
+ for (j = 0; j < vorder - h; j++) {
+ DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1);
+ DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1);
}
}
/* last bilinear de Casteljau step */
- DCN(2,0) = DCN(1,0) - DCN(0,0);
- DCN(0,0) = us*DCN(0,0) + u*DCN(1,0);
- for(j=0; j<vorder-1; j++)
- {
+ DCN(2, 0) = DCN(1, 0) - DCN(0, 0);
+ DCN(0, 0) = us * DCN(0, 0) + u * DCN(1, 0);
+ for (j = 0; j < vorder - 1; j++) {
/* for the derivative in u */
- DCN(2,j+1) = DCN(1,j+1) - DCN(0,j+1);
- DCN(2,j) = vs*DCN(2,j) + v*DCN(2,j+1);
-
+ DCN(2, j + 1) = DCN(1, j + 1) - DCN(0, j + 1);
+ DCN(2, j) = vs * DCN(2, j) + v * DCN(2, j + 1);
+
/* for the `point' */
- DCN(0,j+1) = us*DCN(0,j+1 ) + u*DCN(1,j+1);
- DCN(0,j) = vs*DCN(0,j) + v*DCN(0,j+1);
+ DCN(0, j + 1) = us * DCN(0, j + 1) + u * DCN(1, j + 1);
+ DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1);
}
/* remaining linear de Casteljau steps until the second last step */
- for(h=minorder; h<vorder-1; h++)
- for(j=0; j<vorder-h; j++)
- {
+ for (h = minorder; h < vorder - 1; h++)
+ for (j = 0; j < vorder - h; j++) {
/* for the derivative in u */
- DCN(2,j) = vs*DCN(2,j) + v*DCN(2,j+1);
-
+ DCN(2, j) = vs * DCN(2, j) + v * DCN(2, j + 1);
+
/* for the `point' */
- DCN(0,j) = vs*DCN(0,j) + v*DCN(0,j+1);
+ DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1);
}
/* derivative direction in v */
- dv[k] = DCN(0,1) - DCN(0,0);
+ dv[k] = DCN(0, 1) - DCN(0, 0);
/* derivative direction in u */
- du[k] = vs*DCN(2,0) + v*DCN(2,1);
+ du[k] = vs * DCN(2, 0) + v * DCN(2, 1);
/* last linear de Casteljau step */
- out[k] = vs*DCN(0,0) + v*DCN(0,1);
+ out[k] = vs * DCN(0, 0) + v * DCN(0, 1);
}
}
- else /* minorder == vorder */
- {
- for(k=0; k<dim; k++)
- {
+ else { /* minorder == vorder */
+
+ for (k = 0; k < dim; k++) {
/* first bilinear de Casteljau step */
- for(i=0; i<uorder-1; i++)
- {
- DCN(i,0) = us*CN(i,0,k) + u*CN(i+1,0,k);
- for(j=0; j<vorder-1; j++)
- {
- DCN(i,j+1) = us*CN(i,j+1,k) + u*CN(i+1,j+1,k);
- DCN(i,j) = vs*DCN(i,j) + v*DCN(i,j+1);
+ for (i = 0; i < uorder - 1; i++) {
+ DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k);
+ for (j = 0; j < vorder - 1; j++) {
+ DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k);
+ DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1);
}
}
/* remaining bilinear de Casteljau steps until the second last step */
- for(h=2; h<minorder-1; h++)
- for(i=0; i<uorder-h; i++)
- {
- DCN(i,0) = us*DCN(i,0) + u*DCN(i+1,0);
- for(j=0; j<vorder-h; j++)
- {
- DCN(i,j+1) = us*DCN(i,j+1) + u*DCN(i+1,j+1);
- DCN(i,j) = vs*DCN(i,j) + v*DCN(i,j+1);
+ for (h = 2; h < minorder - 1; h++)
+ for (i = 0; i < uorder - h; i++) {
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
+ for (j = 0; j < vorder - h; j++) {
+ DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1);
+ DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1);
}
}
/* last bilinear de Casteljau step */
- DCN(0,2) = DCN(0,1) - DCN(0,0);
- DCN(0,0) = vs*DCN(0,0) + v*DCN(0,1);
- for(i=0; i<uorder-1; i++)
- {
+ DCN(0, 2) = DCN(0, 1) - DCN(0, 0);
+ DCN(0, 0) = vs * DCN(0, 0) + v * DCN(0, 1);
+ for (i = 0; i < uorder - 1; i++) {
/* for the derivative in v */
- DCN(i+1,2) = DCN(i+1,1) - DCN(i+1,0);
- DCN(i,2) = us*DCN(i,2) + u*DCN(i+1,2);
-
+ DCN(i + 1, 2) = DCN(i + 1, 1) - DCN(i + 1, 0);
+ DCN(i, 2) = us * DCN(i, 2) + u * DCN(i + 1, 2);
+
/* for the `point' */
- DCN(i+1,0) = vs*DCN(i+1,0) + v*DCN(i+1,1);
- DCN(i,0) = us*DCN(i,0) + u*DCN(i+1,0);
+ DCN(i + 1, 0) = vs * DCN(i + 1, 0) + v * DCN(i + 1, 1);
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
}
/* remaining linear de Casteljau steps until the second last step */
- for(h=minorder; h<uorder-1; h++)
- for(i=0; i<uorder-h; i++)
- {
+ for (h = minorder; h < uorder - 1; h++)
+ for (i = 0; i < uorder - h; i++) {
/* for the derivative in v */
- DCN(i,2) = us*DCN(i,2) + u*DCN(i+1,2);
-
+ DCN(i, 2) = us * DCN(i, 2) + u * DCN(i + 1, 2);
+
/* for the `point' */
- DCN(i,0) = us*DCN(i,0) + u*DCN(i+1,0);
+ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0);
}
/* derivative direction in u */
- du[k] = DCN(1,0) - DCN(0,0);
+ du[k] = DCN(1, 0) - DCN(0, 0);
/* derivative direction in v */
- dv[k] = us*DCN(0,2) + u*DCN(1,2);
+ dv[k] = us * DCN(0, 2) + u * DCN(1, 2);
/* last linear de Casteljau step */
- out[k] = us*DCN(0,0) + u*DCN(1,0);
+ out[k] = us * DCN(0, 0) + u * DCN(1, 0);
}
}
#undef DCN
@@ -489,13 +450,13 @@ _math_de_casteljau_surf(GLfloat *cn, GLfloat *out, GLfloat *du, GLfloat *dv,
/*
* Do one-time initialization for evaluators.
*/
-void _math_init_eval( void )
+void
+_math_init_eval(void)
{
GLuint i;
/* KW: precompute 1/x for useful x.
*/
- for (i = 1 ; i < MAX_EVAL_ORDER ; i++)
+ for (i = 1; i < MAX_EVAL_ORDER; i++)
inv_tab[i] = 1.0 / i;
}
-