/[gzz]/gzz/gfx/librenderables/renderables.py
ViewVC logotype

Diff of /gzz/gfx/librenderables/renderables.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.143 by jvk, Wed Nov 13 16:28:44 2002 UTC revision 1.144 by jvk, Wed Nov 13 16:41:37 2002 UTC
# Line 1308  rs = [ Line 1308  rs = [
1308                  }                  }
1309                  return v;                  return v;
1310              }              }
1311                double power(double x, double y) {
1312                    return x < 0 ? -pow(-x,y) : pow(x,y);
1313                }
1314      """,      """,
1315      "ParamCode" : """      "ParamCode" : """
1316              this->shape = shape;              this->shape = shape;
# Line 1332  rs = [ Line 1335  rs = [
1335          // XXX: TODO: use coords1.nonlinearity()          // XXX: TODO: use coords1.nonlinearity()
1336          int n = (int)(36 * dicefactor);          int n = (int)(36 * dicefactor);
1337          std::vector<ZPt> vert(n+1);          std::vector<ZPt> vert(n+1);
1338    
1339                    
1340          switch (shape) {          switch (shape) {
1341          case 1:          case 1:
# Line 1348  rs = [ Line 1352  rs = [
1352                  vert[i] = coords2.transform(ZPt(cos(a), sin(a), 0));                  vert[i] = coords2.transform(ZPt(cos(a), sin(a), 0));
1353              }              }
1354              break;              break;
1355          case 7:          case 7: {
1356              n = 4;              n = 4;
1357              float t = 1/sqrt(2);              float t = 1/sqrt(2);
1358              vert[0] = coords2.transform(ZPt(+t, -t, 0));              vert[0] = coords2.transform(ZPt(+t, -t, 0));
1359              vert[1] = coords2.transform(ZPt(+t, +t, 0));              vert[1] = coords2.transform(ZPt(+t, +t, 0));
1360              vert[2] = coords2.transform(ZPt(-t, +t, 0));              vert[2] = coords2.transform(ZPt(-t, +t, 0));
1361              vert[3] = coords2.transform(ZPt(-t, -t, 0));              vert[3] = coords2.transform(ZPt(-t, -t, 0));
1362                }
1363                break;
1364            case 8:
1365            case 9:
1366            case 10:
1367            case 11: {
1368                float pow = 4 + (shape - 8) * 2;
1369                pow = 2 / pow;
1370                for (int i = 0; i < n; i++) {
1371                    float a = i * 2*M_PI / n;
1372                    vert[i] = coords2.transform(ZPt(power(cos(a),pow), power(sin(a),pow), 0));
1373                }
1374                }
1375              break;              break;
1376          }          }
1377    

Legend:
Removed from v.1.143  
changed lines
  Added in v.1.144

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26