• Create Account

#Actualalvaro

Posted 26 September 2012 - 08:22 PM

This C++ function maps the entire plane to the square (0,2048)x(0,2048):
Point map_to_square(Point p, double scale) {
return Point(2048.0*sigmoid(x*scale/2048.0), 2048.0*sigmoid(y*scale/2048.0));
}

double sigmoid(double x) {
return 1.0/(1.0+std::exp(-x));
}


The parameterf scale' determines how much magnification there is at the origin. If you want things near the origin to appear at the original scale, make it 1.0.

Is that what you wanted?

#2alvaro

Posted 26 September 2012 - 08:21 PM

This C++ function maps the entire plane to the square (0,2048)x(0,2048):
Point map_to_square(Point p, double scale) {
return Point(2048.0*sigmoid(scale*x), 2048.0*sigmoid(scale*y));
}

double sigmoid(double x) {
return 1.0/(1.0+std::exp(-x));
}


The parameterf scale' determines how much magnification there is at the origin. If you want things near the origin to appear at the original scale, make it 1.0/2048.0.

Is that what you wanted?

#1alvaro

Posted 26 September 2012 - 08:20 PM

This C++ function maps the entire plane to the square (0,2048)x(0,2048):
Point map_to_square(Point p, double scale) {
return Point(2048.0*sigmoid(scale*x), 2048.0*sigmoid(scale*y));
}

double sigmoid(double x) {
return 1.0/(1.0+std::exp(-x));
}


The parameterf `scale' determines how much magnification there is at the origin.

Is that what you wanted?

PARTNERS