• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Math question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Math question


  • Subject: Re: Math question
  • From: "Eric E. Dolecki" <email@hidden>
  • Date: Tue, 24 Jan 2017 19:36:05 +0000

Never mind on that one. with a 0-100, it's super simple. But if it's 0 - 15
that could be quite different. I'll noodle on that.

On Tue, Jan 24, 2017 at 1:57 PM Eric E. Dolecki <email@hidden> wrote:

> Thanks so much, that works perfectly!
>
> Another quick question.
>
> distance of 100 = minimum value (say 0)
> distance of 200 = maximum value (say 100)
>
> How can I apply that? I plan on Int for this value.
>
>
> On Tue, Jan 24, 2017 at 1:52 PM Saagar Jha <email@hidden> wrote:
>
> Not completely sure if this is what you want, but I think your “scale”
> would be:
>
> scale = (distance - minDistance) / (maxDistance - minDistance) * (maxScale
> - minScale) + minScale
>
> In this case,
>
> scale = (distance - 100) / 100 * 2 + 1
>
> Saagar Jha
>
> On Jan 24, 2017, at 10:45 AM, Eric E. Dolecki <email@hidden> wrote:
>
> I have a situation where the distance of an onTouchesBegan in iOS produces
> a scale for an object.
>
> min distance of 100 = scale of 1.0
> max distance of 200 = scale of 3.0
>
> So I am looking for a number between 100 and 200 which ends up being
> between 1.0 and 3.0. I can get the distance easily enough, but the scale
> factor eludes me at the moment. Coffee? Lack of this kind of math for over
> 20 years? Heh.
>
> self.scaleCircle.transform = CGAffineTransform(scaleX: percentage, y:
> percentage)
>
> What math would I apply to get that range?
>
> Eric
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Math question
      • From: Jens Alfke <email@hidden>
References: 
 >Math question (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Math question (From: Saagar Jha <email@hidden>)
 >Re: Math question (From: "Eric E. Dolecki" <email@hidden>)

  • Prev by Date: Re: Math question
  • Next by Date: PDF to Word ( docx) Conversion
  • Previous by thread: Re: Math question
  • Next by thread: Re: Math question
  • Index(es):
    • Date
    • Thread