327 |
{ |
{ |
328 |
"Type" : "2", |
"Type" : "2", |
329 |
"Name": "PaperQuad", |
"Name": "PaperQuad", |
330 |
"Data": "float x0, y0, x1, y1; Paper::Paper* paper; float scale;", |
"Data": "float x0, y0, x1, y1; Paper::Paper* paper; float scale;float dicefactor;", |
331 |
"Params" : """ |
"Params" : """ |
332 |
Paper paper, float x0, float y0, float x1, float y1, |
Paper paper, float x0, float y0, float x1, float y1, |
333 |
float scale |
float scale, float dicefactor |
334 |
""", |
""", |
335 |
"ParamCode" : """ |
"ParamCode" : """ |
336 |
this->paper = paper; |
this->paper = paper; |
339 |
this->x1 = x1; |
this->x1 = x1; |
340 |
this->y1 = y1; |
this->y1 = y1; |
341 |
this->scale = scale; |
this->scale = scale; |
342 |
|
this->dicefactor = dicefactor; |
343 |
""", |
""", |
344 |
"RenderCode" : """ |
"RenderCode" : """ |
345 |
Coords &coords2inv = *coords2.getInverse(); |
Coords &coords2inv = *coords2.getInverse(); |
381 |
double len = hypot(x1-x0, y1-y0); |
double len = hypot(x1-x0, y1-y0); |
382 |
double nonl = coords1.nonlinearity(ctr, len); |
double nonl = coords1.nonlinearity(ctr, len); |
383 |
|
|
384 |
int dice = (int)(len * nonl) + 2; |
int dice = (int)(len * nonl * dicefactor) + 2; |
385 |
DBG(dbg) << "Dice: " << dice <<"\\n"; |
DBG(dbg) << "Dice: " << dice <<"\\n"; |
386 |
|
|
387 |
float vertices[dice][dice][5]; |
float vertices[dice][dice][5]; |
565 |
{ |
{ |
566 |
"Type" : "2", |
"Type" : "2", |
567 |
"Name": "IrregularQuad", |
"Name": "IrregularQuad", |
568 |
"Data": "float x0, y0, x1, y1; float border; float freq; int mode; CallGLCode setup;", |
"Data": """float x0, y0, x1, y1; float border; float freq; int mode; CallGLCode setup; |
569 |
|
float dicefactor;""", |
570 |
"Params" : """ |
"Params" : """ |
571 |
float x0, float y0, float x1, float y1, |
float x0, float y0, float x1, float y1, |
572 |
float border, float ripple_period, int mode, String setupcode |
float border, float ripple_period, int mode, String setupcode, |
573 |
|
float dicefactor |
574 |
""", |
""", |
575 |
"ParamCode" : """ |
"ParamCode" : """ |
576 |
this->x0 = x0; |
this->x0 = x0; |
581 |
this->freq = 1.0 / ripple_period; |
this->freq = 1.0 / ripple_period; |
582 |
this->mode = mode; |
this->mode = mode; |
583 |
setup = CallGLCode(string(setupcode.begin(), setupcode.end()).c_str()); |
setup = CallGLCode(string(setupcode.begin(), setupcode.end()).c_str()); |
584 |
|
this->dicefactor = dicefactor; |
585 |
""", |
""", |
586 |
"ExtraClass" : """ |
"ExtraClass" : """ |
587 |
template <class Coords> |
template <class Coords> |
678 |
|
|
679 |
ZPt ctr = coords2.transform(ZPt(0,0,0)); |
ZPt ctr = coords2.transform(ZPt(0,0,0)); |
680 |
double radius = (coords2.transform(ZPt(1,1,0)) - ZPt(0,0,0)).length(); |
double radius = (coords2.transform(ZPt(1,1,0)) - ZPt(0,0,0)).length(); |
681 |
double nonl = coords1.nonlinearity(ctr, radius); |
double nonl = dicefactor * coords1.nonlinearity(ctr, radius); |
682 |
|
|
683 |
int diceb = (int)fabs(2 * border * sqrt(2) * nonl) + 1; |
int diceb = (int)fabs(2 * border * sqrt(2) * nonl) + 1; |
684 |
int dicex = (int)fabs(2 * border * (1 / bx - 2) * nonl) + 1; |
int dicex = (int)fabs(2 * border * (1 / bx - 2) * nonl) + 1; |