Definition in file bezier.h.
#include <config.h>
Go to the source code of this file.
Functions | |
| void | bezier (int npts, SUMOReal b[], int cpts, SUMOReal p[]) |
| void bezier | ( | int | npts, | |
| SUMOReal | b[], | |||
| int | cpts, | |||
| SUMOReal | p[] | |||
| ) |
Definition at line 107 of file bezier.cpp.
References Basis(), factrl(), Ni(), and SUMOReal.
Referenced by NBNode::computeInternalLaneShape().
00107 { 00108 int i; 00109 int j; 00110 int i1; 00111 int icount; 00112 int jcount; 00113 00114 SUMOReal step; 00115 SUMOReal t; 00116 00117 SUMOReal factrl(int); 00118 SUMOReal Ni(int,int); 00119 SUMOReal Basis(int,int,SUMOReal); 00120 00121 /* calculate the points on the Bezier curve */ 00122 00123 icount = 0; 00124 t = 0; 00125 step = (SUMOReal) 1.0/(cpts -1); 00126 00127 for (i1 = 1; i1<=cpts; i1++) { /* main loop */ 00128 00129 if ((1.0 - t) < 5e-6) t = 1.0; 00130 00131 for (j = 1; j <= 3; j++) { /* generate a point on the curve */ 00132 jcount = j; 00133 p[icount+j] = 0.; 00134 for (i = 1; i <= npts; i++) { /* Do x,y,z components */ 00135 p[icount + j] = p[icount + j] + Basis(npts-1,i-1,t)*b[jcount]; 00136 jcount = jcount + 3; 00137 } 00138 } 00139 00140 icount = icount + 3; 00141 t = t + step; 00142 } 00143 }
1.5.6