• 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: Maths Calculation Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Maths Calculation Problem


  • Subject: Re: Maths Calculation Problem
  • From: KOENIG Yvan <email@hidden>
  • Date: Fri, 14 Nov 2008 18:31:14 +0100


Le 14 nov. 2008 à 18:19, Simon Topliss a écrit :

Sorry, just to make things a bit simpler and a lot less scary- looking, here's the same values rounded.

Object 1: bounds: {523.0, 520.0, 749.0, 465.0}, width: 226.0, height: 55.0.
Object 2: bounds: {500.0, 570.0, 737.0, 515.0}, width: 237.0, height: 55.0.



On 14 Nov 2008, at 17:10, Simon Topliss wrote:

Hi All,

I'm trying to work out whether two text frames (or any two objects) intersect each other in Illustrator but I'm struggling with the maths.

I'm sure there's a basic formula that games developers and/or mathmagicians use to achieve this but I'm terrible at maths. I think in pictures!

Anyway, if I have two objects that do indeed intersect and the values are:

Object 1: bounds: {523.7314453125, 520.07958984375, 750.03515625, 464.88330078125}, width: 226.3037109375, height: 55.1962890625.
Object 2: bounds: {501.5654296875, 569.4541015625, 738.6728515625, 514.2578125}, width: 237.107421875, height: 55.1962890625.


How would I write the AppleScript function to return true if they do intersect and false if they don't?

I know the subject is slightly OT but the solution will be used in an AppleScript program! Many thanks to anyone who can help.

Simon


I hope that I forgot nothing.

set {X11, Y11, X12, Y12} to {523.7314453125, 520.07958984375, 750.03515625, 464.88330078125}
set {X21, Y21, X22, Y22} to {501.5654296875, 569.4541015625, 738.6728515625, 514.2578125}


set intersect to (((X21 > X11) and (X21 < X12)) or ((X22 > X11) and (X22 < X12))) and (((Y21 > Y11) and (Y21 < Y12)) or ((Y22 > Y11) and (Y22 < Y12)))

Yvan KOENIG (from FRANCE vendredi 14 novembre 2008 18:30:51)


_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Maths Calculation Problem (From: Simon Topliss <email@hidden>)
 >Re: Maths Calculation Problem (From: Simon Topliss <email@hidden>)

  • Prev by Date: Re: create duplicate event in iCal
  • Next by Date: Entourage - save calendar as web page
  • Previous by thread: Re: Maths Calculation Problem
  • Next by thread: Fwd: Maths Calculation Problem
  • Index(es):
    • Date
    • Thread