- initial import
git-svn-id: http://moon:8086/svn/mips@1 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#include "ri.h"
|
||||
#include "patches.h"
|
||||
|
||||
#define NU 13
|
||||
#define MAXNPTS 100
|
||||
#define F .5522847
|
||||
|
||||
/* Listing 6.3 Version of SurfOR() taking profile points */
|
||||
/* and producing a bicubic */
|
||||
float coeff[NU][2] = {
|
||||
{ 1, 0 }, { 1, F }, { F, 1 }, { 0, 1 }, {-F, 1 }, {-1, F },
|
||||
{-1, 0 }, {-1,-F }, {-F,-1 }, { 0,-1 }, { F,-1 }, { 1,-F }, { 1, 0} };
|
||||
|
||||
RtPoint mesh[MAXNPTS][NU];
|
||||
|
||||
void SurfOR(Point2D points[], int npoints)
|
||||
{
|
||||
int u, v;
|
||||
|
||||
/* coeff holds a matrix of coefficients for sweeping a point on the XZ
|
||||
* plane circularly around the Z axis, with the circle approximated by
|
||||
* 4 Bezier curves
|
||||
*/
|
||||
for (v = 0; v < npoints; v++) {
|
||||
/*
|
||||
* Start at the upper left of the mesh. For each
|
||||
* control point on the circle being swept out,
|
||||
* rotate every point on the XZ curve into position
|
||||
*/
|
||||
for (u = 0; u < NU; u++) {
|
||||
/* Here comes each point on the XZ curve */
|
||||
mesh[v][u][0] = points[v].x * coeff[u][0];
|
||||
mesh[v][u][1] = points[v].x * coeff[u][1];
|
||||
mesh[v][u][2] = points[v].y;
|
||||
}
|
||||
}
|
||||
// RiBasis(RiPowerBasis, RI_POWERSTEP, RiPowerBasis, RI_POWERSTEP);
|
||||
// RiBasis(RiHermiteBasis, RI_HERMITESTEP, RiHermiteBasis, RI_HERMITESTEP);
|
||||
// RiBasis(RiCatmullRomBasis, RI_CATMULLROMSTEP, RiCatmullRomBasis, RI_CATMULLROMSTEP);
|
||||
// RiBasis(RiBSplineBasis, RI_BSPLINESTEP, RiBSplineBasis, RI_BSPLINESTEP);
|
||||
RiBasis(RiBezierBasis, RI_BEZIERSTEP, RiBezierBasis, RI_BEZIERSTEP);
|
||||
RiPatchMesh(RI_BICUBIC,
|
||||
(RtInt) NU, RI_NONPERIODIC,
|
||||
(RtInt) npoints, RI_NONPERIODIC,
|
||||
RI_P, (RtPointer) mesh,
|
||||
RI_NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user