static int calcPoint (double *seed, double x, double y, int iteration) { //printf ("%f %f %d\n", x, y, iteration); if ((iteration == 256) | ((x*x + y*y) >= 4.0) ) { return (iteration); } else { double x_new = seed[0] + (x*x - y*y); double y_new = seed[1] + (2.0*x*y); return (calcPoint(seed, x_new, y_new, iteration+1)); } }
b2Vec2 BodyGene::calcPoint(const b2Vec2& centerPoint, const b2Vec2& rotatePoint, float32 angle) const { b2Vec2 point; point.x = rotatePoint.x - centerPoint.x; point.y = rotatePoint.y - centerPoint.y; return calcPoint(point, angle); }
b2Vec2 BodyGene::calcVertex(const b2Vec2& centerVertex, const b2Vec2& vertex2, float32 angle, float32 length) const { b2Vec2 rotatePoint = calcPoint(centerVertex, vertex2, angle); rotatePoint.x += centerVertex.x; rotatePoint.y += centerVertex.y; b2Vec2 line = calcLine(centerVertex, rotatePoint); return calcPointInLine(line, centerVertex, length, isOnRight(centerVertex, rotatePoint)); }
int escapeSteps (double x, double y) { //int iteration = 1; double seed[2] = {x, y}; int iteration = calcPoint(seed, x, y, 1); return iteration; }