




yodayoda230
The (pseudo)code snippet there:
def ccw(A,B,C):
return (C.yA.y) * (B.xA.x) > (B.yA.y) * (C.xA.x)Return true if line segments AB and CD intersect
def intersect(A,B,C,D):
return ccw(A,C,D) != ccw(B,C,D) and ccw(A,B,C) != ccw(A,B,D)Looks pretty interesting(and pretty concise!) I will try that.

yodayoda230
Thanks will look into it. I have a Marware carbon fibre case which is really good and was £20, so I am a bit loath to change it!
(P.s. it's not REAL carbon fibre;) 

yodayoda230
This sorta works...
<pre>
#line1...
xd= line1[2]line1[0]
yd= line1[3]line1[1]
g1=yd/xd
c1=line1[1](g1*line1[0])
#formula is y= g1 * x + c1#line2...
xd2= line2[2]line2[0]
yd2= line2[3]line2[1]
g2=yd2/xd2
c2 = line2[1]  (g2 * line2[0])
#formula is y= g2 * x + c2both formulas will be equal at the intersection,
i.e. one minus the other equals zero
(g1 * x) + c1  (g2 * x)  c2 = 0
#solve for x...
xinter = (c2c1) / (g1g2)but is xinter somewhere in the correct range?
eg the range of one of the lines x bounds
note: needs work as needs to limit to overlapping x range
if xinter in range(line1[0],line1[2]):
return True
else:
return False
</pre> 
yodayoda230
I just sketched this out using linear equations and it worked, and it seems like others on the web do the same  find the point where both linear equations equal each other ( or if they don't, then your lines don't intersect)
Nice example here :
http://keisan.casio.com/has10/SpecExec.cgi?id=system/2006/1223519249
But wonder if something more elegant using the "in" function for rectangles might work...hmmm 
yodayoda230
Thanks, this looks very interesting. You get an A* for working this out! :)

yodayoda230
Touch screen at least is more portable I am still looking for a good case/keyboard combo for under £100!

yodayoda230
Wow these are fast  my ipad2 can rotate 500 rectangles at 60fps

yodayoda230
Hi :)
40something, owned zx80 (with a whole 16k ram pack, costing £50), bbc model b, Atari st, acorn Archimedes, pc .....
Been programming little bits of graphic nonsense for more years than I care to remember! Really into mandelboxes right now :) 
yodayoda230
Lol this is a cool idea. I've already got to level 1 :)

yodayoda230
No I couldn't find a pixel colour test :(
Lol @ "dynamically moving and colliding" background !  I have enough trouble with rectangles!! ;) 

yodayoda230
Great idea using the clock graphics as health indicators!


yodayoda230
Thanks for the basic example, CH. What's interesting is that,at first sight, it looks like every time u touch it will rotate 90deg:
......self.layer.animate('rotation', self.layer.rotation + 90)......
And indeed it does if u touch once every second etc.But touch twice quickly, and this doesn't happen. It only gets partway thru the rotation, then rotates again
guess the 'touchended' bit would need to do a check to see the 90deg had completed somehowJust saying even something simple gets complicated! :/
