Re: mouse within oval filled area: A solution using geometry

2011-11-14 Thread James Hurley
Hugh, You'll love the atan2 function. It takes care of all nasty bits at 90 and 270 degrees as well as dealing with the quadrants issues. Use atan2(y,x) for angles measure clockwise from the x-axis Use atan2(-y,x) for angles measure counterclockwise from the x-axis. Jim Hurley --| Get the p

Re: mouse within oval filled area: A solution using geometry

2011-11-13 Thread FlexibleLearning
For those who do not have LC5 or AE (ideas already suggested), here is a solution to detect whether a point is within the filled area of an oval graphic using polar geometry. It is offered as a starting point for a more compact solution. on mouseUp --| Syntax: isWithinSegment(long ID,point) pu

Re: mouse within oval filled area

2011-11-13 Thread J. Landman Gay
On 11/13/11 8:47 AM, James Hurley wrote: Jacque, BOL! (Burst out laughing) This may be more recognizable, the equation for the ellipse in rectangular coordinates: x^2 + y^2 - - = 1 a^2 b^2 Just replace x by r*cos(theta) and y by r*sin(theta) and solve for r. Voila.

Re: mouse within oval filled area

2011-11-13 Thread Mike Bonner
Oh, forgot to mention. The really cool thing about the collision listener is if you have overlapping graphics, it will list all of them as collisions. AE5 is just too cool. On Sun, Nov 13, 2011 at 8:43 AM, Mike Bonner wrote: > Just tried doing the detection using AE5 and it works like a champ.

Re: mouse within oval filled area

2011-11-13 Thread Mike Bonner
Just tried doing the detection using AE5 and it works like a champ. With the collisionListernerDemo, a couple really simple changes gets the job done. in the card script I added the following: command startMove if tMoving is empty then put false into tMoving --put false into tMoving

Re: mouse within oval filled area

2011-11-13 Thread James Hurley
By the way, to see how different the startAngle is from the polar angle, make a very wide oval with a very small height. Set the startangle to 45 degrees and the arcangle to say 250. The start angle appears to be about 10 degrees. ___ use-livecode mail

Re: mouse within oval filled area

2011-11-13 Thread James Hurley
Jacque, BOL! (Burst out laughing) This may be more recognizable, the equation for the ellipse in rectangular coordinates: x^2 + y^2 - - = 1 a^2 b^2 Just replace x by r*cos(theta) and y by r*sin(theta) and solve for r. Voila. Well maybe not. Foreign languages are not d

Re: mouse within oval filled area

2011-11-13 Thread Mike Bonner
oops. accidental send on that last one. Clumsy day for me! As I was saying, if you use AE5 and drag around a pixel at the mouseloc the collision detection stuff in AE5 should make this a piece of cake. On Sun, Nov 13, 2011 at 6:51 AM, Mike Bonner wrote: > This is probably a silly idea, but.. if

Re: mouse within oval filled area

2011-11-13 Thread Mike Bonner
This is probably a silly idea, but.. if you have AE 5 with its collision detection, maybe you can drag a hidden pixel around at the mouseloc and set your ovals up to detect collisions. At which point a message is sent with all the ___ use-livecode mailing

Re: mouse within oval filled area

2011-11-13 Thread BNig
unds. within(object,point,"pixels") Kind regards Bernd -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/mouse-within-oval-filled-area-tp4034252p4036414.html Sent from the Revolution - User mailing list archive at Nabble.com. _

Re: mouse within oval filled area

2011-11-12 Thread Pierre Sahores
James, "Magnifique*! Pierre Le 13 nov. 2011 à 07:01, James Hurley a écrit : > Hugh, > > Would this help? The script below will draw a polygon that looks like an > ellipse with a start and stop angle. > > The trouble with the start angle and the arcangle in RR is that they are not > polar an

Re: mouse within oval filled area

2011-11-12 Thread J. Landman Gay
On 11/13/11 12:01 AM, James Hurley wrote: function r tA --Radial distance to the ellipse as afunction of the angle put (cos(tA*pi/180))^2 / (a*a) + (sin(tA*pi/180))^2 / (b*b) into temp return 1/sqrt(temp) end r This means something, right? Well, for your information I happen to know h

Re: mouse within oval filled area

2011-11-12 Thread James Hurley
Hugh, Would this help? The script below will draw a polygon that looks like an ellipse with a start and stop angle. The trouble with the start angle and the arcangle in RR is that they are not polar angles but are related in a complex way: arcAngle = arctangent( b/a * tangent(polarangle) (Don

Re: mouse within oval filled area

2011-11-12 Thread BNig
ld 1 end if end mouseWithin --- it works but it is a more of a hack. maybe someone has a better solution... Kind regards Bernd -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/mouse

RE: mouse within oval filled area

2011-11-12 Thread John Dixon
Yes, it would... but a gradient wasn't mentioned... we could throw spanners into the works all night! > From: gboj...@gmail.com > Date: Sat, 12 Nov 2011 13:34:32 -0700 > Subject: Re: mouse within oval filled area > To: use-livecode@lists.runrev.com > > This would be very

Re: mouse within oval filled area

2011-11-12 Thread Glen Bojsza
inside the coloured bit of control ID no" && the short id > of me > end if > end mouseWithin > > > > > From: ad...@flexiblelearning.com > > To: use-livecode@lists.runrev.com > > Subject: RE: mouse within oval filled area > > Date: Sat, 12 No

RE: mouse within oval filled area

2011-11-12 Thread John Dixon
ivecode@lists.runrev.com > Subject: RE: mouse within oval filled area > Date: Sat, 12 Nov 2011 19:25:16 + > > Indeed, John, but not a unique object identifier if more than one grc uses > the same color. I think I am back to polar coordinates (unfortunately). > > The curre

RE: mouse within oval filled area

2011-11-12 Thread FlexibleLearning
Indeed, John, but not a unique object identifier if more than one grc uses the same color. I think I am back to polar coordinates (unfortunately). The current engine behaviour is painfully inconsistent with other controls whose transparency is immune from mouse events. Hugh Senior FLCo John Dix

Re: mouse within oval filled area

2011-11-12 Thread Randy Hengst
Sorry to flood the list.. but nevermind… I double-checked and that idea doesn't help you…. On Nov 12, 2011, at 9:56 AM, Randy Hengst wrote: > Hi Hugh, > > I haven't done exactly as you describe, but have made things where I only > wanted a response when the user clicked the filled area of a gr

Re: mouse within oval filled area

2011-11-12 Thread Randy Hengst
Hi Hugh, I haven't done exactly as you describe, but have made things where I only wanted a response when the user clicked the filled area of a graphic. I used the function version of within…. This script in the graphic…. on mouseUp if within(graphic "myGraphic",the mouseLoc) then bee

RE: mouse within oval filled area

2011-11-12 Thread John Dixon
Use the mouseColor ? > From: ad...@flexiblelearning.com > To: use-livecode@lists.runrev.com > Subject: mouse within oval filled area > Date: Sat, 12 Nov 2011 11:59:33 + > > Has anyone worked out how to test if the mouseLoc is within the filled area > of an ova

mouse within oval filled area

2011-11-12 Thread FlexibleLearning
Has anyone worked out how to test if the mouseLoc is within the filled area of an oval graphic (defined by startAngle and arcAngle)? I was thinking polar coordinates, but this assumes a circle and a fixed radius which is not necessarily the case. A btter math brain than mine is needed! Hugh Senior