math - AppleScript to determine if a shape has been warped or scaled -


i'm making script determine if shape has been warped or scaled. starts making list of lengths of line in 1 shape, so.

set noofsides text returned of (display dialog "enter number of sides:" default answer "")  set sidevalues {} set repeatnumber 0 repeat noofsides times     set repeatnumber repeatnumber + 1     set currentsidevalue text returned of (display dialog "enter length of line " & repeatnumber & ":" default answer "")     set end of sidevalues currentsidevalue end repeat 

it same thing second, edited shape. gives me 2 lists different variables. determine if 2 shapes similar, each 'before' line divided each 'after' line has same. example, triangle:

firstline1/secondline1 = firstline2/secondline2 = firstline3/secondline3 

is there way without having following:

try     set primevariable1 first item of primesidevalues     set primevariable2 second item of primesidevalues     set primevariable3 third item of primesidevalues     -- ... end try  try     set regularvariable1 first item of sidevalues     set regularvariable2 second item of sidevalues     set regularvariable3 third item of sidevalues     -- ... end try  try     variable4 on error     set variable4 "" end try if (regularvariable1 / primevariable1) = (regularvariable2 / primevariable2) , (regularvariable3 / primevariable3) = (regularvariable1 / primevariable1) , (regularvariable3 / primevariable3) = (regularvariable2 / primevariable2) , variable4 = ""     display dialog "shape similar" end if 

that 3 sided shape. if wanted say, 5 or 6 sides, increasingly long. perhaps if dividing every number in list 1 divided every number in list 2 equal each other, shape similar? can help?

get value of (the first item in first list / the first item in second list), use loop compare value of others items, this:

set sidevalues getsidesvalue("enter number of sides first shape:") set primesidevalues getsidesvalue("enter number of sides second shape:") set tc count sidevalues if tc = (count primesidevalues) -- number of items in lists same       set issimilar true     set thisval (item 1 of sidevalues) / (item 1 of primesidevalues) -- value of first item in lists     repeat 2 tc -- loop compare value of others items         if (item of sidevalues) / (item of primesidevalues) not thisval -- not same value             set issimilar false             exit repeat -- no need continue         end if     end repeat else     set issimilar false end if issimilar   on getsidesvalue(t)     set noofsides text returned of (display dialog t default answer "")     set l {}     repeat 1 noofsides         set currentsidevalue text returned of (display dialog "enter length of line " & & ":" default answer "")         set end of l currentsidevalue     end repeat     return l end getsidesvalue 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -