私のコード:
CGFloat scaleFactor = newSize.width / oldSize.width;
CGFloat newCenterX = center_.x * scaleFactor;
CGFloat newCenterY = center_.y * scaleFactor;
CGPoint newCenter = CGPointMake(newCenterX, newCenterY);
//newCenter.x = newCenterX;
//newCenter.y = newCenterY;
CGFloat newRaduis = raduis_ * scaleFactor;
newCenter.y += newSize.height - ceilf(scaleFactor) * oldSize.height;
NSLog(@"Convertion from %@ to %@", NSStringFromCGSize(oldSize), NSStringFromCGSize(newSize));
NSLog(@"old center = %@, old radius = %f", NSStringFromCGPoint(center_), raduis_);
NSLog(@"new center = %@, new radius = %f", NSStringFromCGPoint(newCenter), newRaduis);
NSLog(@"new center x = %f, new center y = %f", newCenterX, newCenterY);
そして出力:
2012-09-14 14:18:35.027 TestApp[425:4b93] Convertion from {1080, 1920} to {320, 415}
2012-09-14 14:18:35.031 TestApp[425:4b93] old center = {246, 822}, old radius = 20.000000
2012-09-14 14:18:35.033 TestApp[425:4b93] new center = {73, -1261}, new radius = 5.925926
2012-09-14 14:18:35.035 TestApp[425:4b93] new center x = 73, new center y = 244
出力-新しい中心={73、-1261}、新しい半径=5.925926。中央のy値が負であるのはなぜですか?私は何を間違えますか?
助けてくれてありがとう