+--- Day changed Tue Aug 26 2014
+14:25 < matches> I wonder if I'm going to end up just reverse engineering an algorithm that I was too lazy to understand properly
+14:26 < matches> I really like the idea of flood fill better than doing insane triangulation maths
+14:26 < matches> Surely GPUs can flood fill
+14:28 < sulix> I think they can, but either very slowly or only on very new hardware...
+14:28 < sulix> I think you'd need to do it in several passes, maybe?
+14:28 < matches> The problem I had with flood fill was working out where to start
+14:28 < matches> I have something that almost works
+14:28 < matches> That requires no clever maths...
+14:29 < matches> But it is CPU only
+14:29 < matches> And probably breaks in a bunch of special cases
+14:30 < matches> It doesn't have precision problems though (once you've drawn the boundary that is)
+14:31 < matches> It would still be cool to go through the Loop/Blinn algorithm on CPU and GPU
+14:31 < matches> Because that is going to have floating point maths in it
+14:31 < matches> flood fill has no floats
+14:31 < matches> Therefore it is infinite precision
+14:31 < matches> Objective complete
+14:32 < matches> Actually I don't think my algorithm is proper flood fill, it's sort of scanline flood fill but not?
+14:32 < matches> When in doubt write random code
+14:34 < sulix> How are you handling the case where, due to a path being half offscreen it becomes two paths?
+14:34 < matches> ... I am not
+14:35 < matches> If part of the path is offscreen it is annoying
+14:36 < sulix> Hopefully, once some of the quadtree code is more functional, the path clipping code can be used to clip paths to the screen.
+14:39 < matches> Compositing is also totally broken because the fill just looks for black pixels
+14:40 < matches> But if I can get it doing fonts then that's sort of not totally useless
+18:35 < matches> I am very tempted to implement a "Please click on the location to fill this path from" interface at the moment
+18:39 < matches> Alright, I have shading somewhat stack overflowing
+18:39 < matches> I mean
+18:39 < matches> Working
+18:39 < matches> *
+18:39 < matches> ********
+18:49 < matches> http://szmoore.net/ipdf/shading-the-only-svg-that-doesnt-segfault.png
+20:43 < matches> Argh
+20:43 * matches stabs coordinate transforms
+20:43 < matches> stab stab stab
+20:44 < matches> My filling algorithm is to find the 4 extrema of the path
+20:44 < matches> And try and flood fill inwards from each one
+20:45 < matches> But the extrema pixel coordinates keep transforming to *outside* of the path
+20:45 < matches> By one pixel
+20:45 * matches stabs
+21:52 < matches> I guess I should just actually implement loop and blinn shading
+21:52 < matches> Flood fill is not as easy as I had hoped
+21:53 < matches> I have to start doing annoying geometry maths to work out what point I can start the flood fill at
+21:55 < matches> Sigh
+--- Day changed Wed Aug 27 2014
+22:33 < sulix> Suddenly: ToAbsolute on ToRelative does not give original Bezier
+22:34 < sulix> I may need to rethink what my quadtree code is doing to those poor curves.
+22:51 < sulix> Never mind, that assertion happens _whenever_ trying to load cubicbeziers.svg.
+23:03 < sulix> Oh wow: you should see what happens if you start splitting and reparametrising beziers with bad precision.
+23:03 < sulix> 'tis "whacked"
+23:08 < sulix> http://davidgow.net/stuff/ipdf-a-slight-curve.png
+23:15 < sulix> And the Quadtree infinite precision for béziers now works*
+23:15 < sulix> *for some beziers.
+23:15 < sulix> * for some large finite value of "infinite"
+--- Day changed Thu Aug 28 2014
+11:35 < sulix> What time is it? It's NaN time!
+11:44 < sulix> Ah, so... horizontal lines have a height of zero in their bounds. This makes divides by zero happen in places.
+11:48 * sulix apologieses profusely for his latest "break absolutely everything" commit.
+11:57 < sulix> Yeah, making divide by zero crash rather than generating NaNs breaks a lot of things.
+11:57 < sulix> You'd be surprised by how often we divide by zero.
+11:57 < sulix> Mostly in the Quadtree code.
+11:58 < sulix> Because, damnit, mathematics can't beat me.
+12:20 < matches> Yes, lines have zero width... stupid lines
+12:21 < matches> I stopped the segfaults in shading by adding a depth counter to FloodFillOnCPU
+12:21 < matches> Which makes interesting shading patterns...
+12:22 < matches> I think it's time to fall back to the "Use the second algorithm on Wikipedia" approach
+12:23 < matches> I can still use a Flood Fill but hopefully a less segfaulty one
+12:29 < matches> I'm not sure about ToAbsolute and ToRelative...
+12:29 < matches> I thought they should be inverses but they seem not to be
+12:29 < matches> Oh wait, the divide by zero would do that
+12:30 < matches> That curve looks cool
+12:30 < matches> You should talk about it lots in the meeting
+12:31 < matches> For the whole meeting
+12:31 < matches> Nothing else
+12:31 < matches> Don't mention the total lack of progress I made...
+12:32 < matches> How much can I trust SolveCubic?
+12:40 < matches> Basically I'm going with randomly picking points until I find one inside the shape then starting a flood fill from that point
+12:41 < matches> Checking the pixels for the edges is not feasable
+12:42 < matches> If you scan along a bresenham line you could jump over the edge
+12:42 < matches> ... I see an "if false" in SolveCubic
+12:42 < matches> Slightly worrying
+12:43 < matches> Ah
+12:43 < matches> I approve of SolveCubic
+13:31 < matches> So
+13:31 < matches> Did you introduce the floating point exception or did I...
+13:45 < sulix> I just did.
+13:49 < sulix> SolveCubic may have small problems.
+13:50 < matches> Yes I am trying to rewrite it now...
+13:50 < matches> I swear we did this in CQM
+13:52 < sulix> Solvecubic also sometimes tries to take the square root of a negative number.
+13:52 < matches> Yep
+13:54 < sulix> I've pushed slightly less broken code.
+13:55 < sulix> Ny which I mean slightly more broken.
+13:55 < matches> ...
+13:55 < sulix> I'm avoiding divide by zeros by "if (denominator = 0) denominator = 1" style shenanigans.
+13:56 < matches> I'm slightly scared by the change to Rect::TransformRectCoordinates
+13:56 < matches> Oh right
+13:56 < matches> Yeah
+13:56 < matches> That seems...
+13:56 < matches> Scary
+13:56 < sulix> It works, scarily enough.
+13:56 < matches> Anyway I already ifdef'd the thing out of SolveCubic
+13:56 < matches> It's too slow for me though
+13:57 < sulix> And by works, I mean I haven't found any issues yet.
+13:57 < matches> I am brute forcing a point inside the shape
+13:57 < matches> This requires finding the intersections with horizontal and vertical lines for every single bounding bezier
+13:57 < matches> Then the "even or odd" test
+13:57 < matches> You only have to do it once
+14:05 < matches> I think SolveCubic would best be done by doing Newton Raphson or the Shooting Method between the endpoints and the turning points
+14:05 < matches> I'll see
+14:06 < matches> I'll try implement it and see if it's faster
+14:06 < matches> You may have to demonstrate my totally broken shading for me
+14:06 < matches> I haven't committed in a while
+14:41 < matches> Oh
+14:41 < matches> SolveCubic may not have been the bottleneck there...
+14:41 < matches> -_-
+14:41 < matches> The failure to update the variable for a while loop miiiight be more of an issue
+14:44 < sulix> Good, 'cause I'm thinking of "upping the SolveCubic accuracy" a bit.
+14:44 < sulix> Anyway...
+14:44 * sulix -> CS
+14:46 < matches> I've reimplemented SolveCubic
+14:46 < matches> In theory it works
+14:55 < matches> I reckon Binary Search is the only algorithm I am good at implementing :S
+14:57 < sulix> Oooh...
+14:57 < matches> What?
+18:56 < matches> So, the fact that we are not solving cubics analytically is probably important in terms of precision issues
+18:58 < sulix> Yeah, that's why I started trying to solve them analytically and then stopped and cried.
+18:58 < matches> :(
+18:59 < matches> There is a solution, it's just ugly
+18:59 < sulix> Nah: for the Quadtree, it didn't matter much. As long as the error went in the correct direction, you'd just lost a tiny bit of efficiency.
+19:00 < matches> Hmm
+19:00 < matches> I don't expect shading using arbitrary precision arithmetic will be particularly fast anyway...
+19:01 < sulix> Well, ideally most of the work in the shading will be done in screen-space anyway.
+19:01 < matches> Yes
+19:02 < sulix> And, of course, you don't need infinite precision for that because pixels/integers/etc.
+19:03 < sulix> So, fingers crossed, things shouldn't matter too much.
+19:03 * sulix realises that that is a maddeningly vague statement.
+19:03 < matches> Well
+19:04 < matches> I got the fill point to actually be in the correct location by actually solving the intercepts correctly
+19:04 < matches> But
+19:04 < matches> If you zoom *out* far enough, it can end up no longer inside the shape when transformed to screen space
+19:04 < sulix> Okay, new plan.
+19:04 < sulix> No zooming out.
+19:05 < matches> I wish there were other people in this channel so I could justify putting that in qdb
+19:20 < matches> There is a temptation to not require all those references to be const during rendering
+19:20 < matches> We might want the Path to be able to alter itself based on the view
+19:20 < matches> But I guess we'll take that path when we get to it
+19:22 < matches> It might be worthwhile caching Path's for fonts
+19:22 < matches> But I'd have to change the coordinates to be relative
+19:22 < matches> Too many coord transforms
+19:24 < sulix> Yup, that can be the subtitle of the thesis: "Too many coord transforms"
+19:26 < matches> "A coordinated approach to graphics"
+19:26 < matches> Oh wow
+19:26 < matches> That should be a textbook
+19:26 < sulix> "Transformers: Matrices in disguise"?
+19:30 < sulix> Okay, it turns out (if denominator is zero, make denominator 1) has one flaw.
+19:30 < sulix> Sometimes you should make the denominator... negative 1.
+19:30 < matches> ...
+19:30 < sulix> Somehow, I did not see this coming.
+19:30 < matches> I'm not sure how this maths works
+19:30 < matches> 1/0 != 1/-1
+19:30 < sulix> That's what they want you to think.
+19:31 < sulix> (Or maybe the bug I'm having is unrelated to that, but it seems like a fun guess)
+21:16 < matches> Floating Point Exception in fglrx!
+21:16 < matches> glXDestroyContext
+21:16 < matches> It only happens when the program is about to close
+21:16 < matches> So I'll be fine
+21:18 < sulix> Ah, maybe enabling floating point exceptions was a bad idea.
+21:18 < sulix> ...if it causes lots of "fglrxceptions"!
+21:21 < matches> Well fglrx is exceptional
+21:37 < matches> I'm falling back on just testing a crap tonne of points for "inside" and adding all the ones that are to a vector
+21:37 < matches> I think there are some false negatives in Path::PointInside
+21:37 < matches> Also FloodFill misses some edge pixels which makes no sense
+21:38 < matches> If it's next to a filled pixel it should get filled!
+21:47 < matches> So the disadvantage of using a breadth first search is that when your queue gets really big instead of getting a segfault you just get OOM
+21:48 < matches> segfaults are quick
+21:48 < matches> segfaults are like a pistol and oom is like drowning
+21:54 < sulix> There is no way a BFS floodfill should ever OOM
+21:54 < sulix> How many pixels are there, and how much are you storing per one?
+21:58 < matches> Probably max 256x256 pixels, 4 way fill
+21:58 < matches> It does not like rabbit_simple.svg
+22:04 < matches> Yeah there is *something* causing it to get in a loop
+22:04 < matches> Because obviously my BFS didn't check for loops
+22:14 < matches> -_-
+22:14 < matches> It is in a loop
+22:14 < matches> Because there is a region with fill colour of white
+22:14 < matches> And the flood fill is just "If it isn't white, stop"
+22:14 < matches> Maybe I should set the background to have 0 alpha or something
+22:15 < matches> Alpha seems to not actually do anything at the moment
+22:27 < matches> http://szmoore.net/ipdf/who-the-hell-needs-antialiasing-anyway.png
+22:44 < matches> http://szmoore.net/ipdf/shady-the-fox.png
+22:47 < matches> rabbit_simple.svg actually doesn't work as well as rabbit.svg
+22:48 < matches> I think one of the fill points of the outer ear is inside the inner ear
+22:54 < sulix> Oh my... They're beautiful!
+23:07 < matches> Ah crap
+23:07 < matches> I will be pushing
+23:07 < matches> 8 hours in the future
+23:07 < matches> I really should fix my system clock
+23:07 < matches> One of these days...
+--- Day changed Mon Sep 01 2014
+17:05 < matches> The wobbly lines on things are irritating me
+17:10 < matches> There doesn't seem to be anything wrong with Bresenham, which means the actual line endpoints are wrong
+17:11 < matches> The GPU does everything from floats and magically they go to the right spot in the buffer
+17:11 < matches> The CPU has to calculate integer pixel coordinates
+17:16 < matches> I need a magnifier I can't see the pixels that are in the wrong spot
+17:16 < matches> I know they are there
+17:21 < matches> ... ok maybe the Bresen Ham was a little past its use by date
+19:48 < matches> The more I try and get these lines to not look dumb, the more convinced I become that glDrawLines is doing something fancy
+19:56 < matches> You end up with wiggles in the line because the end points round to a different pixel to what you end up at by drawing the line
+19:57 < matches> If you make sure you start from where the last line ended, you still get a bend because of the left over error from the last line
+19:58 < matches> ...
+19:58 < matches> Drawing a single line when you know the Bezier is actually a single line is probably going to be less rage inducing than trying to fix this
+21:01 < matches> The Beziers are now classified according to Loop and Blinn
+21:01 < matches> Well
+21:01 < matches> Maybe
+21:01 < matches> It at least knows what lines are
+21:01 < matches> ...
+21:02 < matches> Ok all the ttf beziers are SERPENTINE and LOOP so that's probably wrong
+21:43 < matches> Ah, floating point precision strikes again
+21:43 < matches> That's kind of annoying
+21:47 < matches> But I suppose it's relevant
+21:47 < matches> Unless I'm totally screwing something up
+21:48 * matches adds in arbitrary fabs(x) < 1e-6 checks
+21:58 < matches> On the other hand, if you use DeCasteljau and stop the sub dividing whenever you get to something that classifies as a line, it's actually pretty cool
+21:59 < matches> But if you zoom in too far it starts to get classifications totally wrong
+22:02 < matches> Yeah I have an abstract due in 2 weeks
+22:02 < matches> so screwed
+--- Day changed Tue Sep 02 2014
+13:42 < matches> Ok, let's not use floating point values for colours
+13:42 < matches> Baad
+13:43 < matches> Bad bad
+13:43 < matches> Bad sheep
+13:43 < matches> The project isn't about precision of representable colours
+13:44 < matches> So I'm perfectly OK with using uint8 for colour components
+18:53 < matches> Is it too late to change the aim of the project to "render svg-tests/fox.svg but without antialiasing"
+18:54 < matches> "Or using the GPU"
+18:55 < matches> Well, I understand why shading doesn't usually use flood fill now anyway
+18:55 < matches> But I still kind of think flood fill is better at high resolutions
+18:56 < matches> Not parallelisable I guess
+18:56 < matches> ... Or is it
+18:57 < matches> I was going to try and do arbitrary precision stuff but it seems we can no longer compile unless Real == double or float
+--- Day changed Wed Sep 03 2014
+17:26 < matches> It would seem Mr Munroe has beaten us...
+17:28 < matches> In Javascript
+17:28 < matches> We should die of shame
+17:29 < matches> Hahaha
+17:29 < matches> "// there is no elegance here. only sleep deprivation and regret"
+17:31 < matches> On the bright side, we now have a reason to reference xkcd
+17:31 < matches> I guess?
+17:59 < sulix> I just saw that, and had planned to use that comment as my next commit message.
+--- Day changed Thu Sep 04 2014
+10:59 * sulix sulix also engages panic mode.
+11:00 * sulix apparently also needs to engage sleep mode.
+11:00 * sulix almost engaged sheep mode by mistake.
+11:49 < sulix> How sure are you that SolveCubic works?
+18:37 < matches> Well, sure within 1e-4
+19:40 < matches> Rational<Gmpint> compiles again
+19:41 < matches> It just takes... several minutes... to load "The quick brown fox jumps over the lazy dog"
+21:04 < matches> I have a new ingenius plan
+21:06 < matches> This will probably not work but hopefully it won't take me too long...
+21:06 < matches> Oh dear what am I saying
+21:06 < matches> It's going to take a month now
+22:24 < matches> I really should be integrating one of those two libraries Rowan suggested into the project
+22:24 < matches> As opposed to implementing what I like to call the "Paranoid Number"
+22:25 < matches> It starts as a float
+22:25 < matches> It checks each operation for an exception, and if it does it adds the operation to a linked list instead
+22:25 < matches> After trying to simplify the next elements in the list
+22:26 < matches> This is going to be awful
+22:26 < matches> But it's been a while since I wrote a good linked list
+22:32 < matches> ... I think the last linked list I wrote had a nasty tendency to randomly segfault...
+22:32 < matches> Nevertheless we shall forge ahead
+23:14 < matches> You know you haven't had enough sleep when you start to terminate lines with ':' instead of ';'
+23:14 < matches> I blame python
+23:14 < matches> Not that it was valid python syntax either
+23:15 < matches> But it's a good scapesnake
+23:42 < matches> Oh recursive list based functions
+23:42 < matches> How I have missed you
+23:42 < matches> void Foo() {if (m_next != NULL) m_next->Foo();}
+23:42 < matches> <3
+--- Day changed Fri Sep 05 2014
+09:26 < matches> It sort of kind of works
+09:26 < matches> Except when it breaks
+09:26 < matches> ParanoidNumber::Simplify needs improvement
+09:26 < matches> Also operator+=
+09:26 < matches> operator-=
+09:26 < matches> operator*=
+09:26 < matches> and operator/=
+09:26 < matches> But it's definitely a number
+09:27 < matches> It just occasionally does things in totally the wrong order'
+09:28 < matches> So basically the idea is if you have an inexact (or overflow/underflow) operation, you delay it, and then in theory you can rearrange the operations so you have a smaller error...
+09:28 < matches> It seems to give better results than floats for tests/paranoidcalculator
+09:29 < matches> But that might be because it is initialised off 3/10 and the float starts at 0.3
+09:30 < matches> It could all be totally useless
+09:30 < matches> It probably is totally useless
+09:31 < matches> I have a hunch that even if it's terrible it might beat true arbitrary precision arithmetic
+09:31 < matches> In terms of actually being able to use it
+09:31 < matches> Who needs mathematics when you have blind intuition...
+--- Day changed Sun Sep 07 2014
+11:37 < sulix> Explicit mentions of hitting floating point precision issues in the xkcd comic: http://chromakode.com/post/notes-on-xkcd-pixels
+17:33 < unmercifulfish> mwahahaha
+17:34 < unmercifulfish> you can't escape my stalkerish tendencies now
+--- Day changed Mon Sep 08 2014
+11:10 < matches> This channel seemed like such a good idea at the time...
+11:19 < sulix> (So did the quadtree...)
+12:08 < Pommers> http://chromakode.com/post/notes-on-xkcd-pixels
+12:10 < sulix> It's gettign crowded in here.
+12:10 < sulix> Pommers: We were looking at that yesterday. The XKCD guys had it easy.
+12:11 < Pommers> Lets get all the people in here
+12:42 < unmercifulfish> IPDF PARTY
+13:49 < matches> Hmm, maths is harder than I thought
+15:41 < Pommers> Speaking of math, I know a guy who is looking for people versed in maths and willing to work on psuedo random number sets
+--- Day changed Wed Sep 10 2014
+11:50 < matches> So, compiling with mpfr reals is not as simple as including the mpfr real header and doing a typedef
+11:50 < matches> As there appear to be compiler errors in mpfr
+11:51 < matches> Does anyone actually check that things compile before including them in debian..
+11:53 < matches> I'd expect this sort of thing from Fedora
+11:58 < matches> Never mind it's namespace issues
+11:58 < matches> I'm sorry debian
+12:15 < matches> Something is horrendously broken about mpfrc++
+12:16 < matches> Oh
+12:17 < matches> #if REAL >= REAL_RATIONAL was not a wise choice
+12:21 < sulix> Ah...
+12:24 < matches> mpfrc++ is at least as precise as doubles but slower
+12:24 < matches> I never actually found the limit for doubles
+12:24 < matches> I should do that first
+12:26 < matches> Hmm, things start to disappear at around 4e-11 but you can still add stuff and it looks fine
+12:27 < matches> Ok doubles go crazy at 1e-17
+12:27 < matches> 1e-15 even
+12:30 < sulix> Is that zooming in on the origin, or somewhere further away?
+12:31 < matches> Somewhere further away
+12:31 < matches> If you translate towards the origin you can actually see the shapes start to get better
+12:31 < matches> It's actually pretty cool
+12:35 < matches> There's something dodgy with starting the View with low width/height as opposed to zooming in to the same width/height
+12:37 < matches> mpreal doesn't seem to want to show anything
+12:39 < matches> I think it's well past time we automated the zooming/translating process
+12:39 < matches> Sitting here zooming for 20 minutes is not really an effective use of time...
+12:47 < matches> Speaking of which, the CPU shading evaluates the fill points lazilly now, so you don't have to wait 5 minutes even with doubles just to load an SVG
+15:39 < sulix> For all of the hangers on... quadtrees are now slightly more functional.
+15:39 < Pommers> "functional"
+18:40 < iceweaselOS> Apparently talking in ICC isn't allowed
+18:41 < iceweaselOS> ICC
+18:41 < iceweaselOS> dammit
+18:41 < iceweaselOS> it has autocorrect
+18:42 < iceweaselOS> Humphrey the rabbit does not work :(
+18:42 < iceweaselOS> it gets stuck in pause