Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8526413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:15:57+00:00 2026-06-11T08:15:57+00:00

My code: CGFloat scaleFactor = newSize.width / oldSize.width; CGFloat newCenterX = center_.x * scaleFactor;

  • 0

My code:

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);

And output:

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

In output – new center = {73, -1261}, new radius = 5.925926. Why center y value is negative? What I do wrong?

Thanks in advance for help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:15:59+00:00Added an answer on June 11, 2026 at 8:15 am

    The error is because of your line

    newCenter.y += newSize.height - ceilf(scaleFactor) * oldSize.height;
    
    • scaleFactor is about 0.2962 so ceilf(scaleFactor) is equal to 1.
    • newSize.height is 415, oldSize.height is 1920, so 415 - 1*1920 is -1505, and newCenter.y += -1505 makes newCenter.y change from 243.556 to 243.556 + (-1505) = 1261.444.

    So this seems legit that newCenter.y is -1261 after this line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the following code to get the screen size width: CGFloat width =
here is my code CGContextRef c = UIGraphicsGetCurrentContext(); CGContextBeginPath(c); CGContextMoveToPoint(c, 277.0f, 21.0f); CGFloat newpoint
guys. I have UITableView with different cells and I have code, which counts height.
Check out the code const CGFloat *c = CGColorGetComponents([[UIColor whiteColor] CGColor]); slider1.value = c[0];
i have this method Code: - (void)addImageSubViewAtX:(CGFloat)x atY:(CGFloat)y { CGRect myImageRect1 = CGRectMake(x, y,
I am using the code below to put together my UITableView. The Cell height
I have the following test code: CGFloat endRed, endGreen, endBlue, endAlpha; [[UIColor greenColor] getRed:&endRed
I have this code for gesture in a view - (void)rightSwipeHandle:(UIPanGestureRecognizer*)gestureRecognizer{ CGPoint touchBegan; CGPoint
here is my code: CGFloat components[8];//[8];// = { 0.6, 0.6, 0.6, 0.5, 0.4, 0.4,
This is the code i have: CGFloat buttonGradient1Colors [] = { [gradient1TopColor ], 1.0,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.