Hi Ender,

I don't know how this trig function arose in you application, but you may want 
to take a look at the atan2 function in Live Code.

It handles all the funny things that happen at the branch cuts in the trig 
functions beautifully. It dispenses with the need for a switch function.

Jim


> 
> Message: 1
> Date: Thu, 14 Mar 2013 19:42:05 +0200
> From: Ender Nafi Elek?io?lu <endern...@gmail.com>
> To: List LiveCode <use-livecode@lists.runrev.com>
> Subject: Alternative To A Specific Switch Statement
> Message-ID: <66721958ea974a8480a750047083d...@gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Hello Dear LiveCode Gurus,  
> 
> 
> 
> Here is a little code snippet:
> 
> __switch
> ____case sin(pAngleInRadians) > 0
> ______put 1 into tX
> ______break
> ____case sin(pAngleInRadians) = 0
> ______put 0 into tX
> ______break
> ____case sin(pAngleInRadians) < 0
> ______put -1 into tX
> ______break
> __end switch
> 
> It's for a complex rotation command.
> Is there a more elegant way to achieve the same result with built-in 
> functions?
> I mean, something like a combination of abs(), max() and/or round()?
> Just an intellectual curiosity :)
> 
> Thanks for any insights...
> 
> 
> Best,
> 
> ~ Ender Nafi
> 


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to