• 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: Code for a circle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code for a circle


  • Subject: Re: Code for a circle
  • From: Deivy Petrescu <email@hidden>
  • Date: Thu, 13 Mar 2003 17:40:00 -0500

On Thursday, Mar 13, 2003, at 13:49 US/Eastern, Paul Skinner wrote:

Can anyone explain the formula I should use to generate values for the position of a window such that the values all fall close to lying on a 30 pixel diameter circle ?



Since you've asked, I'll post it below. However, looking at both I liked yours better.
<Script for the circle>
tell application "Finder"
activate
try
set r to 30
-- r is the radius
set numtimes to 30
-- the maximum number of steps
set jump to 10
--well, jump is jump in the repeat loop
set frontWindow to window 1
set {x0, y0} to position of frontWindow
set position of frontWindow to {x0 + r, y0}
--move the window radius pixel away in the positive x direction.
repeat with i from 1 to (4 * numtimes) by jump
(*
change the x position by jump and check what the y position should be to get the position of the window
*)
if i !B (2 * numtimes) then
set r to (r - 1 * jump)
set ry to (30 ^ 2 - r ^ 2) ^ (1 / 2)
else
set r to (r + 1 * jump)
set ry to ((-1 * ((30 ^ 2 - r ^ 2) ^ (1 / 2))) div 0.1) / 10
end if
set position of frontWindow to {x0 + r, y0 + ry}
end repeat
on error msg
msg
end try
set position of frontWindow to {x0, y0}
-- send the window back to the original position
end tell

<end script>

Regards

Deivy Petrescu
http://www.dicas.com/
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Code for a circle
      • From: Deivy Petrescu <email@hidden>
    • Re: Code for a circle
      • From: Emmanuel <email@hidden>
References: 
 >Code for a circle (From: Paul Skinner <email@hidden>)

  • Prev by Date: Again I ask... (retrieving info data)
  • Next by Date: Re: reading a file >32Kb
  • Previous by thread: Re: Math with AS (was: Code for a circle)
  • Next by thread: Re: Code for a circle
  • Index(es):
    • Date
    • Thread