AffinePackage *pkg = (AffinePackage*)package;
int min_in_x = server->in_x;
int min_in_y = server->in_y;
- int max_in_x = server->in_x + server->in_w - 1;
- int max_in_y = server->in_y + server->in_h - 1;
+ int max_in_x = server->in_x + server->in_w;
+ int max_in_y = server->in_y + server->in_h;
// printf("AffineUnit::process_package %d %d %d %d %d\n",
void AffineEngine::init_packages()
{
- int y1 = 0, npkgs = get_total_packages();
+ int y1 = out_y, npkgs = get_total_packages();
for( int i=0; i<npkgs; ) {
AffinePackage *package = (AffinePackage*)get_package(i);
int y2 = out_y + (out_h * ++i / npkgs);
// All subscripts are clockwise around the quadrangle
angle = angle * 2 * M_PI / 360;
- double angle1 = atan((double)(in_pivot_y - in_y) / (double)(in_pivot_x - in_x)) + angle;
- double angle2 = atan((double)(in_x + in_w - in_pivot_x) / (double)(in_pivot_y - in_y)) + angle;
- double angle3 = atan((double)(in_y + in_h - in_pivot_y) / (double)(in_x + in_w - in_pivot_x)) + angle;
- double angle4 = atan((double)(in_pivot_x - in_x) / (double)(in_y + in_h - in_pivot_y)) + angle;
+ double angle1 = atan2((double)(in_pivot_y - in_y), (double)(in_pivot_x - in_x)) + angle;
+ double angle2 = atan2((double)(in_x + in_w - in_pivot_x), (double)(in_pivot_y - in_y)) + angle;
+ double angle3 = atan2((double)(in_y + in_h - in_pivot_y), (double)(in_x + in_w - in_pivot_x)) + angle;
+ double angle4 = atan2((double)(in_pivot_x - in_x), (double)(in_y + in_h - in_pivot_y)) + angle;
double radius1 = DISTANCE(in_x, in_y, in_pivot_x, in_pivot_y);
double radius2 = DISTANCE(in_x + in_w, in_y, in_pivot_x, in_pivot_y);
double radius3 = DISTANCE(in_x + in_w, in_y + in_h, in_pivot_x, in_pivot_y);