• 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: Help with drawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with drawing


  • Subject: Re: Help with drawing
  • From: Chris Goedde <email@hidden>
  • Date: Sat, 16 May 2009 10:36:01 -0500

On May 16, 2009, at 2:24 AM, Graham Cox wrote:


On 16/05/2009, at 5:01 PM, Development wrote:

theX = turretBottom.x + 103* sin(angle * PI/180);

Above is what I am using to get the X coord now I need it exactly opposite the point it appears at. 103 is the height of the turret. angle is the angle it is in relation to the platform it sits on. (moves from 0 to 75 degrees)

Any one out there who knows more about math than me who might be able to help me invert this X coord?


X co-ordinates require the cosine of the angle, not sine. so it should be:

Whether sine or cosine is appropriate depends on whether the angle is being measured relative to a vertical or horizontal reference. It sounds to me like the OP is thinking that angle == 0 corresponds to a vertical turret, so sine would be appropriate in that case.


OP, if angle > 0, then your line above will always give a value for theX that is great than turretBottom.x (assuming angle doesn't exceed 180). If you want a value less than turretBottom.x, you could either use

theX = turretBottom.x - 103* sin(angle * PI/180);

with a positive value of angle, or

theX = turretBottom.x + 103* sin(angle * PI/180);

with a negative value for angle. The function sine is odd, so mathematically sin(-x) = -sin(x).

Chris

_______________________________________________

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


References: 
 >Help with drawing (From: Development <email@hidden>)
 >Re: Help with drawing (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Invoice program made in Objective c/Cocoa
  • Next by Date: Re: User Access Rights
  • Previous by thread: Re: Help with drawing
  • Next by thread: System Preference like App
  • Index(es):
    • Date
    • Thread