• What are you working on? January 2012
    3,401 replies, posted
[QUOTE=bobiniki;34092738]r0b0tsquid can you make this on your program and show it [code] x^2 + y^2 = n //replace n with a number like 1,2,3 [/code][/QUOTE] [img]http://i.imgur.com/wDw6I.png[/img] Like that? I added implicits a while ago, it does implicit inequalites and such as well :)
[QUOTE=r0b0tsquid;34092785][img]http://i.imgur.com/wDw6I.png[/img] Like that? I added implicits a while ago, it does implicit inequalites and such as well :)[/QUOTE] Oh thanks. I learned this function yesterday but I didn't believe that it's for circle, but still I know all other functions like trigonometry, logarithmic, etc.
[QUOTE=bobiniki;34092808]Oh thanks. I learned this function yesterday but I didn't believe that it's for circle, but still I know all other functions like trigonometry, logarithmic, etc.[/QUOTE] The rule it describes is that every point on the circle is equally distanced from the center. And it does so with the Pythagoras' theorem. x^2 + y^2 = r^2
[QUOTE=bobiniki;34092808]Oh thanks. I learned this function yesterday but I didn't believe that it's for circle, but still I know all other functions like trigonometry, logarithmic, etc.[/QUOTE] You could've just used wolframalpha if that's all you wanted. :v: [url]http://www.wolframalpha.com/input/?i=%7Bx%5E2+%2B+y%5E2+%3D+1%2C+x%5E2+%2B+y%5E2+%3D+2%2C+x%5E2+%2B+y%5E2+%3D+3%7D[/url]
Working on a FP Mobile app, hopefully this one won't go the route of all of the other attempts. I've got login, forum list and thread list for a forum working in my backend. And I've got login and forum list working in the app. Here's a screenie: [img]http://dl.dropbox.com/u/3695360/fpmobile/app1.PNG[/img]
[QUOTE=r0b0tsquid;34092785][img]http://i.imgur.com/wDw6I.png[/img] Like that? I added implicits a while ago, it does implicit inequalites and such as well :)[/QUOTE] Could you explain how you did that? Implicits blow my mind
Process every grid point, check if it matches?
Or the nullsquared method: [csharp]... else if( function == "x^2 + y^2 = 1" ) { grapher.DrawCircle( center.X, center.Y, 1 ); } else if( function == "x^2 + y^2 = 2" ) { grapher.DrawCircle( center.X, center.Y, sqrt( 2 ) ); } else if( function == "x^2 + y^2 = 3" ) { grapher.DrawCircle( center.X, center.Y, sqrt( 3 ) ); } else if( function == "x^2 + y^2 = 4" ) { grapher.DrawCircle( center.X, center.Y, 2 ); } ...[/csharp] [sp]Sorry null, I know you would never do it like this[/sp]
Pretty much, esa. There's no special parsing or anything going on for implicit plots - that is literally just an expression. I evaluate the expression at each point on a grid that's spread across the screen, and then march squares over the value field that that generates in order to find the edges. The trick to how I did inequalities and such is in how I defined the comparison operators - there's no boolean type or anything, it's all numbers. Positive numbers are true, negative numbers and 0 are false. So the less than operator - say, a < b - actually just returns a - b, which is 0 if they're equal, negative if b's greater than a, or positive if a's less than b. The useful thing about this is that the result of the expression is not just whether a is less than b, but also [I]how much[/I] a is less than b by - this is what allows me to march squares accurately, with a threshold of 0. equalities and <= or >= are handled with some (slightly hackish, but effective) value mangling: if the result of a <= or >= is 0, it gets changed to a small positive value, and the result of a = b is the same as less than, but a really big (10^8 I think?) value gets subtracted, and if the result is equal to -(big number), it gets set to the same small positive value. At draw time, the result gets unmangled (so points where a < b are positive and a > b are negative again), and then I just march squares with a threshold of 0. Boolean expressions are the main reason that I handled logical values in this way. The stumbling block I hit when I first did boolean expressions, back in the VB6 grapher, was that I needed to preserve the value of how much the expression was true or false by, in order to plot it reasonably accurately. With the current logical values though, it's surprisingly simple: [code]a and b = min(a, b) a or b = max(a, b)[/code] Which works like a charm - and is negative if either operand is negative, and "or" is positive if either value is positive - without destroying that crucial information of how far off of or onto the mark the expression is. Marching squares is just "go over each square of points, check which points are true, plot lines accordingly" - Wikipedia has a pretty great article on it. That turned out a bit longer than I expected, hope that helps :v: [editline]7th January 2012[/editline] For clarity, the grid used for implicits is not the same grid you see drawn - the number of points is dependent on the detail (I think it'll be 51x51 at the current default), and its position is just view position mod the grid step size. [editline]7th January 2012[/editline] Blargh, just spent nearly the last hour "fixing" a memory leak. I was looking at the line where the memory got allocated, looking at the line where it was deallocated, and trying to figure out what was wrong with the code. Turns out that nothing was wrong - I'd deleted a file, so every time I hit "build" then "run" the build failed, and it then ran the last working build, where the memory wasn't deallocated. The problem is the build output tab was disappearing as soon as the program was run, so I didn't realise it wasn't building. Heh :v:
I made parallax perlin noise [url]http://glsl.heroku.com/e#1000.3[/url] Should I make a thread for this glsl sandbox stuff? [editline].[/editline] Made it cycle colors because it is glsl thing #1000
[video=youtube;l_xVLS2zyBo]http://www.youtube.com/watch?v=l_xVLS2zyBo[/video] Could need some ideas for upgrades or/and enemys :)
<3 php [url]https://bugs.php.net/bug.php?id=60682[/url]
[QUOTE=uitham;34093978]I made parallax perlin noise [url]http://glsl.heroku.com/e#1000.1[/url] Should I make a thread for this glsl sandbox stuff? [editline].[/editline] Made it cycle colors because it is glsl thing #1000[/QUOTE] Made the thread
With help from Icedshot, I worked today on improving my perlin noise generator to the point where it actually generates perlin noise. There're still a couple of errors (specifically some weird lines at the top-right of the image, which I am working on), but in general what I've got now is an actual perlin noise generator. I also changed things up a bit and had it generate a BufferedImage instead of just an array of values, for two reasons. Rendering the noise is now as easy as drawing the image to the screen (no looping through the values and setting colour and blah blah blah), and I can employ a very simple method call to output the noise as a png image. This allows me to generate and view noise that's bigger than my screen without building in some sort of scrolling mechanism. Pretty proud of it if I do say so myself. Here's an 800x600 sample: [IMG]http://dl.dropbox.com/u/38489921/pNoise%20%282%29.png[/IMG]
[QUOTE=jonnopon3000;34094464]With help from Icedshot, I worked today on improving my perlin noise generator to the point where it actually generates perlin noise. There're still a couple of errors (specifically some weird lines at the top-right of the image, which I am working on), but in general what I've got now is an actual perlin noise generator. I also changed things up a bit and had it generate a BufferedImage instead of just an array of values, for two reasons. Rendering the noise is now as easy as drawing the image to the screen (no looping through the values and setting colour and blah blah blah), and I can employ a very simple method call to output the noise as a png image. This allows me to generate and view noise that's bigger than my screen without building in some sort of scrolling mechanism. Pretty proud of it if I do say so myself. Here's an 800x600 sample: [IMG]http://dl.dropbox.com/u/38489921/pNoise%20%282%29.png[/IMG][/QUOTE] You forgot the linear interpolation I believe, Also I am spotting a checkerboard pattern in the second smallest noise sample Other than that I think you did it correctly
Stochastic/non-deterministic finite state machines for AI: [img]http://i.imgur.com/w3cB4.png[/img] It loads default chances and stuff from files, and has a list of players to pick random ones from. I tried to make it human-readable: [code] //Tennis player state switches from Waiting to Forehand 0.33 to Backhand 0.33 to Smash 0.33 to Miss 0.1 from Serve to Forehand 0.3 to Backhand 0.3 to Smash 0.5 //good chance to smash from a starting serve //no chance to miss from a serve //for each player, hitting any kind of rally (forehand, backhand, smash) makes that player more likely to miss in future (prunes rally length) //(picks a value to add between 0.05 and 0.15) mod from waiting to forehand miss 0.05 0.15 mod from waiting to backhand miss 0.05 0.15 mod from waiting to smash miss 0.05 0.15 //getting a miss resets their miss probability set from waiting to miss miss 1 1 [/code]
[QUOTE=uitham;34094480]You forgot the linear interpolation I believe, Also I am spotting a checkerboard pattern in the second smallest noise sample Other than that I think you did it correctly[/QUOTE] Hmm...well, my algorithm includes cosine interpolation, and a slight modification of the interpolation method from [URL="http://freespace.virgin.net/hugo.elias/models/m_perlin.htm"]this site[/URL] (2D, near the bottom, method "Interpolated Noise"). I say modified, but all that's changed is that it's performed within the perlin() method itself now. However, looking at it I do see something that is potentially wrong with it; I'll go check it out now. And sorry to be dumb, but what do you mean by "a checkerboard pattern in the second smallest noise sample?" EDIT: Also, FP looks and works so much better in FireFox. It's completely broken in my Chrome right now; I can't see any of the rating images nor click them as an example. This makes me very sad :(
[QUOTE=jonnopon3000;34094631]Hmm...well, my algorithm includes cosine interpolation, and a slight modification of the interpolation method from [URL="http://freespace.virgin.net/hugo.elias/models/m_perlin.htm"]this site[/URL] (2D, near the bottom, method "Interpolated Noise"). I say modified, but all that's changed is that it's performed within the perlin() method itself now. However, looking at it I do see something that is potentially wrong with it; I'll go check it out now. And sorry to be dumb, but what do you mean by "a checkerboard pattern in the second smallest noise sample?" EDIT: Also, FP looks and works so much better in FireFox. It's completely broken in my Chrome right now; I can't see any of the rating images nor click them as an example. This makes me very sad :([/QUOTE] Clear your cache
[vid]http://hamsters.jalb.me/previews/animator.webm[/vid] Beginnings of the animator.
[QUOTE=swift and shift;34091141][img]http://i.imgur.com/PRt9k.png[/img][/QUOTE] Is that the standard Terminal?
[QUOTE=GranPC;34094716]Clear your cache[/QUOTE] Wow, I can't believe I didn't think of it myself. I have had one mentally straining day. Thanks much; worked perfectly!
Progress, it can now get the thread list for the forum you selected, next step paging and then thread display. [img]http://dl.dropbox.com/u/3695360/fpmobile/app2.PNG[/img]
[QUOTE=NovembrDobby;34094557]Stochastic/non-deterministic finite state machines for AI: It loads default chances and stuff from files, and has a list of players to pick random ones from. I tried to make it human-readable: [code] //Tennis player state switches from Waiting to Forehand 0.33 to Backhand 0.33 to Smash 0.33 to Miss 0.1 from Serve to Forehand 0.3 to Backhand 0.3 to Smash 0.5 //good chance to smash from a starting serve //no chance to miss from a serve //for each player, hitting any kind of rally (forehand, backhand, smash) makes that player more likely to miss in future (prunes rally length) //(picks a value to add between 0.05 and 0.15) mod from waiting to forehand miss 0.05 0.15 mod from waiting to backhand miss 0.05 0.15 mod from waiting to smash miss 0.05 0.15 //getting a miss resets their miss probability set from waiting to miss miss 1 1 [/code][/QUOTE] If I understood the format correctly, I made it simulate a markov chain that always chooses something it previously didn't [code]from Waiting to Forehand 1 to Backhand 0 to Smash 0 to Miss 0 from Serve to Forehand 1 to Backhand 0 to Smash 0 to Miss 0 // when you hit, reset everything // from waiting set from waiting to forehand forehand 0 set from waiting to forehand backhand 1 set from waiting to forehand smash 1 set from waiting to backhand forehand 1 set from waiting to backhand backhand 0 set from waiting to backhand smash 1 set from waiting to smash forehand 1 set from waiting to smash backhand 1 set from waiting to smash smash 0 // from forehand set from forehand to backhand forehand 1 set from forehand to backhand backhand 0 set from forehand to backhand smash 1 set from forehand to smash forehand 1 set from forehand to smash backhand 1 set from forehand to smash smash 0 // from backhand set from backhand to forehand forehand 0 set from backhand to forehand backhand 1 set from backhand to forehand smash 1 set from backhand to smash forehand 1 set from backhand to smash backhand 1 set from backhand to smash smash 0 // from smash set from smash to forehand forehand 0 set from smash to forehand backhand 1 set from smash to forehand smash 1 set from smash to backhand forehand 1 set from smash to backhand backhand 0 set from smash to backhand smash 1[/code]
That would probably work, but at the moment there's a transient bug which breaks everything when something is set to a probability of 0. Haven't got round to fixing that yet :v:
[QUOTE=r0b0tsquid;34092154]As in, instead of "Mercurial's better!", say "I prefer Mercurial because of..." and let them make their own mind up :)[/QUOTE] [url=http://importantshock.wordpress.com/2008/08/07/git-vs-mercurial/]Here[/url] is an excellent analogy for the Git vs. Mercurial argument, if you need help deciding which one is best [b]for your situation[/b].
Comparison needs more bzr Although really nobody but Ubuntu devs use bzr anyway
[QUOTE=Ziks;34093602]Or the nullsquared method: [csharp]... else if( function == "x^2 + y^2 = 1" ) { grapher.DrawCircle( center.X, center.Y, 1 ); } else if( function == "x^2 + y^2 = 2" ) { grapher.DrawCircle( center.X, center.Y, sqrt( 2 ) ); } else if( function == "x^2 + y^2 = 3" ) { grapher.DrawCircle( center.X, center.Y, sqrt( 3 ) ); } else if( function == "x^2 + y^2 = 4" ) { grapher.DrawCircle( center.X, center.Y, 2 ); } ...[/csharp] [sp]Sorry null, I know you would never do it like this[/sp][/QUOTE] Actually I don't think optimizing for common cases in a similar (without the if-else chain) manner would be a terrible idea. Think about all the times y=x is graphed.
[QUOTE=Jawalt;34095462]Actually I don't think optimizing for common cases in a similar (without the if-else chain) manner would be a terrible idea. Think about all the times y=x is graphed.[/QUOTE] I don't think that is beneficial in any way.
[QUOTE=Overv;34095519]I don't think that is beneficial in any way.[/QUOTE] Well I wrote a grapher a while back, and when I had the resolution of the graphs 1:1 with pixels it was GODAWFUL slow, even when offloaded to the GPU. (On a 320M, which is slightly above what's in the average computer). So I could see if you were to just check for common graphs with regex or something and instead of solving for each horizontal row of pixels you can just draw a line.
Okay, I'm switching from love's filesystem to my file library for configuration/other type files.
Sorry, you need to Log In to post a reply to this thread.