Automatic commit of irc logs
[ipdf/documents.git] / irc / #ipdf.log
index 4df7d54..006da52 100644 (file)
 21:40 <@matches> Of course we are restricted by the zoom in the pdf viewer...
 21:41 <@matches> This project is too meta
 21:41 <@matches> It is doing my head in
+--- Day changed Fri May 23 2014
+11:22 < sulix> Welp. Submitting this version: http://davidgow.net/stuff/LitReviewDavid.pdf
+11:23 < sulix> (The introduction has only got more over the top, I'm afraid)
+11:48 < sulix> Do you know what is happening/isn't happening RE: Revised project proposals?
+12:03 < sulix> Well: Literature review is submitted.
+12:03 < sulix> (In person to the coordinator, which is a little bit scary)
+--- Day changed Sun May 25 2014
+15:42 <@matches> No meeting tomorrow by the way
+15:43 < sulix> Ah. Cool. I have like 300 things to do.
+15:43 < sulix> Just pushed fixes for all of the compile warnings, btw.
+15:43 <@matches> Cool
+15:44 <@matches> I want to keep editing my Lit Review :S
+15:44 < sulix> I had thought that Float() always returns a "float", but it sometimes returns a double.
+15:44 <@matches> Oh
+15:44 <@matches> Whoops
+15:44 <@matches> Well a double is technically still a float...
+15:44 < sulix> (Also, it turns out OpenGL actualy breaks the C++ spec, and is therefore impossible to use without hacks if you have -Werror enabled)
+15:45 <@matches> Sigh
+15:45 < sulix> It was warning that I was losing precision from float x = Float(blah);
+15:45 <@matches> One of the things I want to put in my lit review is a snarky paragraph about how no one actually obeys standards anyway
+15:46 < sulix> There are points where you get function pointers as void* pointers, but C++ needs to work on systems where code and data are stored in different bits of memory with different size pointers.
+15:46 <@matches> On the other hand no matter how much better I make the lit review no one will read it because I'm being assessed on a conference paper not a dissertation
+15:46 <@matches> Ah
+15:46 < sulix> So casting any data pointer to a function pointer is apparently illegal.
+15:47 <@matches> That's annoying
+15:47 < sulix> Fortunately, gcc doesn't complain if you start the line that does it with "__extension__", so that's what we do.
+15:47 <@matches> Haha
+15:54 <@matches> Ok I am still about 3 days behind on sleep but I guess I should do work
+15:54 <@matches> Bye
+--- Day changed Tue May 27 2014
+12:49 <@matches> We missed the Computable Document Format (CDF) by Mathematica by the way
+12:49 <@matches> Wolfram would be offended
+12:50  * matches hopes none of the Mathematica fanatics read the lit review
+12:50 <@matches> Or this channel
+12:54 <@matches> I did have both Mathematica and IPython as a dot point and they got the mighty question mark of confusion over them
+12:54 <@matches> Maybe I'll add them in later
+12:55 <@matches> Frames does not seem to agree with my assertion that practically anything can be considered a document format :P
+12:55 <@matches> Plain text!
+12:57 <@matches> So I was looking through last year's Mech/Chem final year conference
+12:57 <@matches> Naturally there is nothing remotely like this project in there
+12:57 <@matches> :(
+--- Log opened Tue Jun 10 13:59:54 2014
+13:59 -!- matches [[email protected]] has joined #ipdf
+13:59 -!- Irssi: #ipdf: Total of 2 nicks [1 ops, 0 halfops, 0 voices, 1 normal]
+13:59 -!- Irssi: Join to #ipdf was synced in 3 secs
+16:29 -!- mode/#ipdf [+o matches] by OperServ
+--- Day changed Wed Jun 11 2014
+13:13 <@matches> JVB just asked me if it was possible to have a self updating pdf
+13:13 <@matches> I suppose he didn't ask whether it would be easy
+13:15 <@matches> As in, one that would download itself if there was a newer version
+13:16 <@matches> Technically with the crippled PostScript it would be "No" but with all that stuff in the standard about DRM and "Action Objects" and Javascript and stuff...
+13:18 <@matches> Hmm, a webserver running git and a cronjob and requiring authentication may solve his problem
+13:18 <@matches> With pdf.js or just relying on browsers to have pdf plugins
+13:18 <@matches> Wait why am I solving JVB's problem
+--- Day changed Fri Jun 13 2014
+16:31 <@matches> So exams have finished
+16:31 <@matches> Well my exams have finished
+16:32 <@matches> Now I can go back to panicking about the project again
+16:37 <@sulix> Excellent: it's your turn to do something impressive for the meeting on Monday, then. :P
+--- Day changed Mon Jun 16 2014
+14:49 <@matches> Some of this OpenGL stuff doesn't quite add up
+14:49 <@matches> Like m_cahed_display.UnBind(); m_cached_display.Blit();
+14:50 <@matches> Oh
+14:50 <@matches> I see
+14:50 <@matches> There is a difference
+14:51  * matches -> OpenGL documentation
+14:53 <@matches> Right I see
+15:03 <@matches> Well, this makes a lot more sense than tpg's "Adventures in VEMS" in #ucc at least
+15:18 <@sulix> Well that's an achievement, I guess.
+15:18 <@sulix> Also http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf
+15:18 <@sulix> It's the spec for "nullptr"...
+15:20 <@matches> "Pointers are pretty cool. Pointers that are NULL are pretty cool. We address these issues by proposing nullptr" ?
+15:21 <@sulix> Haha: Pretty much.
+15:22 <@matches> Why not just reserve the word "null"
+15:22 <@matches> I could get behind it then
+15:23 <@matches> It is not a null reference
+15:23 <@matches> But if you ever have a null reference something is horrifyingly wrong
+15:23 <@matches> Bah humbug
+15:24 <@sulix> They have a page about that where they said "everyone was naming their variables \"null\"".
+15:24  * sulix realises he just escaped those quote. Oh dear.
+15:24 <@matches> A valid point, which should have lead to "Everyone are morons"
+15:24 <@matches> Fun fact
+15:25 <@matches> Matlab (like fortran actually) will let you use key words as variable names.
+15:25 <@sulix> "It's a feature!"
+15:25 <@matches> Question on CITS2401 exam: "Why is 'ii' preferred over 'i' and 'jj' over 'j' for loop iteration?"
+15:26 <@matches> Both i and j are the complex number sqrt(-1)
+15:27 <@matches> It seems like naming it 'nullptr' instead of 'null' missed an opportunity to stop people naming their variables really confusing things :P
+15:30 <@matches> Well I am infinitely wiser about nullptr now but I don't think it will stop me just using NULL
+16:15 <@matches> This is slowly starting to make sense
+16:35 <@matches> I'm having a bit of difficulty because it's all so optimised for the GPU
+16:35 <@matches> I think what we need is an ObjectRenderer class or similar
+16:36 <@matches> Have one for each type of object and implement RenderUsingGPU and RenderUsingCPU
+16:36 <@matches> I will see what monstrosity I can come up with
+16:36 <@matches> But a lot of that code for the circles and rectangles is exactly the same just copied and pasted with different variable names
+16:37 <@matches> I think there is an official software engineering term for that sort of thing...
+16:46 <@matches> Alright, breaking everything
+16:46 <@matches> This will probably take a while
+16:47  * matches dreads merges
+17:02 <@sulix> Yeah, I was going to basically end up with an ObjectRenderer class, too.
+17:02 <@sulix> So I'll leave it to you for now and procrasinate from doing my maths in some other way.
+17:07 <@matches> Cool :)
+17:52 <@matches> Now I'm not very strict about the whole RAII thing myself, but there seem to be some cases where things can probably just go in the constructor?
+17:52 <@matches> I guess we can fight about those later
+17:54 <@matches> I guess I can see us wanting to set m_render_inited to false and have it automatically recreate everything, maybe, but I can't see a case where we will want to recompile the shaders, so I am going to put the shader initialisation in the constructors
+17:54 <@matches> I have gone mad with power
+17:54 <@matches> Maaad
+20:30 <@matches> This ObjectRenderer is like a two headed hydra
+20:31 <@matches> I thought about using just the ibo and vbo and getting the indices out of it, but that's a bit terrible
+20:31 <@matches> So it will have an ibo for the GPU and an array for the CPU
+20:35  * sulix thinks this makes sense.
+21:47 <@matches> Good news! I have things on the screen. Bad news. They are still on the GPU and they are wrong.
+21:49 <@matches> More coffee required...
+21:58 <@matches> Not sure if code wrong or fglrx having an existential crisis
+22:04 <@matches> Unrelated to the segfaults of doom, but I just realised that there's all this interest in using GPUs for scientific computation, and everything seems to point to them having vastly inferior floating point computation to a CPU, which is a bit disconcerting
+22:05 <@matches> I imagine the OpenCL libraries etc actually use the IEEE floating point capabilities? I hope?
+22:05  * matches files under "beyond the scope of project"
+22:06 <@sulix> If you commit code I can test it on non-fglrx if that'll help.
+22:06 <@matches> I'd rather not commit it just yet, I am 90% sure it is something I have done wrong and don't want to shame myself by committing broken code
+22:06 <@matches> It'd be like vomiting all over the codebase
+22:07  * sulix is pretty sure half of his commits broke something.
+22:29 <@matches> Ok I committed stuff that should in theory work with the test pattern again
+22:30 <@matches> Using new and improved ObjectRenderer classes
+22:30 <@matches> For some definition of improved
+22:30 <@matches> It doesn't actually use the CPU yet
+22:30 <@matches> It'll get there
+22:33 <@matches> You can go and add your MandleBrotSetRenderer now though :P
+22:36 <@sulix> Cool.
+22:37 <@sulix> The circles do trigger that intel driver bug again, though...
+22:38 <@matches> Ah damn
+22:38 <@matches> Would making CIRCLE_FILLED the first ObjectType fix that?
+22:38 <@sulix> It does.
+22:38 <@sulix> (I just checked)
+22:38 <@sulix> Yay intel!
+22:39 <@matches> Haha
+22:49 <@matches> Hey, does our rendering approach completely break compositing?
+22:49 <@matches> Render all circles
+22:49 <@matches> Then render all rectangles...
+22:49 <@matches> There's no depth...
+22:49 <@sulix> Um, maybe.
+22:49 <@matches> :P
+22:49 <@matches> I was just worrying about how to make compositing work using the CPU
+22:49 <@matches> and then I realised it won't work using the GPU as it is either
+22:50 <@sulix> If we're not doing alpha-blending, we could just add a z-coordinate and use the z-buffer.
+22:50 <@sulix> Otherwise, they need to be sorted if they intersect.
+22:50 <@matches> Let's not worry about this for now...
+22:50 <@matches> Even though I spent a rather significant part of my lit review explaining how awesome compositing is
+22:51 <@matches> I guess it doesn't matter, clearly the lit review was not intended for anyone to actually read
+23:42 <@matches> I suspect RenderPixels doesn't work
+23:45 <@sulix> This may be the case.
+--- Day changed Tue Jun 17 2014
+01:05 <@matches> Behold the magnificence of CPU based rendering
+01:06 <@matches> In which we pass a massive pixel array to the ObjectRenderer's and just save it to a BMP
+01:06 <@matches> Because OpenGL
+01:06 <@matches> I'll probably fix it later
+01:11 <@matches> Whoops seg faults ahoy
+01:12 <@matches> Wait I swear it wasn't segfaulting before I commited that
+01:19 <@matches> It segfaults sometimes depending on where you have the view. If you just have one circle and zoom in you can see the amazingly less jagged looking lines.
+01:19 <@matches> That, is a certified result
+10:13 <@sulix> I got the CPU rendered version to show up on the screen.
+10:14 <@sulix> RenderPixels was pretty broken.
+10:38 <@matches> Nice
+10:39 <@sulix> I think the segfaults are it trying to draw outside of the display.
+10:39 <@matches> Yeah
+10:39 <@sulix> I haven't managed to zoom in too much yet.
+10:39 <@matches> My clipping is probably wrongish
+10:40 <@matches> fonttex_frag.glsl? Fear
+10:40 <@sulix> Yeah, the "basictex_frag" file did a bunch of pretty font-specific things.
+10:40 <@matches> Ah
+10:43 <@sulix> The CPU renderer also shows some random lines when there are no outlines on the screen.
+10:43 <@matches> Is it just me or does it look slightly nicer on the CPU when zoomed out a bit
+10:44 <@matches> Well it looks different
+10:44 <@matches> I can't quite work out whether it looks nicer or worse :P
+10:44 <@sulix> Okay, it doesn't segfault if the rectangle outlines are disabled.
+10:45 <@matches> Ah
+10:45 <@matches> Yeah it is setting top/bottom/left/right outside the pixels
+10:45 <@sulix> I think there are just some slightly different edge-case rules when zoomed out.
+10:47 <@matches> With my skills at writing renderers I should be working on the fglrx drivers
+10:47 <@matches> :P
+10:47 <@sulix> Things vanish if you zoom in too much, too.
+10:48 <@matches> Blame it on floats
+10:49 <@matches> The CPU renderer is using a width of 1 pixel less than it should be
+10:49 <@sulix> Why are the floats sinking? :P
+10:49 <@matches> That's unrelated
+10:49 <@matches> It's probably an integer rounding issue somewhere
+10:49 <@matches> When the view gets big something goes to zero
+10:50 <@matches> The CPU renderer transforms everything to pixel positions and then renders using those
+11:02 <@matches> The GPU renderer occassionally leaves off the corners of things
+11:02 <@matches> I never noticed before
+11:02 <@matches> Anyway I think the segfaults are fixed
+11:03 <@matches> Looking at the mysterious disappearances next
+11:04 <@matches> It's integer overflow!
+11:04 <@matches> Facepalm
+11:05 <@sulix> Is it int64_t time?
+11:05 <@sulix> Or magic huge bigint time?
+11:05 <@matches> No I don't think that's necessary
+11:06 <@matches> If the transformed width is smaller or larger than the width of the screen you can surely just ignore it
+11:06 <@matches> Well, depending on what you are drawing
+11:08 <@matches> Well it does matter unless you do some clever maths
+11:08 <@matches> The clever maths was your part of the project...
+11:09 <@matches> So I will just make them int64_t for now
+11:50 <@matches> Pushe
+11:50 <@matches> *d
+11:50 <@matches> I should probably just make all the coorinates into Real instead of int64_t actually
+12:03 <@sulix> Wow: this is pretty awesome.
+12:03 <@sulix> I still get the artefacts, but I have to zoom in a lot more.
+12:03 <@matches> Haha
+12:04 <@sulix> Also, the CPU rendering artefacts and the GPU rendering artefacts are pretty similar on my machine, so it looks like it's just precision causing them.
+12:04 <@matches> That is nice
+15:20 <@matches> I'm trying to do a performance graph. Gnuplot doesn't like it much
+15:20 <@matches> Well actually it's python's crappy interface to gnuplot that doesn't like it
+15:23 <@matches> ... tempted to implement the performance graph in ipdf...
+15:23 <@matches> Just keep adding circles to the document
+15:24 <@matches> So meta
+15:25 <@matches> We need a cool performance graph-y thing
+15:26 <@matches> I think doing it in OpenGL is going to be the least shitty way actually
+15:26 <@matches> This is a wheel that's probably been invented but it was invented wrong
+17:11 <@matches> I've got a performance graph sort of working
+17:11 <@matches> It almost looks like we are doing real science!
+17:13 <@matches> I think we'll need to put some effort into our data analysis though because it's extremely noisy
+17:13 <@matches> Smoothing averages or something
+17:13 <@matches> Smoothing averages are the best
+17:14 <@matches> They make any data look amazing
+17:15 <@matches> Anyway, CPU rendering is only worse than GPU rendering when you force re-rendering
+17:16 <@matches> So well done with the amazingly efficient cached frame buffer
+17:18 <@matches> We can probably make it draw every frame both on the CPU and GPU to compare them in real time
+17:18 <@matches> The possibilities are limitless!
+17:19 <@matches> Graphs graphs graphs!
+17:20 <@matches> Also I did end up using Gnuplot and python (sorry) but I made it slightly less shitty
+17:27 <@matches> I have pushed things
+17:27 <@matches> Also we probably don't need all three of those ways to measure performance
+21:00 <@sulix> I got the graphs working on my laptop: very nice.
+21:00 <@sulix> I can see how more GPU time is used with GPU rendering and more CPU time with CPU rendering quite well, actually.
+21:59 <@matches> So the objects all being in one structure of arrays is sort of inconvenient because the size of objects has to be constant
+21:59 <@matches> Also the size of Real has to be constant
+22:03 <@matches> I guess we could have union {Rect rect, Bezier bezier} and do rectangles and Beziers in the same thing but that is slightly terrifying
+22:04 <@matches> But there's still the problem of Real because as soon as Real becomes arbitrary precision it will start allocating memory and not be fwrite/fread'able
+22:04 <@matches> :S
+22:05 <@matches> You'll still want the struct of arrays because that will make view reparenting much easier
+22:05 <@matches> Gah
+22:06 <@sulix> I'm tempted to just split it by type: Have an array of Rects, an array of Béziers, an array of Circles, etc.
+22:06 <@matches> Yeah but you need to store an "indexes" array as well
+22:06 <@matches> But that might be the least terrible
+22:07 <@matches> Yes that should work
+22:07 <@matches> Our fwrite/fread is still doomed though
+22:07 <@matches> When shit gets Real
+22:07 <@sulix> Yeah, you'd need some indices one way or another.
+22:08 <@sulix> And yeah, we'll need a massive "ConvertWhateverRealIsStoredInTheFileToWhateverRealIsDefined" function or something.
+22:08 <@matches> That will totally be its name
+22:08 <@sulix> (Some old compilers had function name limits... I wonder if modern gcc has)
+22:09 <@sulix> (There is but one way to find out!)
+22:09 <@matches> We don't need an array of circles/ellipses since we get those for free with Rect. Unless you want circular arcs as well as bezier curves
+22:10 <@matches> Which you probably will? So you can approximate beziers
+22:10 <@matches> Anyway I'll worry about adding Beziers first and once we've worked that out others should hopefully be easier
+22:11 <@matches> I was sort of thinking it would be good to be able to define groups of objects as a special object type
+22:11 <@matches> Then you can make paths out of your beziers
+22:11 <@matches> But they won't be fixed size
+22:12 <@matches> Anyway I will see if you have magically solved the problem for me in the morning :P
+22:14 <@sulix> I wouldn't count on it...
+--- Day changed Wed Jun 18 2014
+16:50 <@matches> Behold, the glory of Beziers and Bresenham!
+16:50 <@matches> Breseniers I shall call them
+16:54 <@matches> I'm getting a very strong vibe of "Reinventing graphics technologies from the 1990s" at the moment
+16:55 <@matches> I should probably look at floating point some more
+16:55 <@matches> And reinvent numerical computation technologies from the 1980s
+16:56 <@matches> We need a GPU renderer for the Beziers, and we need to fix save/load to not assume everything is a fixed size, and ...
+16:56 <@matches> Argh
+16:56 <@matches> All the things
+17:00 <@matches> Maybe I'll multithread the CPU rendering too, just to make things more difficult :P
+22:48 <@sulix> So I got some béziers rendering on the GPU.
+22:48 <@sulix> They're not the ones in the document, and they're not in the right spots, though.
+23:12 <@sulix> First 3 béziers are rendering properly on the GPU, then we get corrupted memory or something.
+23:14 <@sulix> Ah: I see, I need some way of uploading which bézier IDs are being used.
+23:41 <@sulix> Okay, Béziers now render on the GPU as well.
+23:43 <@sulix> The code is a little bit ugly, and for that I am sorry, but blame the fact that the GL feature that makes this nice is only about a year old and so nothing supports it.
+23:43 <@sulix> So we're basically uploading all of the raw document data into a huge texture.
+23:47 <@sulix> (If you ask me, the GPU ones also look slightly nicer, though that's probably a bug)
+--- Day changed Thu Jun 19 2014
+13:55 <@matches> From those papers I was under the impression just rendering a bezier on a GPU was an impressive feat, so well done :P
+13:57 <@sulix> (It's basically just a direct port of your CPU implementation, tbh)
+13:59 <@matches> When I zoom out the GPU ones look nicer, there's probably something wrong with my Bresenham implementation
+13:59 <@matches> Although it was mostly shamelessly copied from "Computer Graphics"
+13:59 <@matches> Except they were like "Here it is for 0 < m < 1, the rest can be done by symmetry"
+14:02 <@matches> The lines definitely have gaps on the CPU, and they also seem too thick as you zoom out
+14:02 <@matches> Having said that, I don't think the GPU starts at x0,y0
+14:03 <@matches> Anyway I'm going to implement a Rational number type and see if anything exciting happens (that's how you do research right?)
+14:06 <@matches> Fortunately I sort of did most of this for one of the codejam problems (where it turned out I didn't really need Rational numbers but I thought I did)
+14:20 <@sulix> Fixed the missing bit off the end.
+16:43 <@matches> I suspect Rationals are either not a very good idea, or there is a bug in one of my fundamental operations
+16:43 <@matches> +, -, *, / are hard
+16:56 <@sulix> Is it at least a pretty bug?
+16:59 <@matches> Um...
+16:59 <@matches> No
+17:00 <@matches> It seems buggy for anything other than the {0,0,1,1} starting view
+17:14 <@matches> I suspect it's the expf in the mouse wheel scrolling
+17:14 <@matches> Since you know, exp is definitely not a rational number...
+17:15 <@matches> Hmm, but it shouldn't matter because it will just convert to the nearest rational number
+17:16 <@matches> ie: p = (int64_t)(whatever*1e10) q = (int64_t)1e10
+17:28 <@matches> Oh
+17:28 <@matches> Oh
+17:28 <@matches> Head -> Desk
+17:28 <@matches> Rational & operator*=(const Rational & r) {this->operator=(*this*r); return *this;}
+17:28 <@matches> Rational & operator/=(const Rational & r) {this->operator=(*this*r); return *this;}
+17:29 <@matches> Rational & operator-=(const Rational & r) {this->operator=(*this+r); return *this;}
+17:29 <@matches> I think the worst part is that I actually said "It is probably a bug in my +,-,*,/
+17:29 <@matches> And it still took me this long to notice
+17:30 <@matches> The second worst thing is I've made that sort of mistake like 1000 times before
+17:30 <@matches> The third worst thing is I am recalling that article where the guy says "At least plus and times are sort of the same thing"
+17:30 <@sulix> Feel the power of copy and paste flowing through you.
+17:32 <@matches> Well let's not celebrate just yet, the view still goes to shit. Just slightly slower :P
+17:33 -!- matches changed the topic of #ipdf to: NaNpdf
+17:33 <@matches> Our document supports a view of {-inf,-inf,nan,nan} thus making it truly infinite precision
+17:34 <@sulix> I had that happen a lot when I was writing the original zoom code.
+18:19 <@matches> So I suspect that Rationals are just a really shitty number representation :P
+18:20 <@matches> Specifically, you get integer overflows really really fast
+18:20 <@matches> And if you are going to have a Rational that's BigInt / BigInt you may as well just have a BigFloat
+18:21 <@matches> The ancients were probably right.
+18:21 <@matches> When they decided not to use rationals.
+18:23 <@matches> I guess floats are rationals technically, I mean the representation using P/Q
+18:23 <@matches> I kind of wish I'd done some pure maths here...
+18:23 <@matches> Or paid more attention in second year
+18:28 <@matches> At least I sort of have conclusive evidence that rationals suck. As opposed to "it should be obvious to anyone with half a brain"
+19:00 <@sulix> Floats are not rationals.
+19:00 <@sulix> Not exactly.
+19:01 <@sulix> Something which can be stored in a finite amount of space as a rational cannot always be stored in a finite amount of space as a float, but not vice-versa.
+19:01 <@sulix> e.g.: 1/3
+19:04 <@sulix> Basically floats = rationals where the denominator must be a power of two.
+19:05 <@sulix> (Of course, these are all the same in the limit, but the limit of a cauchy sequence of rationals gives the reals, so the point is kinda moot, there, anyway)
+19:18 <@matches> Yeah floats are a subset of the rationals I think I meant
+--- Day changed Sat Jun 21 2014
+16:22 <@matches> So I got a new smartphone today... I'm having fun trying to zoom in on things
+16:24 <@matches> Actually the zooming isn't annoying so much as the needing to pan around to view all the text in a pdf
+16:25 <@matches> This is what I get for buying the cheapest phone with the lowest resolution they had :P
+16:26 <@matches> I didn't want to get one more expensive than my old one because I'm still convinced I will get around to fixing it one of these days
+16:26 <@matches> Or months. Or years. But eventually.
+--- Day changed Mon Jun 23 2014
+11:51 <@matches> The meeting happened at ~11:30
+12:49 <@sulix> Oh damn. I thought there wasn't going to be one today.
+12:49 <@sulix> What did I miss?
+13:04 <@matches> Basically I told him what we'd done
+13:05 <@matches> Which was rendering on CPU or GPU, and Beziers (but only degree 2)
+13:06 <@matches> And I implemented Rationals but they are terrible, so he sent me some code from an ACM competition about approximating things with Rationals
+13:13 <@sulix> Some javascript guy is trying to convince people that the only numeric data type should be some custom 64-bit decimal thing.
+13:13 <@sulix> A lot of people have started quoting Kahan at him.
+13:20 <@matches> Haha
+--- Log closed Tue Jun 24 16:07:29 2014
+--- Log opened Tue Jun 24 16:17:39 2014
+16:17 -!- matches [[email protected]] has joined #ipdf
+16:17 -!- Irssi: #ipdf: Total of 2 nicks [1 ops, 0 halfops, 0 voices, 1 normal]
+16:17 -!- Irssi: Join to #ipdf was synced in 15 secs
+--- Day changed Wed Jun 25 2014
+21:41 < matches> So... if we need to put a HTTP server in IPDF I've got us covered...
+21:44 <@sulix> You terrify me.
+21:45 < matches> I still have to work out Websockets
+21:45 < matches> They are silly
+21:46 <@sulix> I take it they aren't compatible with regular sockets.
+21:46 < matches> Well you use a TCP socket, but they aren't just plain text
+21:46 < matches> There's a protocol on top of it
+21:46 < matches> It's wired
+21:47 < matches> *wierd
+21:47 < matches> There are frames and things
+21:47 < matches> And copious amounts of base64 encoding the SHA1 hash of a string prepended to a magic string
+21:48 < matches> Apparently this makes it more secure
+21:48  * sulix looks doubtful.
+21:48 <@sulix> I could understand it being more secure if they actually encrypted things.
+21:48 < matches> They have wss:// as well which is just the same thing through ssl
+21:48 < matches> Yes it doesn't make sense
+21:49 <@sulix> But plain "boring" TCP has been used since (I am assured) the beginning of time and there are still one or two things that use it which are not currently being hacked into.
+21:49 < matches> Haha
+21:49 < matches> I'd like websockets so I can control my robot via my phone through its web browser...
+21:50 < matches> I can probably do that without websockets but it will also be useful for humphrey the rabbit
+21:50 <@sulix> Surely with plain old TCP you could control your robot via telnet, which is more awesome and just as user friendly.
+21:51 < matches> :P
+21:51 < matches> It will have a webcam image though
+21:51  * sulix mutters "ASCII art" under his breath.
+21:52 < matches> I figure if I implement everything in C++ it will be less "Webby"
+21:52 < matches> And more segfaultastic
+21:52  * sulix has a new favourite word.
+--- Day changed Thu Jun 26 2014
+14:58 < matches> I think the WebSocket RFC put this "Framing" business in just to confuse people
+14:58 < matches> My RFC Compliant* WebSocket server just sends the entire message in a single frame
+14:59 < matches> Doesn't TCP already do framing or something
+15:00 < matches> I mean, they specifically allow for frames with up to 2^63 bytes
+15:00 < matches> Sorry, bits not bytes
+15:02 < matches> So server -> client is pretty much TCP but you stick some stupid frame guff on the message
+15:02 < matches> client -> server involves... "masking"
+15:02 < matches> There are several long paragraphs on it
+15:10 < matches> I'm going to pretend this is related to precision
+--- Day changed Wed Jul 02 2014
+17:30 < matches> I put the code repository on github
+17:32 < matches> This is where a more hip and cool person would say something like "#yolo" but I prefer to wonder how I got 26K of lines and you have 65K...
+17:32 < matches> "How many lines of code does it take to draw a rectangle?" 91000
+--- Day changed Fri Jul 04 2014
+12:59 < matches> Found my rational bug
+13:00 < matches> ...
+13:00 < matches> Copy paste strikes again
+13:00 < matches> My operator/ looked suspiciously similar to operator+ -_-
+13:00 < matches> -____-
+13:02 < matches> Not sure how it got like that, it was definitely working at one point
+13:02  * matches should probably use git properly
+13:12 < matches> Pushed it
+13:21 < matches> So yeah, it should work fine until you zoom
+13:21 < matches> Then crazy things happen
+16:44 < matches> I think all the references you added at the last minute break my litreview
+16:45 < matches> (he says several months later :P_
+21:00 <@sulix> Question: in Rational::Simplify(), why is (-P)/(-Q) becoming (-P)/(Q) rather than P/Q?
+21:01 <@sulix> Shouldn't P = -P here? http://git.ucc.asn.au/?p=ipdf/code.git;a=blob;f=src/rational.h;h=41cce09078b4e96eb17a6bb6e28478ea64637b57;hb=HEAD#l74
+21:02 <@sulix> Also zoom can be improved (but not totally fixed) by reducing precision when overflow would be possible.
+21:19 < matches> Yeah, that's the idea of using the Stern Barcot tree Tim was talking about
+21:20 < matches> Which I still need to read about
+21:20 < matches> Also yes P should be -P because I am just that amazing at maths
+21:22 < matches> In other news assembly happened
+21:22 < matches> http://git.ucc.asn.au/?p=ipdf/code.git;a=blob;f=src/tests/add_digits.s
+21:22 < matches> Which no doubt has terrible bugs in it :P
+21:23 < matches> It was a bit confusing how passing and returning arguments with x64 was completely and utterly different from x86 and almost every tutorial is from at least ten years ago talking about x86
+21:24 < matches> x64 is actually much easier though
+21:25 < matches> At least, I think they are different, I didn't have to mess with the stack which seemed to be a thing with x86 and also that motorolla language we used in first year
+21:25 < matches> Just got all the arguments in a bunch of registers
+21:31 <@sulix> I think I just worked out why you have 16 "inc" instructions, and am loving it!
+21:32 <@sulix> inc doesn't change flags!
+21:32 < matches> I wonder if it would be faster to just store the carry flag in a register though
+21:33 < matches> Actually probably not because there'd be branches involved
+21:33 < matches> Hmm
+21:33 <@sulix> Traditionally, mucking about with flags is slow.
+21:33 < matches> Yep cool
+21:34 < matches> I've got the AMD64 ABI
+21:34 < matches> Chapter 2 is a good one
+21:34 < matches> "Software Installation"
+21:35 < matches> "This document does not specify how software must be installed on an AMD64 architecture machine"
+21:35 < matches> End chapter
+21:35 <@sulix> Just a thought, can use use the lea instruction instead of all of those incs.
+21:37 <@sulix> Like lea rsi, [rsi+8h]?
+21:37  * sulix ponders.
+21:38 < matches> Maybe, my assembly is very rusty and was based on those ELEC1301 labs in the first place...
+21:38 < matches> I don't even remember if they had lea
+21:39 <@sulix> (Also I just got a message from KDE: "could not launch a process. perhaps you have reached the limit of running processes")
+21:39 < matches> :S
+21:40 < matches> When did you last reboot?
+21:40 <@sulix> This morning, actually.
+21:40 < matches> Integer overflow in PID?
+21:40 <@sulix> It looks like it was an out-of-memory problem.
+21:40 <@sulix> On a related note, the intel instruction set documentation is a 3 and a half thousand page pdf.
+21:41 <@sulix> and firefox has a PDF viewer written in javascript.
+21:41 <@sulix> ...that runs by default.
+21:44 < matches> Hahaha
+21:44 < matches> Yes, pdf.js is apparently the best thing since sliced bread...
+21:45 < matches> I'm having some difficulty with lea, possibly the syntax
+21:47 < matches> "lea (%rsi+8), %rsi" is wrong
+21:48 <@sulix> Yeah, gcc's assembler uses whacked syntax.
+21:48 < matches> I thought it was just () instead of [], add % to all the registers, and swap destination and source
+21:48 <@sulix> http://git.ucc.asn.au/?p=ipdf/code.git;a=blob;f=src/tests/add_digits.s;hb=HEAD
+21:49 <@sulix> They replaced the arithmetic operators with strange things, too.
+21:49 < matches> Riight
+21:49 < matches> Thanks
+21:49 < matches> So 8(,%rdi,1) means [rdi+8]
+21:49 < matches> That is dumb
+21:49 <@sulix> I'm not sure if it's worth using nasm or the ".syntax intel" directive.
+21:51 < matches> Hopefully there won't be too much more assembly to write...
+21:51 <@sulix> Technichally lea (and other memory addressing instructions) take the form "[register+register*(1,2 or 4)+(number)]" in intel and "number(%register,%register,(1,2 or 4))"
+21:51 <@sulix> in gcc
+21:51 < matches> ok
+21:51 < matches> Well once I know the syntax I can cope with it
+21:51 < matches> But all the documentation being written in a different syntax doesn't help :P
+21:52 <@sulix> Yeah, there are a lot of people who hate gcc syntax, which was an (unsuccessful) attempt to make assembly for different machines more consistent)
+21:52 < matches> I decided to go with it because I vaguely remembered your commander keen patches looked like they were in gcc syntax :P
+21:53 <@sulix> Hah: they were in "ckpatch" syntax.
+21:53 <@sulix> And were just the final output bytes.
+21:53 < matches> The memory can play strange tricks...
+21:54 <@sulix> I used the "debug.com" utility that came with dos to assemble them, which let you write assembly to arbitrary memory.
+21:54 <@sulix> and then read the contents of that memory to see what it assembled down to.
+21:55 < matches> So, I need subtraction and multiplication but not division to implement arbitrary rationals
+21:55 < matches> I'll try sort those out tomorrow
+21:56 < matches> I'm pretty sure I'm doing better than at least one arbitrary integer representation
+21:56 < matches> Which had a int32_t word and int64_t "double" word
+21:56 < matches> So they could tell if they had a carry by doing the additions using double words
+21:57 < matches> The code in C was longer than add_digits is in assembly
+21:57 < matches> Although to be fair it might actually work on things that aren't amd64
+21:57 <@sulix> Well, the good news is that there's an "sbb" instruction like "adc"
+21:57 < matches> Excellent
+21:58 <@sulix> The bad news is that multiplication is harder.
+21:58 < matches> Yeah, at least I don't need division though
+21:59 < matches> Although converting it to a string will be annoying
+21:59 <@sulix> IIRC, the IMUL instruction gives an output twice as long as the inputs, to prevent overflow.
+22:00 <@sulix> Converting to a string won't be so bad if you get division done.
+22:00 <@sulix> And you can always just implement multiplication and division by slow recursive addition/subtraction.
+22:03 < matches> There's a bunch of papers on number representations that use things that aren't floats or rationals from a quick look
+22:04 < matches> I guess I just need to implement as many things as possible and compare them all
+22:04 < matches> Seems easy enough...
+22:04 < matches> (Famous last words)
+--- Day changed Sat Jul 05 2014
+11:09 < matches> Well... subtraction took me two seconds
+11:09 < matches> Should probably have just done it last night
+11:09 < matches> I got distracted
+11:09 < matches> By someone actually using my websocket library
+11:09 < matches> Does this mean I'm officially an open source developer now
+11:09 < matches> I didn't even give it a license :S
+11:11 < matches> Hmm
+11:12 < matches> Multiplication...
+11:12 < matches> It is tempting to just use a for loop and call the += operator...
+11:40 < matches> I'll do that for now I think
+11:41 < matches> Once += actually works
+11:41 < matches> Turns out I will definitely need division also
+11:42 < matches> I was looking at the rationals going "There are no divisions here!"
+11:42 < matches> But there are
+11:42 < matches> In the gcd
+11:42 < matches> Mind you maybe I don't need to call gcd if I have arbitrary integers :P
+11:42 < matches> Just use all the memory
+12:39 < matches> Ok for loop for multiplication is not easy
+12:39 < matches> Bah
+12:39 < matches> Having to actually learn assembly properly
+12:40 < matches> I mean I could use a for loop but it would have to use an Arbitrary integer and take a very long time...
+12:47 <@sulix> There's no need to have a for loop index > 64bit because there will never be enough memory for an integer that big.
+12:47 < matches> True
+12:54 < matches> Putting "_asm" in filenames so that our Makefile can do the .s files is kind of irritating
+12:54 < matches> Would naming them .cpp work? That would be even more irritating though!
+12:54 < matches> Oh well it compiles
+12:58 < matches> I bet it turns out 128 bit integers would have been more than sufficient for any zoom range people could feasibly get to by scrolling
+13:15 <@sulix> I'm told 256-bit integers can represent the visible universe to the width of a proton or something.
+13:45 < matches> I might put a maximum length in once this works
+13:45 < matches> So I'm not doing a Java
+13:46 < matches> Where 1/3 becomes "Runtime Exception!"
+13:46 < matches> That's with BigDouble not BigInt but whatever
+14:00 < matches> I must admit, assembly is pretty nice for this sort of thing
+14:00 < matches> At least, the inner operations
+14:00 < matches> Not for managing the memory
+15:29 < matches> Alright. We have an Arbint class that is equivelant to an int64_t when it only has one digit.
+15:30 < matches> I'm not sure how to test that extra digits function correctly
+15:30 < matches> Other than just looking at a few cases and going "Yep that looks right" :S
+16:40 < matches> Well... somewhere along the way I lost kcachegrind and now I seem to have to run dist-upgrade to get it back
+16:41 < matches> Currently 10% of the way through upgrading tex-live...
+16:41 < matches> The mystery of just how shitty the Arbints are will have to wait
+16:42 < matches> Well it's clear they are shitty but I suspect there is a bug in division
+16:42 < matches> Maybe I should actually read my code
+16:42 < matches> Blargh
+16:47 < matches> Ok constructing a rational takes infinite time
+16:51 < matches> Ah, 1 % 1 == 1
+16:51 < matches> That is definitely not correct :P
+17:56 < matches> Oh my goodness I just rendered a frame
+17:56 < matches> On the GPU...
+18:00 <@sulix> Hmm...  {add,sub}_digits_asm.s are missing from git.
+18:05 < matches> Really
+18:05 < matches> Whoops
+18:07 < matches> There you go
+18:07 < matches> Addition, subtraction, multiplication should be fine, I need to actually do division properly
+18:08 < matches> Also probably pow at some point
+18:08 < matches> Since pow still just casts things to doubles
+18:22 <@sulix> It works!
+18:22 <@sulix> (Eventually)
+18:24 < matches> Haha
+18:24 < matches> Of course it's still in the single digit range
+18:24 < matches> Or did you manage to wait long enough to zoom a bit
+18:25 < matches> I'm sure I can make this division better if I use some kind of binary searchish type algorithgm
+18:25 < matches> I could look up the proper algorithm too I guess
+18:25 <@sulix> Yeah, I was thinking binary search.
+18:26 <@sulix> You'd want a decent bitshift implementation.
+20:32 < matches> Yeah it is more difficult than I thought
+20:33 < matches> I'm going to need "shift_digits" assembly functions
+20:33 < matches> C style bit shifting has too many wierd edge cases
+20:36 < matches> 0x7000000000000000 >> 3 == 0x0e00000000000000 ?
+20:36 < matches> There are more bits set in the second number than the first!
+20:38 < matches> And unlike multiplication where it fills an extra register for you, you just lose the extra bits with shr and shl :S
+20:39 < matches> Except for a carry
+20:39 < matches> So I'd have to do a loop one bit shift at a time
+20:39 < matches> Blergh
+20:40 < matches> I shall resume my epic battle with primary school level mathematics tomorrow
+--- Day changed Sun Jul 06 2014
+00:32 <@sulix> long division of an arbint by a uint64 worksish.
+09:47 <@sulix> long division of an arbint by a uint64 now actually works and is less obviously badly designed
+10:32 < matches> Thanks...
+10:33 < matches> In other news I seem to have broken X again
+10:34 <@sulix> Oh no!
+10:35 < matches> We need an ASCI renderer...
+10:36 <@sulix> That can not possibly end badly.
+10:40 < matches> shouldn't be too hard...
+10:40 < matches> Lets see if reinstalling fglrx works
+10:41 < matches> I need to add that to a boot script :S
+10:42 < matches> uhoh installation failed
+10:48 <@sulix> Hmm... enabling optimization makes Arbint segfault.
+10:49 < matches> You should probably make quadtrees
+10:50 < matches> Although I admit you're better at Arbints than me :P
+10:50 <@sulix> Yeah... I should.
+10:50 <@sulix> But segfaults...
+10:51 < matches> Yeah somewhere in std vector I had some as well
+10:51 < matches> I think I might change to a custom dynamic array
+10:52 < matches> Then fast copying is easier
+10:52 <@sulix> Yeah, it's segfaulting in std::swap somewhere, I think.
+10:52 < matches> I'll fix it when I have X
+10:53 < matches> Or an ascii renderer...
+10:54 < matches> Probably more realistic at this stage
+10:55 <@sulix> I'm pretty certain there's a unicode character for "face of disapproval due to fglrx bugginess".
+10:56 < matches> Yeah but when you try and render it you get a seg fault
+11:24 < matches> Woo, xvesa
+11:26 < matches> I see what you mean about fglrx being hard to remove
+11:58 <@sulix> So: quick profile. 98% of frame rendering time is spent in Arbint::Division.
+11:59 < matches> Yeah
+12:00 < matches> I *was* trying to install kcachegrind you know
+12:00 <@sulix> The vast majority of that time is spent in malloc and free.
+12:01 < matches> Well copy constructing an Arbint requires copy constructing the vector
+12:01 < matches> I'll investigate
+12:01 < matches> Now I have X again
+12:01 < matches> Go make a quad tree
+12:02 <@sulix> Also, should add_digits clear the carry flag at the beginning?
+12:02 < matches> Hmm
+12:02 < matches> Probably
+12:02 < matches> Yeah
+12:09 < matches> I suspect having a copy-on-write Arbint won't help as much as having a non-terrible division algorithm so I'll try fix that first
+12:09 < matches> But copy-on-write Arbint shouldn't be too hard
+12:09 < matches> Oh unless the original changes
+12:10 < matches> Yeah it would be hard
+12:10 < matches> I'm sure I did something like it before
+12:10 < matches> Back when I actually made my own data structures instead of just using std::vector
+12:15 <@sulix> My custom vector class: http://davidgow.net/stuff/DynamicArray.h
+12:15 <@sulix> Probably won't compile without a bunch of other files, though.
+12:16 < matches> I think I have several, in different versions of neurosis
+12:16 < matches> Which was never under git
+12:16 < matches> Some of them were prone to segfaults though
+12:17 < matches> So, will you have some kind of quad-tree-y thing by monday? :P
+12:17 <@sulix> Mine works, but doesn't call constructors or destructors, so it's only really useful for ints/floats/pointers or structs thereof.
+12:18 <@sulix> I have a "struct QuadTree".
+12:18 <@sulix> (You can't do anything with it, but the basic idea is there)
+12:20 < matches> My shifting operators might not have been as fith as I thought last night
+12:20 < matches> Since 7 and e do actually have the same number of bits
+12:21 < matches> I'm not sure where that came from
+12:21 < matches> Ah dammit
+12:21 < matches> Cannot find -lGL
+12:22 <@sulix> Try just removing that from the Makefile
+12:22 <@sulix> I think when I GL-3'd everything I made it load libGL at runtime.
+12:23 < matches> Well it will compile but I get glx errors
+12:23 < matches> I get similar errors running glxinfo though...
+12:24 < matches> Odd
+12:26 <@sulix> I think you still have some of fglrx breaking things.
+12:26 <@sulix> It replaces the system libGL.so
+12:26 < matches> I installed mesa's stuff
+12:27 <@sulix> You need to also get the version of libGL that runs as part of the X server, IIRC.
+12:28 < matches> I'll try some apt-get --reinstalls
+12:29 < matches> I think most of my problems were that debian was going "You don't have a graphics driver, here, have one" and then things were breaking and reinstalling fglrx would give me graphics but leave me with a partially installed debian driver as well :S
+12:30 < matches> Well ok
+12:30 < matches> most of my problems were fglrx
+12:30 <@sulix> I remain sceptical that installing fglrx by hand will ever cause anything that is not pain.
+12:30 < matches> Well it worked better than the open source drivers for a very long time
+12:30 < matches> It all ended in tears and segfaults though
+12:32 < matches> Also it worked better than the non-free fglrx package in the debian repos which always ended in tears and segfaults
+12:33 <@sulix> I use the non-free nvidia package, which works fine, even if it is horribly outdated.
+12:34 <@sulix> I'm scared of the sheer amount of ripping up the rendering code getting quadtrees working will take.
+12:39 < matches> Haha
+12:40 < matches> It might be easier to do the CPU rendering in quad trees first?
+12:40 < matches> I'm not quite sure how you'll do it
+12:41 < matches> CPU rendering at least gives you direct control over the rendering target as a pixel buffer
+12:41 < matches> GPU rendering is a bit shady (ho ho)
+12:41 <@sulix> ...
+12:42 <@sulix> That was terrible, yet accurate!
+12:42 < matches> With the CPU rendering we're already passing the objects list, view, and target bounds
+12:42 < matches> So maybe you can adapt View or something to be quad-tree-ish
+12:43 < matches> Good luck
+12:44 <@sulix> Yeah, the current plan is to adapt the rendering stuff to accept a "first object id" and "last object id", and then only render those.
+12:47 < matches> Hmm, you could call RenderUsingCPU with a different target pixel buffer for each part of your quad tree or something
+12:48 < matches> Oh well, hopefully I can adapt whatever you do into RenderUsingASCII :P
+12:49 < matches> I don't need GLX working to try and fix division but I'd really like to have GLX working
+12:49 < matches> Sigh
+13:12 < matches> I'm making progress, instead of reporting an invalid operation glxinfo segfaults now
+13:13 < matches> So I have the wrong libraries or something... how to get the right ones...
+13:32 <@sulix> Woo. I got it compiling again!
+13:32 <@sulix> And the rendering is only half-wrong.
+13:33 < matches> Nice
+13:33 < matches> Manually deleting anything on my system with fglrx in it...
+13:34 <@sulix> Someone really needs to write an "fglrx removal guide".
+13:34 < matches> I'm not sure why reinstalling the radeon driver and mesa isn't actually giving me a libGL
+13:34 < matches> At least
+13:34 < matches> I suspect it is just leaving the existing broken one
+13:36 <@sulix> So it turns out that *2 I don't understand is important.
+14:01 < matches> Ok
+14:01 < matches> I have glxgears
+14:01 < matches> An epic achievement
+14:01 < matches> I had to go back to fglrx but at least this time its the debian packaged version
+14:02 < matches> The radeon driver seems to work better for stuff that isn't glx
+14:03 < matches> Which is pretty cool but I kind of like glx actually working
+14:11 < matches> Ok... time to fix division
+14:11 < matches> Finally
+14:11 < matches> No wait time for coffee
+14:11 < matches> Then time to fix division
+14:24 < matches> Did you test the div_digits function at all?
+14:25 < matches> # We want to point to the end of the buffer (LSB)
+14:25 < matches> Aren't I doing it the other way around...
+14:25 < matches> I'll test it
+14:28 <@sulix> With long division you do things in the opposite direction to addition.
+14:29 <@sulix> I tested it with some simple things and it worked.
+14:34 < matches> Hmm
+16:35 < matches> Well the good news is that division is faster now
+16:35 <@sulix> Cool!
+16:36 < matches> The bad news is that I can't see anything
+16:36 < matches> Even when GPU rendering
+16:36 < matches> Also segfaults
+16:36 <@sulix> I've just pushed some initial quadtree-enabling breakage.
+16:36 < matches> I didn't work out how to apply the div_digits to a multi digit number either
+16:36 <@sulix> Yeah, I thought about that, then went to bed.
+16:36 < matches> I might convert the current algorithm which is all based on bit shifting
+16:36 < matches> To assembly
+16:37 < matches> But maybe not
+16:37 < matches> Actually being able to see something render would be good even if it were slow
+16:37 < matches> Then I can think about making it faster
+16:38 <@sulix> The old one had all of the beziers connected for no readily apparent reason.
+16:38 < matches> I have a tester called "Arbitrary Rationals" (arbrationals.cpp) which sounds like some kind of political party
+16:39 < matches> A rather indecisive political party
+16:39 <@sulix> That's amazing.
+16:48 < matches> Ah, I might be having trouble with the sign of things, hm
+16:49 < matches> Rational 15625/288230376151727369 (0.000000) is not close enough at representing 1.000000 (1.000000 vs 0.001000)
+16:49 < matches> That doesn't look like a sign problem...
+16:52 <@sulix> I admit, 15625/288230376151727369 is not really similar to 1.
+16:54 < matches> So, somewhere along the way Arbint(1e6) became 15625 and Arbint(1e6) also became 288230376151727369 ?
+16:54 < matches> Uninitialised things?
+16:54 < matches> Constructing from int64_t seems fine
+17:00 < matches> That amazing moment when it works perfectly and then you realise that's because you compiled with reals as doubles and not rationals
+17:00 <@sulix> Ha: I've done that a few times.
+17:19 < matches> Maybe I shouldn't have pulled your latest commit
+17:19 < matches> Now I have two problems :(
+17:22 < matches> Meeting tomorrow
+17:22 < matches> "So how much progress have you made?"
+17:22 < matches> "Segfaults are up 100% to a record high!"
+17:26 < matches> Oh ok
+17:26 < matches> I'm not sure if this is new
+17:26 < matches> But if there is nothing in the document the GPU rendering doesn't like it
+17:27 <@sulix> Hmmm... there might be some issues with that.
+17:28 < matches> Ok
+17:28 < matches> Rectangle renders
+17:28 < matches> With arbitrary rationals
+17:28 < matches> In the default view
+17:29 <@sulix> Ooh!
+17:31 < matches> I'm going to commit this even though it's totally broken
+17:32 <@sulix> Things being broken hasn't stopped me from committing them.
+17:35 < matches> I love this though
+17:35 < matches> When you activate CPU rendering
+17:36 < matches> You get like a billion errors from Rational<Arbint>::CheckAccuracy
+17:36 < matches> And then the Bezier appears!
+17:36 < matches> Magically!
+17:36 < matches> I guess I shouldn't rule out a bug in CheckAccuracy :P
+17:36 < matches> Although zooming will definitely cause a segfault
+17:38 <@sulix> I tried running the really slow version under valgrind, but that turned out to be a bad idea.
+17:39 < matches> I've pushed the slightly less really slow version
+17:39 < matches> That is still really slow
+17:39 < matches> I can't install kcachegrind
+17:39 < matches> It is really annoying
+17:40 < matches> There aren't any valgrind analysis things that don't require the entirity of KDE are there?
+17:40 < matches> Or should I just learn how to read the raw output files
+17:40 <@sulix> Cool: it works.
+17:41 <@sulix> (I dunno, I just use KDE :P)
+17:41 <@sulix> You can try "perf" or "oprofile".
+17:41 < matches> Well I can't even install KDE :S
+17:41 <@sulix> They're terminal-based.
+17:41 <@sulix> Well, perf is, at least. There's a gtk+ oprofile gui.
+17:41 <@sulix> They both measure the entire system by default though.
+17:43 <@sulix> Rational::Simplify is ~54% of time (w/ GPU rendering) with the new build, according to callgrind.
+17:50 < matches> I'm a little confused by some of the outputs of Rational::CheckAccuracy given that it does actually seem to render the bezier properly on the CPU
+17:50 < matches> I think the segfault might be related to my (ab)use of things like memcpy on std::vector::data()
+17:52 < matches> Also I think I've fixed my dependency hell
+17:52 < matches> Well
+17:53 < matches> Depending on how this turns out I will end up with the entirity of KDE hopefully including kcachegrind, or I will end up with no X again
+17:53 < matches> And much swearing will ensue
+17:54 <@sulix> Yeah, it segfaults immediately if you enable optimization level 2 or higher.
+17:55 < matches> Hm
+17:56 < matches> I'll probably get rid of std::vector then
+17:57 <@sulix> The problem I'm seeing is in the vector<Bezier>::push_back() bit, so who knows what is going on.
+17:58 < matches> Oh that's odd
+17:58 <@sulix> Okay, don't run it in valgrind.
+17:58 <@sulix> I'm getting about 200 "uninitialized values" a second in the nVidia driver.
+17:58 < matches> But I just installed kcachegrind!
+17:59 <@sulix> (Oh wait, that was with REAL=double)
+17:59 < matches> Haha
+18:00 < matches> Wait, vector<Bezier>::push_back causes problems even with REAL=double :S
+18:00 <@sulix> Nah, the nVidia driver seems to.
+18:01 <@sulix> I've now compiled again with REAL=5 and I'm getting a number of invalid reads off the end of the vector<digit_t> in GetBit()
+18:02 < matches> Division
+18:02 < matches> Oh
+18:02 < matches> oooh
+18:02 < matches> > -> >=
+18:02 < matches> ...
+18:03 <@sulix> Well, my first attempt to fix it just broke rendering.
+18:04 <@sulix> Ah, yep, I see it.
+18:05 < matches> I think I need to do less memcpy/memseting and more std::vector::operator= -_-
+18:05 < matches> I mean, they implemented it for a reason
+18:05 <@sulix> So, with that change it no longer segfaults!
+18:05 <@sulix> (It corrupts memory and throws an exception instead)
+18:05 < matches> Woah
+18:06 < matches> I changed Arbint operator= to use std::vector operator=
+18:06 < matches> And now I get a filled circle on top of my bezier...
+18:07 < matches> Ok, I will rewrite Arbint to just rely solely on std::vector operations
+18:08 < matches> That might slow it down but it's impossible to test that the maths works properly with all these memory errors
+18:09 <@sulix> Should you be using m_sign more often?
+18:09 <@sulix> It seems to be "forgotten" in a number of places...
+18:10 <@sulix> Hmm... everything looks like it's working at the moment, actually.
+18:10 < matches> What else did you change?
+18:10 < matches> Try zooming
+18:11 < matches> That will break it
+18:11 <@sulix> Zooming seemed to work, actually.
+18:11 < matches> Are you sure you compiled with REAL=5
+18:11 < matches> The sign is a bit wierd
+18:12 <@sulix> It works for a little bit, then the view bounds suddenly become huge.
+18:12 < matches> Haha
+18:12 <@sulix> For no reason, the y coordinate jumps to 10^8.
+18:13 <@sulix> Also after you've zoomed, sometimes translating goes in the wrong direction or is otherwise broken.
+18:15 < matches> That might be related to m_sign...
+18:15 < matches> The joys of implementing your own number representation
+18:16 <@sulix> Trying to "fix" the sign fixed zoom, but broke translation even more.
+18:18 <@sulix> Also: best representation of 1 ever: 9223372036854775807/9223372036854775807
+18:18 < matches> Hahaha
+18:18 < matches> Oh
+18:18 < matches> I think I commented out a Simplify() somewhere :P
+18:18 < matches> No
+18:18 < matches> I didn't
+18:18 < matches> Hmm
+18:19 < matches> Well I am going to push some minor changes
+18:20 <@sulix> Also: T g = gcd(T(llabs(P)),T(llabs(Q)));
+18:20 <@sulix> Is that "llabs" truncating everything?
+18:20 < matches> ...
+18:20 < matches> Probably
+18:20 < matches> !
+19:05 <@sulix> Well, my attempt to write a templated abs() function that worked for Arbint may have worked, but it crashed X before I could find out.
+19:05 <@sulix> I do not want to know how that is possible.
+19:05 < matches> Heh, I was trying to do that before dinner
+19:06 < matches> I just got segfaults
+19:08 < matches> Oh 
+19:08 < matches> I see
+19:08 <@sulix> I suspect the best thing for me to do is to just stash all of my changes and break some more quadtrees.
+19:08 < matches> Yeah
+19:08 <@sulix> But first I'll have to get X working again.
+19:08 < matches> The problem with overriding llabs is that the constructor for Arbint calls llabs...
+19:08 < matches> And Arbint has a constructor from int64_t...
+19:09 < matches> So as soon as you implement llabs using Arbint it will call itself for eternity
+19:09 <@sulix> I made a new function called "real_abs" (because "i_went_to_the_gym_now_look_at_my_abs" was too long) and just used that.
+19:09 < matches> Bahaha
+19:10 <@sulix> Then X started using 100% of my CPU and nothing responds to anything.
+19:10 < matches> :S
+19:10 <@sulix> The mouse cursor still moves, but everything else is a black screen.
+19:11 <@sulix> Excellent, "sudo pkill -9 Xorg" has made everything work again.
+19:12 <@sulix> (And even fixed an unrelated problem, which is good but worrying)
+19:17 <@sulix> Note to self: if something crashes X when you run it once, don't run it again after fixing X.
+19:18 < matches> Haha
+19:18 <@sulix> Now to try it for a third time.
+19:18 < matches> I've got an abs working
+19:18 <@sulix> Ah, excellent.
+19:19 <@sulix> Does it make things better? Worse? The same but slower?
+19:19 <@sulix> Crash X?
+19:20 < matches> It doesn't crash X but I think I have an infinite loop in gcd now
+19:21 < matches> I should probably work out why X/X for really big X is not simplifying to 1/1
+19:43 < matches> So it turns out it's a pretty good idea to have a tester that actually tests lots of different numbers with every single operation
+19:43 < matches> As opposed to
+19:43 < matches> "1/2 == 0.5" yep looks good she'll be right
+19:43 < matches> One could say
+19:43 < matches> There are *signs* of serious problems
+19:44  * matches puts on sunglasses
+19:44 < matches> No wait I got the order wrong
+19:44 < matches> Oh well I wasn't cool enough to watch that show anyway
+20:18 < matches> So now I have a tester that actually tests things
+20:18 < matches> I just need to blindly fumble around with m_sign until all the tests are passed!
+20:18 < matches> Right?!
+20:26 < matches> Heh, it's amazing how many errors fixing the sign in Division prevents
+20:27 < matches> Well amazing until you realise that every single Rational calls a division at least once
+20:44 <@sulix> Hmmm... there seem to be a lot of cases where we get things becoming 1 (randomnumber/randomnumber) instead of what they should be, according to CheckAccuracy.
+20:46 < matches> Yeah
+20:46 < matches> It should work nicer nowish
+20:46 < matches> At least, the tester works most of the time...
+20:46 < matches> It still randomly fails sometimes
+20:46 <@sulix> Yeah, it's working much better.
+20:46 < matches> Now 12% of the time is in std::vector::size()
+20:46 <@sulix> All of the things I've seen have been to do with subtraction in ScaleAroundPoint()
+20:47 < matches> Ah
+20:47 < matches> Wait I haven't pushed the 12% in std::vector::size yet
+20:47 < matches> tl;dr I was allocating one extra digit every single addition operation and then deleting it if it wasn't used
+20:48 < matches> Because I am just that good :P
+20:48 < matches> I suspect the Arbint is going to break when it actually does need to resize itself
+20:49 < matches> But for now I will settle for "At least as good as an int64_t"
+20:49 < matches> * But slower
+20:49 <@sulix> I'm curious as to why digit_t is int64_t and not uint64_t.
+20:49 < matches> Oh it is uint64_t now
+20:49 < matches> It was int64_t mainly because geany doesn't syntax highlight uint64_t
+20:50 <@sulix> Ah.
+20:50 < matches> Then I realised being int64_t instead of uint64_t broke the shift operators
+20:50 < matches> Because they try to preserve the sign
+20:50 <@sulix> Shift on signed ints is undefined behaviour, IIRC.
+20:51 < matches> Yeah I was considering writing the shift in assembly but its easier to handle the underflow/overflow into the next digit in C
+20:52 < matches> Zooming is still incredibly slow
+20:54 < matches> In fact it is infinitely slow
+20:54 <@sulix> I once waited about 10 minutes and did get another frame.
+20:54 < matches> In fact the Arbint appears to want to grow an infinite number of 0L digits
+20:55 <@sulix> Ah ha! I have realised why CheckAccuracy is only throwing errors on "-".
+20:55 <@sulix> The CheckAccuracy calls for everything else have been commented out,
+20:55 < matches> They should all be commented out so I can use tests/realops.test instead
+20:57 < matches> 23 / 12000 operations failed... doesn't seem too bad...
+20:58 <@sulix> Keep in mind that == isn't precise as it casts to doubles.
+20:58 < matches> You get more like 40 out of Rational<int64_t>
+20:58 < matches> Yeah they are "equal" if it is within 1e-1 :S
+20:58 < matches> I'm searching for the more totally catastrophic failures like the wrong sign first :P
+21:20 < matches> Ok tomorrow I might just try using boost arbitrary integers or something
+21:28 <@sulix> All of the failures I'm getting are with "/="
+21:28 <@sulix> Except one, which was only just outside the error bounds, so probably the doubles' fault.
+21:30 < matches> I was restricting the test values somewhat though
+21:30 < matches> (With rand()%100 + 1)
+21:33 <@sulix> You do know that the Rational<Arbint> -> double conversion is totally broken if either P or Q have > 1 digit.
+21:33 < matches> Yeah I noticed that
+21:37 <@sulix> Oh man, re-enabling the operator double on Arbint totally breaks things.
+21:40 < matches> Yeah don't touch it
+21:40 < matches> Basically touching anything will totally break something else
+21:40 < matches> :S
+21:40 < matches> I should probably sleep some more before attempting to fix things
+21:40 <@sulix> The other bug I just found is that Arbint didn't have the unary "-" operator, so writing "-P" would silently cast to int64_t.
+21:41 < matches> Ah ok
+21:41 < matches> I thought unary - was equivelant to "0 - x" but I suppose that doesn't make sense
+21:41 <@sulix> Nah, it has to be written explicitly.
+21:44 <@sulix> Okay, I think I've got realops.test down to 0 errors with Arbint.
+21:45 < matches> Well you're doing better than me
+21:46 <@sulix> I'm running it with a huge number of tests now.
+21:47 <@sulix> 85.95% of my entire computer's processing time is in IPDF::Rational<IPDF::Arbint>::operator/=
+21:48 < matches> Can you push what you have?
+21:48 <@sulix> Yeah, I will in a second.
+21:48 <@sulix> It's basically a lot of hacks.
+21:49 <@sulix> CPU rendering is broken, though.
+21:49 < matches> There were cases where it would grow an infinite number of digits; did you fix those?
+21:49 <@sulix> Probably not: it still gets very, very slow zooming.
+21:51 < matches> Yeah there's something wrongish it shouldn't need extra digits so fast
+21:51 <@sulix> Pushed now.
+21:52 <@sulix> Now to look at the diff and see what I actually changed.
+21:53 < matches> Oh
+21:54 < matches> Simplify call in Rational operator= is good
+21:56 < matches> I think I fixed some more bugs but I also introduced an infinite loop so...
+21:57 < matches> How is the quad tree bit going :P
+21:57 <@sulix> Yeah, about that...
+21:58 < matches> Remember Arbints don't have to work for quad trees to work :P
+21:58 < matches> Or do they
+21:58 <@sulix> In theory, no.
+21:58 <@sulix> In practise, it probably depends on how one defines "success".
+21:59 < matches> I think we need to design a test pattern where you actually want to zoom forever
+21:59 <@sulix> Highly theoretically, I'm pretty certain the QuadTree basically ends up isomorphic to the Arbint.
+21:59 < matches> Seems legit
+21:59 < matches> Can you prove it?
+21:59 < matches> That would be a useful result
+21:59 <@sulix> Yes*
+22:00 <@sulix> *hopefully
+22:00 < matches> I'm afraid most of my "theory" is based solely on intuition at this point :S
+22:00 < matches> Well the division algorithm came from wikipedia but division isn't as intuitive as the other operations
+22:01 < matches> Actually if I can fix all these other stupid bugs I'll try my binary searchish division idea
+22:01 <@sulix> Yeah, I spent a while racking my brain for long division, and then only managing to work it out for dividing by a single digit.
+22:02 <@sulix> That's really, really easy in asm, as well, which is nice, but not quite as useful as I'd hoped.
+22:02 < matches> It's pretty useful; we can still have a "if div.m_digits.size() use the assembly function"
+22:02 < matches> * size() == 1 that is
+22:02 <@sulix> Wikipedia mentioned doing newton-raphson for division, which is a terrifying thought.
+22:02 < matches> Haha
+22:03 < matches> So I've got Arbint::Shrink() calls pretty much after every operation now for no apparent reason
+22:04 <@sulix> Does it help?
+22:05 < matches> On the 551st test Shrink has been called 4 times in a row and then something after that causes an infinite loop
+22:05 < matches> I can't work out what it is
+22:05 < matches> I have a GrowDigit that spams Debug messages now
+22:05 < matches> So its not that
+22:05 < matches> It's silent
+22:05 < matches> Let's see what callgrind has to say
+22:06 < matches> A few minutes should be enough for it to be obvious right
+22:07 < matches> I think the division loop runs forever
+22:07 < matches> Bugger
+22:08 < matches> Wait that doesn't make sense there's only 1 digit
+22:08 < matches> Blargh
+22:17 <@sulix> So using the asm version when possible makes realops.test 20x faster, but there were a couple of failed tests.
+22:18 <@sulix> I'm not sure if they're new or not, because I was able to run many more tests.
+22:20 <@sulix> Also, I think I've found your infinite loop.
+22:23 <@sulix> Okay, maybe I've just obfuscated the code some more.
+22:24 < matches> Infinite loop is due to subtraction bug
+22:24 < matches> I'm pretty sure
+22:24 <@sulix> Yeah, pushing a "fix"
+22:26 <@sulix> Pushed, but think I might have found a bug in the fix.
+22:26 < matches> Ok
+22:27 < matches> (0,0) - +(16292953875657448384,1) = -(16292953875657448384,2) seems wrong
+22:28 <@sulix> Pish! Nothing could be more beautiful.
+22:28 < matches> It's pretty hard to debug with such huge numbers :P
+22:31 <@sulix> Try this...
+22:31  * sulix pushes.
+22:32 < matches> What does that do...
+22:33 < matches> oh
+22:33 < matches> You negate the entire thing and add one
+22:33 < matches> Seems legit
+22:33 <@sulix> So "two's complement" negatives mean that -A == flip all bits of A and add 1.
+22:33 < matches> Yeah
+22:34 <@sulix> There seems to be a bug in the asm div_digits though.
+22:35 < matches> I'm taking that out until I know the main algorithm works :P
+22:35 < matches> Silly I spent so much time wondering why division was broken without checking subtraction
+22:36 < matches> After I spent all that time thinking I was so clever for doing division using bit shifts and subtractions
+22:37 <@sulix> It still takes forever.
+22:37 <@sulix> (Zooming in, that is)
+22:37 < matches> Nah there's still a bug
+22:37 < matches> You're running with an older version of realops test
+22:37 < matches> Hang on
+22:37 < matches> I will push things
+22:38 < matches> Trying to avoid a merge...
+22:38 <@sulix> And I will get a drink.
+22:44 < matches> So if you run enough tests you eventually get a bunch of SubBasic spam
+22:45 < matches> Which is actually occuring due to "<" operators
+22:45 <@sulix> Yeah: I'm going to add a bunch of hacks to "<" at some point.
+22:45 < matches> Which are in the Division loop ( >= is implemented in terms of <)
+22:45 < matches> Don't add the hacks until subtraction works!
+22:46 < matches> I don't want to optimise it yet
+22:46 < matches> Otherwise all the optimisations hide the bugs
+22:47 < matches> Time for a tester that just does subtractions I think
+22:48 <@sulix> It might be worth adding a bunch of SDL_assert_paranoid()'s everywhere that check that (a - b)+b == a and similar on every - call.
+22:49 < matches> Most of the tested numbers can be represented in a single digit which is causing problems
+22:50 < matches> With finding the bugs in the multi-digit algorithm
+22:52 < matches> For small enough multi digit Arbints testing against doubles might work?
+22:52 <@sulix> Maybe.
+22:53 <@sulix> You'd lose enough precision that it's not worth it for anything > 2 digits, I'd say.
+22:53 < matches> Yeah, 2 digits should be enough to make sure the algorithms actually work though
+22:54 < matches> 2 digits in one operand and 1 in the other (which will resize itself to have a leading zero if necessary)
+22:55 < matches> At some point I am going to have to use a library for Arbints and compare ours to it
+22:55 < matches> But I kind of want ours to work properly before bringing in an external one
+22:56 < matches> When I try floats I might just bring in the external library :P
+22:56 <@sulix> Two questions:
+22:57 <@sulix> 1. What is "borrow" supposed to be? Is it the "carry" or the "result has changed sign" or something else?
+22:57 <@sulix> 2. What do you think of replacing Sub() with Add() + Negate()?
+22:59 < matches> borrow's like carry (I'm using subtract with borrow in asm) it should get subtracted from the next digit, and if at the end it is still set then it means your result is less than zero
+22:59 < matches> and 2 sounds like an excellent idea
+23:00 <@sulix> Okay.
+23:00 <@sulix> 'cause there's a separate "carry" flag and "sign" flag, so I wasn't sure.
+23:01 < matches> subtract actually working would be slightly faster than add and then negate I think
+23:01 <@sulix> I'm not 100% sure if all the code is using m_sign as the sign or if some of it is trying to use 2's complement, which isn't really possible with arbints.
+23:03 < matches> When I was testing the subtraction code I was using int64_t instead of uint64_t and it seemed to work :S
+23:04 < matches> I should check whether sbb does unsigned or signed subtraction
+23:04 <@sulix> Both, I think.
+23:04 <@sulix> 2's complement makes them the same, which is why it's so nice.
+23:04 <@sulix> But it requires a fixed number of bits to work.
+23:09 < matches> Whoops now the bit shift tester runs forever as well
+23:13 < matches> Oh no it doesn't
+23:13 < matches> It just exceeds the limit on GrowDigits
+23:14 < matches> Phew
+23:14 < matches> Bit shifting works at least
+23:14 < matches> Or at least it is consistently broken
+23:14 < matches> (a >> X) << X == a
+23:14 < matches> But == could be broken
+23:14 < matches> NOTHING IS SAFE
+23:14 < matches> When you are writing your own number represntation :(
+23:15 <@sulix> Idea: 2's complement subtraction will make -ve numbers have an "infinite" number of 1s at the front, so would that be infinite looping, trying to continually add digits with 1s.
+23:15 < matches> Operator overloading is amazingly powerful and yet it seems like the best way to make seemingly sane code do batshit insane things
+23:15 <@sulix> I think the answer is "no: we're always trapping it and converting it" but am not sure.
+23:16 < matches> Our subtraction doesn't take forever
+23:16 < matches> The issue is when the result would be less than zero
+23:16 < matches> Hang on let me make another tester
+23:17 < matches> Well, I'll put it in the arbint tester instead of the real tester
+23:18 < matches> Since it's pretty clear the bugs are in arbint not rational<arbint> itself
+23:18 < matches> Although there might be bugs in rational<T> as well
+23:18 < matches> But we'll squish those when we get to them
+23:18 < matches> Also quad trees are they a thing yet?
+23:20 <@sulix> "The quadtrees aren't in the code, they were in your heart all along."
+23:21 < matches> Haha
+23:21 < matches> Tell that to Tim :P
+23:21 < matches> Ok (45,10) - (128,0) = -(83,18446744073709551605)
+23:21 < matches> But I'm pretty sure it should be -(83,9)
+23:21 < matches> + even
+23:22 < matches> (The least significant digit is first)
+23:23 < matches> Actually the plot thickens
+23:23 < matches> +45,10 - +128,0 = +18446744073709551533,9
+23:23 < matches> +45,10 - +128 = -83,18446744073709551605
+23:23 <@sulix> What is 0 + -1?
+23:24 < matches> +0 + -1 = -1
+23:24 <@sulix> I am pleased to hear that.
+23:25 < matches> +0 - +1 = -1
+23:25 <@sulix> -1 + 2?
+23:25 < matches> Now you're getting tricky...
+23:25 <@sulix> (As a maths major, I should know this)
+23:25 < matches> -1 - +2 = +1
+23:25 < matches> They're all single digit though
+23:26 <@sulix> Do you mean -1 + +2 = +1?
+23:26 <@sulix> Otherwise I'm slightly concerned.
+23:26 < matches> Uh yeah
+23:26 < matches> Sorry I have to change both the Arbint c(a + b) and the Debug
+23:26 < matches> Before copy pasting
+23:27 < matches> So I guess I should calculate if 45 + 10*2^64 - 128 == 18446744073709551533 + 9*2^64
+23:31 < matches> Expletive grenade
+23:31 < matches> I started Mathematica 
+23:31 < matches> fglrx segfaulted
+23:31 < matches> startx
+23:32 < matches> -bash: /usr/bin/startx: No such file or directory
+23:32 < matches> Also now I am getting zenity int3 error messages all over the bottom line of my terminal
+23:33 < matches> Whyyy
+23:33 <@sulix> That's terrible.
+23:33 < matches> Why does this computer persecute me so
+23:34 < matches> I gave it a good life
+23:34 <@sulix> You should ask frames how he runs mathematica on the command line.
+23:34 < matches> I fed it lots of AC power
+23:34 < matches> I replaced that keyboard that I broke
+23:34 < matches> I only spilled coffee on it once
+23:34 < matches> I *tried* to use the drivers that weren't fglrx
+23:35 < matches> I give up, see you tomorrow. Try not to totally rewrite all the Arbint code :P
+23:35 < matches> I think the subtraction might actually work except for the resizing bit
+23:35 <@sulix> Nah, I'm calling it a night here too.
+23:36 <@sulix> I tried replacing the carry bit with the sign bit and all went to hell there, so I'm inclined to agree with you.
+23:37 < matches> Well using my calculator I get something with a 184 ish at the start and too many digits to display
+23:37 < matches> Hence the mathematica disaster
+23:40 < matches> Oh well, I got startx back by installing "xinit" so that's something
+23:41 < matches> I guess apt decided to remove it as part of apt-get autoremove in its infinite wisdom
+23:41 <@sulix> I have decided to never call apt-get autoremove.
+23:42 <@sulix> If at any point there are too many old packages for me to get things done, I'll just reinstall the OS entirely.
+--- Day changed Mon Jul 07 2014
+08:40 < matches> I try to avoid it, but sometimes apt won't let me do anything because it would break some dependency
+08:40 < matches> Although usually even after I run autoremove it complains
+08:41 < matches> Had to use aptitude to fix my "You can'd have kde-runtime!" issues
+08:45 < matches> Anyway wolfram alpha says that example +45,10 - +128 == +18446744073709551533,9
+08:45 < matches> is correct
+08:45 < matches> Checking the algorithm using 8 bits it should work too
+08:46 < matches> So it works as long as you supply the leading zeros...
+08:46 < matches> (On that particular case...)
+08:48 < matches> I hope it's not interpreting Arbint(128L) as Arbint(128u, ...)
+08:48 < matches> Nope sanity seems to prevail there
+08:50 < matches> Ah
+08:50 < matches> Ok
+08:50 < matches> First bug of the day: The subtracted argument needs to be resized
+08:50 < matches> As I am doing (45,10) - (128)
+08:59 < matches> :O
+08:59 < matches> I passed the realops test
+09:00 < matches> And it's also a lot faster now!
+09:00 < matches> Probably because the subtraction bug meant it was spending a long time in division to get the wrong result
+09:01 < matches> Yeah it should have been obvious division can't have been that slow for numbers starting at 64 bits since it does at most as many iterations as the number of bits
+09:01 < matches> Oh well
+09:02 < matches> Should probably not celebrate just yet, now the bezier looks really wierd again
+09:04 < matches> Ok
+09:04 < matches> Actually compiling with Real == Rational<Arbint> might be a better test
+09:04 < matches> But it still passes
+09:05 < matches> In particular it passes with Arbints where int64_t fails horribly
+09:05 < matches> So something is right
+09:05 < matches> Just not all of it...
+09:08 < matches> The GPU rendering seems to workish
+09:09 < matches> We really quickly end up with Arbints of size 30 digits or so :S
+09:09 < matches> Which is big enough to give an overflow in doubles I think
+09:10 < matches> Rational::ToDouble can probably be written as double(integer division) + Rational(remainder, quotient).ToDouble()
+09:10 < matches> (With some things to stop it recursing infinitely)
+09:20 < matches> Or even double(integer division) + double(remainder)/double(quotient)
+09:20 < matches> I don't think any recursion is needed
+09:22 < matches> Oh, there's a "pow" call that is probably broken
+09:24 <@sulix> Yeah, I feel the growing quickly is just a fact of life.
+09:25 <@sulix> Perhaps changing the zooming to avoid coprimes or something.
+09:27 <@sulix> I'm pretty certain that about 3 seconds of zooming is enough to make us need precision and range to match measuring the size of the visible universe in Planck lengths, too.
+09:28 <@sulix> "New biggest Arbint of size 173"
+09:28 <@sulix> and counting...
+09:34 < matches> haha
+09:34 < matches> There are more issues I spotted with add and subtract
+09:34 < matches> Basically you have to add the leading zeros - all of them
+09:35 < matches> My patch only simulates adding one leading zero
+09:35 < matches> Actually maybe I don't need to add them all, just enough until the borrow becomes zero
+09:36 < matches> But whatever
+09:36 < matches> If you're left with a borrow you can't assume that subtracting it from the next digit won't cause a borrow as well
+09:37 < matches> Realops is not a good enough tester
+09:42 <@sulix> Surely if there's borrow bit, subracting it from zero will always give another...?
+09:42 < matches> You only need as many as there are digits in your number
+09:42 < matches> At most
+09:42 < matches> If you still have a borrow at the end
+09:42 < matches> That means the result is negative
+09:43 <@sulix> Yeah, that's what I thought: you need to cap the number of digits you add.
+09:44 < matches> The problem was the algorithm before didn't finish all the borrows
+09:44 < matches> eg: 100 - 2 would have become "-8"
+09:44 < matches> Because 2 only has one digit
+09:44 <@sulix> My powers of mathematics tell me that that is not quite correct.
+09:45 < matches> What, that our algorithm was wrong?
+09:45 <@sulix> No, that 100-2 is not -8
+09:45 < matches> Yes
+09:45 < matches> Yes that's the problem :P
+09:46 < matches> So basically the two numbers need to be the same size but since we have a constant argument I'm sticking in a "borrow_digits" vector if there is a borrow
+09:46 < matches> Addition also needs it for carry
+09:46 < matches> Damn
+09:47 < matches> I'd hoped that might fix the beziers not looking like beziers on the CPU bug
+09:50 <@sulix> I've pushed code to clear the carry/borrow flag before adding/subtracting.
+09:50 <@sulix> I don't think any bug is triggered, but there was the potential for off-by-one errors.
+09:52 < matches> Argh no
+09:52 < matches> Merge
+09:53 < matches> Yeah I'm pushing a fix for bugs that I don't think we've seen (yet)
+09:54 <@sulix> Out of curiosity, I tried removing the Simplify() calls from Rational.
+09:54 <@sulix> Relatedly, I've coined the term "NaN soup"
+09:54 < matches> Oh, clearing the carry/borrow flag might actually fix a bug with the code I just committed
+09:54 < matches> No wait it won't
+09:55 < matches> Eh it's still kind of dangerous to assume it isn't set to start with
+09:55 <@sulix> I think the flag was probably already cleared by the code the compiler generated, but that might not be the case if it's optimized.
+09:55 < matches> One of my early attempts had inline adc instructions in a for loop
+09:56 < matches> Which failed miserably because the for loop was clearing the carry flag :P
+09:57 <@sulix> For some reason "*=" segfaults if optimization is enabled, but I don't know why.
+09:57 < matches> Yuk
+09:58 <@sulix> Somehow we end up with "mul" as a null reference.
+09:58 < matches> Rataional::*= or Arbint?
+09:58 <@sulix> Arbint
+09:58 <@sulix> (So, also rational)
+09:58 <@sulix> Valgrind isn't picking anything up.
+09:58 < matches> null references are the worst
+09:59 < matches> Since I'm pretty sure the point of a reference is that it is never null...
+09:59 < matches> I'm sure this doesn'
+09:59 < matches> t stop people from deliberately creating null references
+09:59 < matches> And also checking that they are not null
+10:02 <@sulix> Tried compiling with clang. Nope.
+10:02 <@sulix> Apparently not even #include <iostream> compiles with clang.
+10:02 < matches> It might be worth implementing a non assembly version of those functions
+10:03 <@sulix> Yeah, that's always a good idea.
+10:03 <@sulix> The assembly ones are more fun, though.
+10:16 < matches> Hmm I should probably head towards the meeting
+16:23 < matches> I have pushed a Gmpint wrapper thing
+16:23 < matches> It mimics Arbint as closely as possible.
+16:24 < matches> Well by that I mean I just wrapped all the calls to mpz_add() etc in operators
+16:24 < matches> It doesn't have all of Arbint's more esoteric functions
+16:24 < matches> If we need bit shifts I think I can add them
+16:27 < matches> So, writing stuff...
+16:28 < matches> Running arbint_vs_gmpint.test in valgrind takes a fair while
+16:28 < matches> We will have the definitive answer of just how terrible our multiplication is compared to the Professional (TM) implementation
+16:29 < matches> I do have some good news, I think our string conversion might be better
+16:29 < matches> Well if you ignore the division
+16:31 < matches> *= is about 11 times slower
+16:32 < matches> Most of that is in std::vector::resize()
+16:32 < matches> But even just mul_digits is greater than the entire Gmpint::operator*=
+16:32 < matches> The plot thickens as I try division
+16:32 < matches> Which is a good opportunity to get food because it will probably take an hour
+16:34 < matches> Note: Don't disable Debug messages if you want time to get food :(
+16:35 < matches> And division is just under 100* slower
+16:36 < matches> No
+16:36 < matches> 1000*
+16:37 < matches> So... if we change Rational<Arbint> to Rational<Gmpint>...
+16:41 < matches> We still get {nan,nan,nan,nan} eventually but it is generally less shoddy
+16:50 <@sulix> Cool: looking at this now.
+16:50 <@sulix> I'm digging through the gmp source code as well.
+16:51 <@sulix> They have a similar "divide by single int64_t" optimization.
+16:51 <@sulix> Also their code is 90% preprocessor macros.
+16:51 < matches> Welp
+16:51 < matches> At least we have a readable Arbint
+16:52 < matches> I don't know what use a readable but slow implementation is
+16:52 <@sulix> Ah: I see what they're doing: this is quite clever, particularly from a pure maths point of view.
+16:52 <@sulix> They've got a natural number implementation, and have then built their integer representation around that.
+16:53 <@sulix> The natural numbler implementation is just a huge set of directories with different assembly implementation.
+16:53 <@sulix> So there's an "x86_64" directory, and in that there's a bunch of assembly + a bunch of directories with optimized versions for different individual processor models.
+16:55 <@sulix> Also their assembly has lots of ASCII art comments.
+16:56 <@sulix> and macros.
+17:07 < matches> Yeah "just use GMP" is probably the answer
+17:08 < matches> Their Makefiles are pretty intimidating
+17:22 < matches> I like that they seem to store the sign as part of the size
+17:22 < matches> If something has a negative size it is negative and has |size| digits
+17:34 < matches> I guess I will try and write some sort of report about how we implemented Arbitrary Integers but they are terrible compared to existing implementations :P
+--- Day changed Thu Jul 24 2014
+14:44 < matches> So I was going to work on the project but existential dread
+14:45 < matches> About whether my major exists
+14:45 < matches> Do I exist?
+14:49 <@sulix> Are you thinking? Because cogito ergo sum.
+14:50 < matches> I'm not sure I was thinking when I picked this major...
+14:50 <@sulix> I did some project code yesterday and then a bug I thought I'd fixed reappeared so I got distracted failing to fix that.
+14:50 < matches> Haha
+14:53 < matches> Should I upset everyone and recommend freshers for wheel again...
+14:54 <@sulix> I'm all for it, but I think the consensus was that we need to make them actually do wheel-y projects first.
+14:55 < matches> That seems kind of hypocritical though
+14:55 < matches> Because nearly none of active wheel has actually done wheel-y projects
+14:55 < matches> Certainly not before getting on wheel
+14:56 <@sulix> My current random guess is that the problem is that people used to fix the desktops and stuff, and now everyone has their own laptops to break.
+14:56 < matches> But I'll be quiet or people might decide I need to be removed due to lack of doing useful things
+14:56 < matches> Yeah
+14:56 < matches> That too
+14:57 <@sulix> I'll definitely bring it up at the meeting.
+15:02 <@sulix> So which CoderDojo forms do I need to fill out?
+15:02 < matches> Ooh!
+15:02 < matches> http://coderdojowa.org.au/volunteer
+15:02 < matches> This one
+15:03 < matches> But now you've said that I'm already adding you to the mailing list...
+15:04 < matches> There's a thing on Saturday in 2.01 in CS at 12:00pm
+15:04 < matches> I hope people actually show up because we are pretty short on presenters
+15:04 <@sulix> Yeah, I've got a programming competition then. I'm trying to work out how much of the schedule for the competitions exists.
+15:06 <@sulix> Okay, apparently there are programming competitions every saturday in August, which will be fun.
+15:07 <@sulix> Although half of them are "details TBD," which sounds ominous.
+15:07 <@sulix> Also there is a round 2 and a round 4 but no round 3.
+15:11 <@sulix> Okay: it looks like the only weeks I don't have programming competitions on are the last 3 on the form.
+15:13 <@sulix> Also I suspect they're running out of names for the programming competitions, because this Saturday's is called the "South Pacific Winter Programming Carnival".
+15:21 < matches> Haha
+15:27 <@sulix> Form submitted. Sorry for the snarkiness.
+15:40 < matches> Brilliant
+15:40 < matches> You can do a C or C++ workshop or something :P
+15:40 < matches> Or just talk about Commander Keen that'll work
+15:40 < matches> Or "Why Javascript is awful and you should forget all the lessons"
+15:42 <@sulix> "Intro to DOS programming." :P
+18:38 < matches> I did a sort of half hearted attempt at writing more about Arbints
+18:39 < matches> Maybe I'll try put fonts in
+18:39 < matches> That seems vaguely like not what I am supposed to be doing right now :P
+18:43 < matches> There's that virtual FPU sitting there doing nothing
+18:43 < matches> That I promised to do things with in my lit review
+18:43 < matches> That Tim is marking
+18:43 < matches> When I haven't actually done anything with it and he knows it...
+18:44 < matches> I can't help but feel like we need a more impressive thing to zoom in on
+18:44 < matches> Or even a way to draw things once we have zoomed in
+18:46 < matches> Does "We implemented Arbitrary Precision Integers but GMP did it better" count as research?
+19:13 < matches> Do we have a memory leak?
+19:13 < matches> I've been running it for a while and things are slowing down
+19:25 <@sulix> matches: With GMP or just doubles?
+19:27 <@sulix> My quick check has us not leaking memory with doubles.
+19:27 <@sulix> Well, X leaks memory and the nVidia driver leaks memory, but we're fine.
+19:35 < matches> I was actually running with singles :S
+19:35 < matches> See push to documents repo
+19:35 < matches> There is a pdf
+19:35 < matches> I did a thing
+19:38 < matches> I'm basing the assumption that x86-64 is IEEE compliant on the fact that it passed the "paranoia" program
+19:39 <@sulix> Yeah, x86_64 is IEEE compliant.
+19:39 <@sulix> x86_32 is "mostly" IEEE compliant if I recall.
+19:41 < matches> Well a picture tells a thousand words
+19:41 < matches> So I think I wrote 8000 words today
+19:41 < matches> Progress!
+19:43 <@sulix> http://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_defines.h?id=9d6166880da83887e3246fb4498c3a07d979cc3b#n162
+19:43 <@sulix> I'll see if I can find where they actually set it to non IEEE.
+19:43 < matches> Oh I was going to say fglrx did different things to nVidea but as I don't have nVidea that's difficult to do
+19:45 <@sulix> Although there's this: http://lists.freedesktop.org/archives/mesa-dev/2013-July/041555.html
+19:45 <@sulix> Yeah, nVidia, Intel and fglrx all seem to do different things.
+19:45 <@sulix> fglrx does the strangest things.
+19:45 <@sulix> nVidia does the most consistant things.
+19:45 <@sulix> Intel sits nicely in the middle.
+19:46 < matches> If we can get four screenshots of the different things at the same view bounds that might be useful
+19:47 < matches> Also working out more about what the jagged edges implies about the precision/rounding might be helpful
+19:47 < matches> All I've got is "This is clearly not a circle"
+19:48 < matches> So it's still doing that with the quad trees enabled, so I assume the quad trees aren't amazingly quadifying everything yet :P
+19:48 <@sulix> The quadtrees are basically doing nothing but occasionally causing bugs.
+19:48 <@sulix> http://davidgow.net/stuff/ipdf-nvidia.png
+19:48 < matches> That is progress at least
+19:49 < matches> Thanks
+19:49 < matches> I will update the others to be the same view bounds
+19:49 < matches> I *think* we have code to set the view bounds at start?
+19:51 <@sulix> http://davidgow.net/stuff/ipdf-intel.png
+19:51 < matches> Haha
+19:51 < matches> Well it's really obvious that that's different
+19:52 < matches> Can you rerun it with -b 0.0869386 0.634194 2.63295e-07 2.63295e-07
+19:52 < matches> Obsessive compulsive...
+19:52 < matches> Must all be same view bounds...
+19:53 < matches> I'd run it on my other laptop with intel integrated graphics except the keyboard still doesn't work
+19:55 < matches> Actually don't bother
+19:55 <@sulix> http://davidgow.net/stuff/ipdf-nvidia1.png
+19:57 <@sulix> http://davidgow.net/stuff/ipdf-intel1.png
+19:59 < matches> oah wierd stuff is happening with the quad tree
+19:59 < matches> There is a big circle and a little circle
+19:59 < matches> Is that supposed to be here...
+20:00 < matches> The distance between them is not constant :S
+20:09 <@sulix> Yeah, that doesn't happen on intel and is the bug I've been hitting my head against.
+20:09 <@sulix> Pretty certain I'm trying to render one more object than there actually is somewhere, maybe corruping memory in the process.
+20:32 < matches> Ok so it turns out the CPU is actually about as terrible as the GPU at those view bounds when you replace the "double" with "float" in the Circle Renderer :S
+20:32 <@sulix> That's what I expected.
+20:32 <@sulix> It looks like the nVidia one, right?
+20:32 < matches> But it does slightly different wrong things!
+20:34 < matches> It looks similar-ish
+20:35 < matches> It is blocky as opposed to zig zaggy
+20:39 < matches> As in it doesn't look as whack as intel
+20:43 <@sulix> Hmm... I'm not sure what I'm doing wrong, but I can't see any artefacts at all with CPU rendering w/ those bounds.
+20:55 < matches> They are hard coded as doubles
+20:55 < matches> Not floats
+20:55 < matches> Or reals rather
+20:56 <@sulix> Ah.
+20:56 <@sulix> This explains much.
+21:08 < matches> I have pushed a thing
+21:09 < matches> It almost sounds like a real paper
+21:09 < matches> Until you realise all it is is "we drew some circles and they look different"
+21:09 < matches> Also your screenshots had some kind of crazy blue glowy border
+21:10 <@sulix> Yeah, that's the KDE window shadow.
+21:10 < matches> Fancy
+21:10 <@sulix> It used to make the nVidia driver corrupt screenshots, but it seems to work now.
+21:11 < matches> I'm pretty pleased with that 4 way comparison figure...
+21:12 < matches> "One of these things is not like the others..."
+21:12 < matches> *cough* intel
+21:12 <@sulix> The conclusion is brilliant.
+21:15 < matches> If we assume the nVidia and x86-64 figures are what things are supposed to look like
+21:15 < matches> fglrx tries really hard
+21:15 < matches> But doesn't quite make it
+21:16 < matches> (I'm pretty sure that's just a particularly good view for it)
+21:16 < matches> (If you move it around it goes insane)
+21:16 < matches> I can respect the intel shader
+21:16 < matches> It isn't afraid to blatantly disregard the rules
+21:17 < matches> intel driver rather
+21:17 < matches> Not sure why I put "shader" there
+21:17 < matches> This has not been as productive as I hoped
+21:18 < matches> Still
+21:18 < matches> We finally have something written that Tim can pass judgement on
+21:18 < matches> He's still in the country right?
+21:19 < matches> He might want to finish passing judgement on my literature review first :S
+21:21 <@sulix> I think he's still in the country, but don't hold me to that.
+21:22 < matches> Ok, so if you translate around with the CPU things don't go insane, but they do on the GPU. That might be caused by something else though.
+21:23 < matches> I'll be at University tomorrow
+21:24 <@sulix> I might head in, too, then.
+21:25 <@sulix> Do things still "go insane" on the GPU with CPU-side coordinate transforms.
+21:26 < matches> Yeah
+21:26 < matches> It looks like there is a tear
+21:27 < matches> So you get this rectangle pattern
+21:27 < matches> If you move it around on the CPU it maintains its shape
+21:28 <@sulix> I think that fglrx (or maybe just the AMD hardware) calculates the coordinates per-triangle rather than per-vertex or something.
+21:28 < matches> Under fglrx the bottom part of it sort of maintains its shape but there is a big diagonal line and the stuff above that changes
+21:28 <@sulix> That's pretty weird.
+21:29 < matches> Also the bottom part doesn't have concave bits but the top occasionally gets one
+21:29 < matches> concave/overhanging whatever
+21:29 <@sulix> The whole thing maintains its shape on nvidia (and even intel)
+21:29 < matches> Well, the bottom half (and also the CPU/nVidia entire thing) looks kind of like a stair case
+21:29 < matches> The top bit gets all these sticky out bits and overhangs
+21:30 < matches> Which brings us to our next paper
+21:30 < matches> The geology of fglrx
+21:30 <@sulix> Intel also does the "staircase" on the other side of the circle.
+21:30 < matches> On the other side...
+21:30 < matches> Hmm the plot thickens
+21:31 < matches> Oh well I need to sleep
+21:31 < matches> Why do I feel like I have actually lost sleep over the holidays...
+21:32 < matches> I am not ready for semester to start :(
+21:32 <@sulix> I know exactly what you mean.
+21:33 < matches> I seem to have been roped into unpaid work with physics
+21:34 <@sulix> Oh dear. More lab demonstrating or something more interesting?
+21:34 < matches> Hopefully if I visit ECM they won't make me do GENG5505 yet
+21:34 < matches> Fixing my honours experiment I think...
+21:35 <@sulix> Another pipe corroded through?
+21:35 < matches> Haha
+21:35 < matches> They were wondering where all the electronics went
+21:35 < matches> (I have most of it)
+21:35 < matches> (Also it's no longer functional)
+21:36 < matches> (I may have taken some of it apart...)
+21:36 < matches> (Although really the sensible option would have been to burn it with fire)
+21:37 < matches> Goodnight anyway
+21:37 <@sulix> I'm required to "correct" anything they want to change with this project after submitting it.
+21:37 <@sulix> On the morrow, then!
+--- Day changed Fri Jul 25 2014
+11:24 < matches> I'm at UCC
+11:39 <@sulix> Okay, I'll show up once I've sorted out this acedemic record stuff.
+12:05 < matches> I went to ECM but apparently just a few other people are having difficulties...
+18:24 < matches> So steam browser supports html5 canvas but not keyboard events
+18:24 < matches> This seems to happen with a lot of browsers
+18:25 < matches> We support html5 canvas (which is pretty much solely designed for web based games)
+18:25 < matches> But we don't support any way to actually pass input to the page that doesn't suck
+18:25 < matches> (I'm looking at you Safari)
+18:31 < matches> It sort of spoils the "HTML5 is AWESOME" message the HTML5 people are aiming for
+18:31 < matches> The best bit of html5 is <canvas> and that you no longer need to use html because you can just draw everything in the canvas...
+18:32 < matches> Which is scarily similar to using PostScript
+--- Day changed Mon Jul 28 2014
+10:05 < matches> In 2.07 now
+10:07 < matches> You removed SDL from contrib
+10:07 < matches> So now it won't compile on the lab machines
+10:07  * matches gets out the laptop then
+--- Day changed Tue Jul 29 2014
+09:59 < matches> I seem to have this bizarre illness
+10:00 < matches> Where half my head feels fine
+10:00 < matches> And the other half feels like I've been trying to read brainfuck
+10:00 < matches> I hope you don't catch it
+10:00 < matches> The side that is sick is the side that was closest to the group hug
+10:00 < matches> Coincidence!?
+10:00 < matches> I think not!
+10:08 < matches> You know how there's this theory about the two halves of the brain being semi independent and sort of subconsciously able to think by themselves
+10:08 < matches> I think the left side of my brain is dead
+10:08 < matches> It's not responding to pings
+10:09 < matches> I think the project working side might be the alive one though, so we shall see if I can actually do something useful
+--- Log closed Tue Jul 29 23:13:08 2014
+--- Log opened Wed Jul 30 12:03:38 2014
+12:03 -!- matches [[email protected]] has joined #ipdf
+12:03 -!- Irssi: #ipdf: Total of 2 nicks [1 ops, 0 halfops, 0 voices, 1 normal]
+12:03 -!- Irssi: Join to #ipdf was synced in 0 secs
+16:28 -!- sulix [[email protected]] has quit [Ping timeout: 121 seconds]
+17:25 -!- sulix [[email protected]] has joined #ipdf
+--- Day changed Sun Aug 03 2014
+12:43 < matches> So I found my moronic mistake with the virtual FPU and it seems to actually work
+12:44 < matches> I think it's even slower than using Rational<Arbint>
+12:44 < matches> Unless everything's slow because of the QT now
+12:45 < matches> There's an awful lot of "Rendering QT node" debug
+12:46 < matches> No its the VFPU that makes sense
+12:47 < matches> Since every floating point operation now requires writing 18 hex characters over a unix domain socket
+12:47 < matches> Hooray VHDL
+12:48 < matches> (I'm sure if you have $$$$ and like Enterprise(TM) software VHDL is great)
+12:48 < matches> I'll just do some miscellaneous things and hopefully some of them will be useful
+12:48 < matches> Bye
+14:14 < matches> So with the VFPU and doing everything on the GPU we have 2.2 FPS
+14:14 < matches> It seems to be able to cope with rectangles on the CPU
+14:15 < matches> The circle may present some difficulties
+14:16 < matches> It would be have been pretty cool to change the vfpu and see if anything makes it look like intel
+14:16 < matches> But ultimately useless I suppose
+14:37 < sulix> There might be some info in the hardware docs, though they're pretty incomprehensible: https://01.org/linuxgraphics/documentation/2013-intel-core-processor-family
+14:38 < sulix> AMD also have manuals: http://developer.amd.com/resources/documentation-articles/developer-guides-manuals/
+14:38 < sulix> nVidia are sworn to secrecy.
+--- Day changed Tue Aug 05 2014
+12:38 < matches> I'm looking at the atril source
+12:38 < matches> To see if I can compile it without the oppressive 400% max zoom
+12:39 < matches> It is rather intense
+12:39 < matches> I think the zooms are set depending on the language?
+12:41 < matches> There are po files which are definitely not position independent object files
+12:43 < matches> #define ZOOM_MAXIMAL(zoom_levels[n_zoom_levels - 1].level)
+12:43 < matches> The plot thickens!
+12:45 < matches> Heh this is actually sort of making sense
+12:45 < matches> They have a "cut-n-paste/zoom-control" directory
+12:48 < matches> I'm confused as to how the maximum zoom is 6400% and yet my version will only zoom to 400%
+12:48 < matches> But I guess I shall compile it from source and see what actually happens
+12:51 < matches> They also have a script to configure their configure script...
+12:51 < matches> Oh dear xml is involved
+12:53 < matches> There needs to be a way to save the status of configure so you don't have to rerun it from scratch every time you fix an error
+12:56 < matches> Our document viewer may only be able to render beziers and circles
+12:56 < matches> But at least it doesn't have any dependencies!
+12:56 < matches> Well many
+12:56 < matches> I suppose since SDL is in contrib we should put GMP in contrib too
+12:57 < matches> But yes, I don't care about caja plugins dammit I want to zoom on a pdf
+13:00 < matches> "Warning: Comparison between pointer and integer"
+13:00 < matches> Aaaah
+13:00 < matches> It compiles...
+13:01 < matches> But where did it put the binary...
+13:02 < matches> Oh great it expects things to be in /usr
+13:03 < matches> I guess I will run "install-sh" and hope I will still have a usable pdf viewer
+13:07 < matches> There's a LOT of G_ and g_ variables
+13:07 < matches> Actually functions
+13:07 < matches> I think g_ does not mean global in this context
+13:07 < matches> Maybe
+13:11 < matches> So it's not just a matter of ZOOM_MAXIMAL being redefined to ridiculously huge numbers having any effect
+13:11 < matches> I guess they use some other library that has zooming
+13:13 < matches> It somehow detects what the maximum zoom should be based on the document as well
+13:13 < matches> This is just over engineering!
+13:19 < matches> ev_view_can_zoom_in (EvView *view)
+13:19 < matches> return view->scale * ZOOM_IN_FACTOR <= ev_document_model_get_max_scale (view->model);
+13:19 < matches> Let
+13:19  * matches casually makes it return true
+13:19 < matches> Also wtf
+13:19 < matches> They have a "gboolean" type
+13:19 < matches> Is "bool" inferior?
+13:19 < matches> What more do you need than true and false
+13:20 < matches> Is bool used as a variable name for something
+13:20 < matches> sigh
+13:24 < matches> No ok it still won't let me zoom in more
+13:25 < matches> g_return_if_fail in the zoom functions
+13:25 < matches> They don't look important
+13:28 < matches> There are a surprising amount of places with a "if zoom or scale is bigger than the maximum, return"
+13:28 < matches> Like, are three checks really necessary
+13:29 < matches> I think you can set model->sizing_mode to "EV_SIZING_FREE" but I have no idea what that will do
+13:29 < matches> So I'll just continue commenting out anything that looks like it will return early from the zoom process...
+13:30 < sulix> Sounds like a plan!
+13:31 < matches> The use of g_ for function names makes me want to stab someone :P
+13:31 < matches> I assume it's related to gtk or maybe just gnome
+13:32 < matches> Also about half their doubles are "gdouble"
+13:32 < matches> And the other half are "double"
+13:32 < matches> :S
+13:32 < sulix> gtk had their own crazy, let's implement everything from scratch idea.
+13:32 < sulix> They have their own "classes" in C, IIRC.
+13:32 < matches> It's pretty object orientated yes
+13:34 < matches> Ok I seem to now be able to zoom in a *bit* more and then it just stops drawing things
+13:35 < matches> No wait it's just hopelessly slow
+13:37 < matches> It also zooms in on the wrong spot and then draws it and then moves the view back to the mouse and draws again
+13:38 < matches> But yes, it doesn't cope well with zooming at all
+13:38 < matches> I was kind of hoping it would work
+13:39 < matches> Maybe if I use a simpler document
+13:43 < matches> Congratulations anyway
+13:43 < matches> We can zoom further on a circle than atril can
+13:44 < matches> Unfortunately the reasons atril can't zoom are probably not related to precision
+13:44 < matches> Maybe I need to find some "if zoom > thing don't draw anything" and comment those out too
+13:44 < matches> Sigh
+14:07 < matches> It is resistant to my valgrind attempts
+14:07 < matches> It seems to have spawned 9 processes
+14:10 < matches> Oh "atril" is actually a series of hideous bash scripts that load libraries or something
+14:12 < matches> You know
+14:12 < matches> I'm sure if we tried
+14:12 < matches> We could make a less shitty pdf viewer out of our program
+14:29 < matches> Interesting
+14:30 < matches> "ev_document_render" got called 10.6 Billion times
+14:30 < matches> I don't think I changed the view that many times...
+14:32 < matches> Ok, so just working on our own viewer is probably better at this point than working out why atril has a heart attack if you zoom
+14:33 < matches> I'm going to pretend this wasn't a waste of time...
+14:41 < matches> "existing pdf viewers cap the view because otherwise they break due to bugs that aren't actually related to precision"
+15:43 < matches> So I suspect the GPU Bezier rendering is buggy
+15:44 < matches> Or maybe it's a quad tree thing
+15:45 < matches> Or both...
+15:46 < matches> I'm pretty sure the appearance of an individual bezier should not depend on what other beziers are in the document :P
+15:47 < matches> Yeah there's wierd quad tree shit going on
+15:48 < matches> I'm going to try and add some sort of glyph/font like thing
+15:49 < matches> It's either that or create hand drawn beziers in the current view
+15:50 < matches> But I feel it desperately needs an example of being able to actually zoom in and create something at an "arbitrary" level
+18:54 < matches> So we sort of have a very broken, very badly written, SVG parser
+18:55 < matches> A bunch of bugs showed up in the bezier rendering
+18:56 < matches> Although it might just be fglrx
+22:23 < sulix> The GL code is now consistantly broken, rather than sporadically broken.
+22:24 < sulix> Trying to render SVGs with it might count as modern art, though.
+22:39 < sulix> Man, the buggier the bézier code gets, the more beautiful its output.
+22:53 < sulix> Voilà: http://davidgow.net/stuff/ipdf-koch-svg.png
+23:11 < sulix> And on the CPU: http://davidgow.net/stuff/ipdf-koch-svg1.png
+--- Day changed Wed Aug 06 2014
+11:00 < matches> That looks amazing!
+11:04 < matches> I'm sorry
+11:04 < matches> All I seem to do is add bugs :S
+11:05 < matches> And XML
+11:13 < sulix> I suspect you removed a lot of bugs with the -DQUADTREE_REMOVED. :P
+11:14 < matches> It's the bit where parts of my Bezier code have been wrong for more than a month that make me feel guilty :S
+11:14 < sulix> The GPU code was wrong in the same way.
+11:15 < sulix> Also it used to corrupt all of the memory.
+11:23 < matches> So you're not using the koch.svg file?
+11:23 < matches> That breaks for me
+11:23 < matches> Which isn't surprising considering the svg parsing code
+11:24 < sulix> I was using koch1.svg from your Lit Review
+11:25 < matches> Oh right
+11:25 < matches> koch.svg isn't actually a valid svg file :S
+11:26 < sulix> I tried it with a random, complex SVG from the internet, and segfault.
+11:27 < matches> Haha
+11:27 < matches> Yeah it works
+11:27 < matches> We can zoom in further than atril!
+11:28 < sulix> Victory!
+11:34 < matches> So I was trying to think about shading things... and stroke thickness... and all those other things in SVG...
+11:34 < sulix> Yeah, I thought about those.
+11:35 < sulix> I came to the conclusion that I should probably try to make the quadtree work first.
+11:37 < matches> Probably :P
+11:58 < sulix> btw, your computer's clock is slightly out.
+11:58 < sulix> alternatively there is a lot of time travel going on
+11:58 < sulix> (secretly, I'm hoping it's the latter)
+11:59 < sulix> (im my mind, I'm good enough to have bugfixed the SVG code before it was written)
+17:10 < matches> Yeah I removed ntpd because my boot kept stalling at it for several minutes
+17:17 < matches> The GPU Bezier renderer seems a lot more conservative about how many lines it uses
+17:18 < matches> I thought I remembered just copying the GPU algorithm for the CPU but maybe I didn't
+17:20 < matches> Oh
+17:38 < matches> Some of the shader stuff confuses me...
+17:38 < matches> Like: "pixize = vec2(pixel_w/bounds_w, 100*pixel_h/bounds_h)"
+17:39 < matches> Random factor of 100 ?
+17:39 < matches> As far as I can tell pixel_w,pixel_h is always 640,480
+17:57 < matches> Hmm
+17:57 < matches> But the window isn't 640,480
+17:57 < matches> Wait
+17:57 < matches> Is it
+17:58 < matches> Yeah
+17:58 < matches> The screen is 800 x 600
+17:58 < matches> That is only slightly confusing...
+17:58 < matches> Should I change all the 640,480 to 800,600 ...
+17:59 < matches> Or will this break things
+18:01 < matches> We are actually passing the width and height of the viewport around so I figure that should probably be used instead of 640 and 480
+18:02 < matches> Also I suspect we want just a few more lines on the beziers since they often start looking more like trapezoids
+18:04 < matches> But only if they are big to begin with
+18:05 < matches> We can probably also do a "if x1,y1 == x2,y2 just use one line"
+18:06 < matches> Or alternately actually implement lines as distinct from beziers but that's silly :P
+18:06 < matches> If I can work out how to do shading then we won't even need rectangles and circles any more
+18:06 < matches> I should probably focus on precision of things but I sort of want to be able to draw something cool first
+18:15 < matches> Oh damn merge
+19:19 < matches> So a series of curveto commands isn't just a series of individual beziers for each three points
+19:20 < matches> I guess it's time to actually read the SVG spec a bit
+19:20 < matches> Oh maybe they are cubic beziers
+19:21 < matches> I thought they were just quadratic unless you used a special command
+21:08 < matches> The order of your coefficients in the bezier geometry shader seems reversed...
+21:08 < matches> But maybe that's because I reversed it in the CPU first...
+21:08 < matches> I don't know
+21:08 < matches> I will leave it in this order and hope it doesn't break
+21:08 < matches> (I'm making the beziers cubic because it seems like a thing we want)
+21:08 < matches> And is required for SVG paths
+21:27 < matches> Hmm
+21:27 < matches> SVGs also have quadratic beziers and as much as setting (x3,y3) == (x2,y2) *almost* looks the same...
+21:29 < matches> Close enough I guess
+21:30 < matches> I don't particularly want to add seperate objects for quadratic beziers since I've only ever seen cubic ones in SVGs anyway
+21:49 < matches> http://szmoore.net/ipdf/svgshape.png
+21:49 < matches> Woo!
+21:50 < matches> I'm actually pretty excited about having a semi usable svg viewer that can zoom, if not indefinitely, a lot further than any of the open source image viewers will let you zoom :P
+21:51 < matches> Shading... that's hard
+21:51 < matches> Stroke thickness is kind of hard too...
+21:51 < matches> Blergh
+22:22 -!- sulix [[email protected]] has quit [Ping timeout: 121 seconds]
+23:42 -!- sulix [[email protected]] has joined #ipdf
+--- Day changed Thu Aug 07 2014
+21:24 < sulix> So it turns out ttf fonts were not very difficult to add at all: http://davidgow.net/stuff/ipdf-ttf.png
+21:42 < sulix> And fixed the glyphs.svg rendering: http://davidgow.net/stuff/ipdf-glyphs.png
+22:06 < sulix> So all of those Béziers make Gmpint very slow.
+22:07 < sulix> It also runs out of memory very quickly.
+22:11 < sulix> About 30 second of dragging an svg around uses ~15G of ram.
+22:13 < sulix> It takes (with Rational<Gmpint> CPU rendering) ~10 G to render the default frame of glyphs.svg
+22:18 < sulix> Okay, it just broke a computer w/ 32 GB of ram.
+22:20 < sulix> Code is pushed, btw, for your computer-wreckingly-awesome enjoyment.
+22:32 < sulix> I tried fixing Rational::ToDouble() and using GPU w/ CPU coordinate transform.
+22:32 < sulix> Still runs out of memory.
+22:33 < sulix> But it works, even if it's still a tad slow.
+22:45 < sulix> Okay, memory use is not a problem at all if we delete out GMP integers after we're finished with them.
+22:46 < sulix> (There was a TODO: to that effect)
+--- Day changed Fri Aug 08 2014
+16:11 < matches> Wait you just did the things *I* was supposed to do for this week :P
+16:11 < matches> I hope you don't want me to fix quadtrees...
+16:13 < matches> Ah sorry about the GMP 
+16:14 < sulix> I gave the QuadTrees another go as well, but random half-letter-"b"s were everywhere.
+--- Day changed Mon Aug 11 2014
+10:56 < matches> Ok I think I need to throw all design principles out the window adding a keyboard handler
+10:57 < matches> I know you were keen on having a mouse handler independent of the Screen class
+10:57 < matches> But the Screen class detects the events
+10:57 < matches> It really makes sense for the event handlers to just be member functions
+10:57 < matches> Maybe virtual in the unlikely event that there are ever different types of Screen
+10:58 < matches> Probably the View should handle the events
+10:58 < matches> Then we wouldn't have this convoluted thing where View has a reference to a Screen but Screen has a pointer to a View...
+10:59 < matches> But I need to let that go and actually do useful things
+10:59 < matches> So KeyboardHandler is now a member of Screen
+10:59 < matches> Delicious spaghetti
+11:02 < sulix> I think I can bring myself to forgive you. :)
+--- Day changed Tue Aug 12 2014
+13:48 < matches> I can draw rabbit_simple.svg
+13:48 < matches> !
+13:48 < matches> Almost
+13:50 < matches> IT IS BEAUTIFUL
+13:52 < matches> Wait I think quad trees are enabled
+13:53 < matches> Nope they aren't
+13:53 < matches> Oh wel
+13:54 < matches> http://szmoore.net/ipdf/infinite-precision-document-FOX.png
+13:54 < matches> That didn't take very long
+13:55 < matches> I suspect the wierd bits in the wrong spot are because there are translations applied to things
+13:55 < matches> Because inkscape
+13:57 < matches> Hmm yeah
+13:58 < matches> I wonder why there are random straight lines between things though
+13:58 < matches> They are filled regions of the same colour and no stroke but obviously we just read the beziers and draw the outlines
+14:50 < matches> Dammit SVG
+14:50 < matches> So the y coordinate of text refers to the bottom
+14:50 < matches> The y coordinate of *everything* *else* refers to the top
+14:51 < matches> It's alright this is ipdsvg we aren't constrained by stupid standards
+14:59 < matches> Ergh somehow fonts are broken in eye of mate...
+14:59 < matches> How did I even...
+15:00 < sulix> Fonts are usually handled with y=0 being the "baseline" of characters.
+15:10 < matches> There are a few wierd things going on with straight lines
+15:11 < matches> Hmm only at the default zoom
+15:11 < matches> Horizontal lines on both cpu and gpu are kind of wobbly
+17:23 < matches> Ok I am suffering from an attack of matrix algebra
+17:23 < matches> It was bound to happen sooner or later I guess
+17:24 < matches> The spaghetti is cooking nicely
+17:26 < matches> The fact that our document is all in GL coordinates and SVGs are not is causing me way more confusion than it really should be
+17:27 < matches> All I need to do is set an initial transformation matrix then everything else should Just Work
+17:27 < matches> Of course it does help if you actually use matrices instead of Rect's
+17:29 < matches> Also I think functions that modify arguments passed by references is one of the things that tpg hates
+17:29 < matches> But there are a lot of them here
+17:29 < matches> They are so convenient!
+22:03 < matches> If I can get transforms and groups actually working properly, we can probably hack some sort of recursive thing together and use view reparenting
+22:03 < matches> Somehow
+22:05 < matches> I'm thinking putting the fox in the rabbit's eye and so on recursively would actually be pretty damn awesome
+22:05 < matches> It is easy to say these things though...
+22:06 < sulix> So, I have view reparenting "working" in the quadtree code.
+22:06 < matches> :O
+22:06 < matches> Cool
+22:06 < sulix> (The rest of the quadtree doesn't work, so the point is somewhat moot, though)
+22:06 < matches> Wait you already had that working, but you have rendering bugs
+22:06 < matches> Yeah
+22:06 < matches> :P
+22:08 < sulix> I will push that now, actually.
+--- Day changed Wed Aug 13 2014
+00:34 < matches> Yes
+00:34 < matches> I have defeate
+00:34 < matches> d
+00:34 < matches> Basic matrices
+00:36 < matches> So it is pretty ugly and inefficient but meh
+00:36 < matches> We have translate, scale and matrix
+00:37 < matches> skew will be pretty easy to add but probably useless
+00:37 < matches> rotate is a bit harder
+00:38 < matches> Also the skewing operations obviously don't work on rectangles
+00:38 < matches> Or anything that isn't defined in terms of bezier paths I guess
+00:38 < matches> But translating and scaling will
+00:40 < matches> Ok, so SVG has a "defs" thing that lets you define groups without drawing them
+00:41 < matches> And a "use" thing that lets you insert a group
+00:41 < matches> Actually element in general
+00:41 < matches> Doesn't have to be a group
+00:41 < matches> So
+00:41 < matches> I wonder if doing recursive magic with that works
+00:48 < matches> Not in normal svg viewers it would seem
+00:49 < matches> Hmm
+00:51 < matches> (eom:7883): librsvg-WARNING **: Circular SVG reference noticed, dropping
+00:51 < matches> That's just boring!
+00:52 < matches> So I think we will need some fairly major changes to our Document structure to get much more SVG stuff working
+00:53 < matches> I wonder if we actually need to store a DOM if we want that to work
+00:53 < matches> Also I thought I fixed transformations but they still break for fox-vector.svg :(
+00:58 < matches> I think "broken" will probably be the most commonly occuring word in our git commit messages
+11:05 < matches> Oooh
+11:06 < matches> svg-tests/recursive.svg is slightly recursive viwed in firefox
+16:10 < sulix> The QuadTree works again!
+16:10 < sulix> (I have finally worked out how to multiply by two, it seems...)
+16:11 < sulix> Also s/ again//
+17:23 < matches> Project complete!
+18:05 < sulix> Man, nVidia has an OpenGL extension where you can just pass the "d" attribute of SVG paths in and have it render them for you.
+18:05 < matches> Oh
+18:05 < matches> Welp
+18:07 < sulix> It's like: glPathStringNV(path, GL_PATH_FORMAT_SVG_NV, strlen(d), "M100,180, L40,10, etc...")
+18:08 < matches> Presumably you could just replace 90% of the SVG stuff with that then :S
+18:09 < sulix> It only works on nVidia hardware, though, so it's not really practical.
+18:10 < matches> I think I need to actually do the Bezier's bounding rectangles correctly
+18:10 < sulix> I was just about to add that, actually.
+18:10 < matches> But its not just (x0,y0,x3-x0,y3-y0)
+18:10 < matches> Ok
+18:10 < matches> Go ahead then
+18:10 < sulix> Nah, you have to take the x and y components separately and solve for min and max.
+18:11 < matches> Yes google is a lot faster than actually doing maths
+18:13 < matches> I can add that unless you've already written it?
+18:13 < sulix> Sure.
+18:13 < sulix> The internet seems to claim that you should use newton-raphson to find the roots of the derivatives, but I'm not really comfortable with doing that for cubic béziers,
+18:31 < matches> I just differentiated the parametric formula
+18:31 < matches> And got a quadratic
+18:31 < matches> Unfortunately there is a slight problem with Real
+18:31 < matches> Since we don't have a general "sqrt"
+18:31  * matches adds that to the growing list of "fix later"
+18:32 < matches> It doesn't compile for Rational<Gmpint> anymore anyway
+18:38 < matches> I am writing code that sjy would probably not consider elegant
+18:50 < matches> Well that totally broke everything
+18:53 < sulix> So it turns out that the view reparenting was only working by chance.
+18:55 < matches> :(
+19:20 < matches> Hmm it turns out finding the bounding box of a bezier has really annoying edge cases
+19:43 < sulix> Okay, automatic generation of new quadtree nodes "works" when zooming in.
+19:44 < sulix> It doesn't do any fancy clipping, so the actual rendering code hits precision issues, but it's still pretty cool.
+19:48 < sulix> It also get a bit buggy if you try to pan over the edges of quadtrees, as it only renders one node at a time.
+19:59 < matches> Nice
+21:14 < sulix> I have just achieved infinite precision with the quadtree!
+21:14 < sulix> Only on rectangles, only when zooming in, and only when the camera doesn't cross a quadtree boundary, but it works!
+--- Day changed Thu Aug 14 2014
+09:50 < matches> cool
+10:37 < matches> I'm beginning to suspect whoever said to use the Newton Raphson method to find Bezier bounding boxes was right
+10:43 < matches> I love how the sites I looked up said "Obviously there is a problem if a = 0 or b^2 - 4ac < 0, but we can just make sure we always pick beziers that don't cause those problems
+10:44 < matches> Ok
+10:44 < matches> I have at least got an algorithm that returns finite sized bounding boxes now
+10:45 < matches> I think it even works!
+10:45 < matches> But only on the CPU
+10:45 < matches> Presumably the GPU does something to cope with the fact that the bounding boxes were totally wrong before?
+10:53 < matches> Oh it wasn't doing anything because they were {0,0,1,1}
+10:54 < matches> I have to transform the Bezier coefficients before they are uploaded to the GPU
+10:54 < matches> Blergh
+10:55 < matches> What I've basically done is change it to be the opposite of how it was designed
+10:55 < matches> -_-
+10:56 < matches> So before, the Bezier control points were relative to some bounding rectangle but when I parsed the SVG I just made it always {0,0,1,1} so the coordinates were absolute
+10:56 < matches> Now I have changed the Bezier control points to be absolute and then calculated a bounding rectangle from them
+10:56 < matches> I can maths
+10:57 < matches> So I could make the Beziers still have the {0,0,1,1} bounds which will fix the GPU renderer without having to transform the coefficients
+10:57 < matches> And just leave this "SolveBounds" function in for actually getting the bounds
+10:58 < matches> Except SolveBounds is disgusting
+10:58 < matches> And slow
+10:58 < matches> So I could add a Bounds member variable to the Beziers
+10:58 < matches> And then we have two bounds
+10:58 < matches> I seem to have coded myself into a catch 22 "No matter what you do it is terrible" situation
+10:59 < matches> Adding a Bounds member variable to the Bezier struct sort of defeats the whole point of the "Object of Arrays" idea
+10:59 < matches> You know what
+11:00 < matches> I think the "Object of Arrays" approach has caused more problems than it solved :P
+11:02 < matches> (Probably not actually)
+11:09 < matches> Spaghetti
+11:09 < matches> I'm going to transform the coordinates before uploading to the GPU shaders
+11:09 < matches> Because I think that is the least objectionable?
+11:09 < matches> I don't know
+11:09 < matches> I still don't like any of the solutions
+11:10 < matches> But having more than one bounding rectangle definitely seems dumb
+11:10 < matches> Especially if the other is *always* {0,0,1,1}
+11:11 < matches> I hope this doesn't totally break your quad tree
+11:15 < matches> Actually looking at the quad tree it seems that is the best way to make it more likely to work
+11:21 < matches> I feel like we should use SVGMatrix more and Rect less
+11:21 < matches> But oh well
+11:29 < sulix> Ah: so the Quadtree kinda relies on the Bézier coordinates being relative to the bounding rectangle.
+11:29 < matches> Yep
+11:29 < matches> I'll do that
+11:29 < matches> It's easier to do the transform when the coordinates are uploaded to the GPU
+11:29 < matches> Although probably less efficient
+11:30 < matches> On the other hand, the CPU renderer relies on having absolute coordinates
+11:30 < matches> Two renderers
+11:30 < matches> TWICE the matrices
+11:30 < matches> TWICE the confusion
+11:31 < matches> And Rects are not really convenient because they aren't a proper transformation matrix
+11:31 < matches> I can't just multiply some Rects together
+11:31 < matches> Or calculate an inverse
+11:32 < sulix> Yeah, there are problems there.
+11:34 < matches> Hmm
+11:34 < matches> I *almost* fixed it
+11:34 < sulix> Rects are really good for the QuadTree, though.
+11:34 < matches> We should leave it as rects
+11:34 < matches> You just manually work out what it needs to be anyway
+11:35 < matches> I think the inverse of the equivelant matrix will always work as a rect
+11:35 < matches> So there are random lines missing from the beziers now
+11:35 < matches> But the ones that are there are in the right spot!
+11:36 < matches> (On the GPU)
+11:36 < sulix> So, I looked at that. I see random missing lines on Intel, not on nVidia.
+11:37 < matches> Oh were they missing before?
+11:37 < matches> Well I don't recall them being missing before
+11:37 < matches> Oh
+11:37 < matches> I know what it is
+11:38 < matches> When the bounding rectangle has width or height of zero
+11:38 < matches> Sigh
+11:38 < matches> Wait that can't be it
+11:38 < matches> Most of the missing lines aren't straight horizontal or vertical
+11:38 < matches> :S
+11:39 < sulix> I think it's just dodgy rounding on the GPU.
+11:40 < matches> I will push what I have I guess
+11:40 < matches> I have nice pretty debug rectangles (in *colour*) around the beziers when they are rendered on the CPU
+11:40 < matches> Somehow I don't think that is going to be sufficiently impressive progress in the meeting
+11:41 < sulix> Oooh... I'm looking forward to trying that.
+11:41 < sulix> I have an impressive Quadtree demo to do!
+11:41 < sulix> Assuming the bezier stuff doesn't suddenly break.
+11:41 < matches> ... it might
+11:41 < matches> Ok, I will `git stash` and then `git pull` as opposed to merging
+11:42 < matches> Yes, there are definitely not randomly missing beziers in your code
+11:44 < matches> Wait, was your quad tree working with beziers before?
+11:44 < matches> It wouldn't have been?
+11:44 < matches> All the bounds were wrong
+11:48 < matches> Ooh
+11:48 < matches> H and V
+11:48 < matches> What are they
+11:49 < sulix> Horizontal and Vertical lines
+11:49 < matches> Ah
+11:50 < sulix> The QuadTree works with beziers, but doesn't increase precision.
+11:52 < matches> Hmm, now to work out which of the 5 or 6 edge cases is breaking the Bezier bounds algorithm
+11:53 < matches> It's kind of hard to debug
+11:53 < matches> The edge cases apply seperately to the y and x directions
+11:53 < matches> So you can't tell just by looking at a curve that it is an edge case
+11:54 < matches> Unless you are a mathemagician I guess
+11:55 < matches> I don't understand
+11:55 < matches> The bounds for the beziers that disappear look right
+11:59 < matches> Maybe I'm not uploading the data correctly anymore
+12:03 < matches> Ok now it only breaks for the horizontal and vertical lines which I at least understand
+12:03 < matches> I was iterating over the object bounds and uploading the ones that had a type of BEZIER
+12:03 < matches> Oh
+12:03 < matches> Oh
+12:04 < matches> Yeah because I added a GROUP as well
+12:04 < matches> And every <path> gets a GROUP now
+12:04 < matches> So the order of indexes must be off
+12:14 < matches> Face palm
+12:14 < matches> This is why we have objects.data_indices
+12:19 < matches> I wish I'd added the SVG stuff earlier
+12:19 < matches> It makes it a lot easier to do stuff when you can mess around with actual documents
+12:42 < matches> I have pushed some stuff
+12:43 < matches> Mostly it just looks like I added a bunch of colourful rectangles to the CPU rendering
+12:43 < matches> I think I broke the Quad tree too
+12:43 < matches> Go team
+12:43 < matches> Oh and there are a bunch of not so colourful GPU rectangles
+12:43 < matches> Due to the "GROUP" object just using the outline rectangle shaders
+12:44 < matches> So part of the quad tree seems to work on the GPU but not all of it
+12:44 < matches> And none of it seems to work on the CPU?
+12:48 < matches> Also instead of rendering a slightly broken fox it now renders a segfault
+12:48 < matches> Similarly for the koch snowflake
+12:48 < matches> It's alright we can still draw Humphrey
+12:53 < matches> Oh
+12:53 < matches> It's just the quad tree that segfaults on the more complicated svgs
+13:38 < sulix> I have returned from the committee meeting, and that stupid 2/3rds majority thing has been revoked!
+13:38 < matches> Hooray!
+13:39 < matches> I should head towards University for the project meeting
+13:39 < matches> It is tempting to just stay home
+13:40 < matches> But that would probably not be wise
+13:41 < sulix> You should come.
+13:41 < sulix> I'm going to see if I can fix the Quadtree, but it looks like your changes have thoroughly broken it.
+13:41 < matches> Sorry!
+13:41 < sulix> By which I mean, it probably was only working if everything had bounds (0,0)-(1,1)
+13:41 < matches> Haha
+13:42 < matches> You can just undo my changes to demonstrate it if you want
+13:42 < matches> To the bus
+13:43 < sulix> I may yet do that...
+14:54  * sulix -> CSSE
+19:08 < matches> So shading on the CPU sort of totally breaks
+19:08 < matches> But it exists
+19:08 < matches> Progress!
+19:10 < matches> Bezier bounds are not as good as I'd hoped
+19:10 < matches> I think they only work if the end points form the bounds
+19:17 < sulix> Ah...
+19:21 < sulix> Btw, in the default "c" glyph, there are _two_ curves with bounds (0,0)-(1,1)
+19:21 < sulix> Numbers 9 and 18
+19:22 < matches> Yeah I found the wierd ebounds
+19:22 < matches> It's in the font code
+19:22 < matches> There is an AddBezierData with (0,0,1,1) instead of AddBezier (which automatically works out the bounds)
+19:22 < matches> For vlines
+19:22 < sulix> That'd do it.
+19:23 < matches> shape.svg seems to lose part of the curve now
+19:23 < matches> I've made the bezier control points relative
+19:23 < matches> Things mostly sort of work
+19:23 < matches> But the quad tree still looks fantastically broken
+19:25 < sulix> It always looks broken if you pan around or zoom out: it's my ugly baby.
+19:28 < matches> http://szmoore.net/ipdf/brokenbeziers.png
+19:28 < matches> To be fair the beziers are actually fine
+19:28 < matches> It's just the bounding rectangles that are broken
+19:28 < matches> Also shading should probably not be turned on unless it is actually a closed path
+19:29 < sulix> Hmm...
+19:29 < matches> Wait
+19:29 < matches> The beziers are rendering fine
+19:29 < matches> But the bounding rectangles are wrong
+19:29 < matches> Does this mean
+19:29 < matches> If I *fix* the bounding rectangles
+19:29 < matches> It will break something
+19:29 < matches> :-(
+19:29  * matches forges ahead nevertheless
+19:30 < matches> It does look suspiciously like it is only ever using P0 and P3 for the bounds
+19:30 < matches> Despite all that horrible solving for the turning points
+19:31 < sulix> Yeah.
+19:31 < matches> Oh
+19:32 < matches> I suspect if I fix this it will totally break the absolute to relative bezier transform then
+19:35 < matches> The file for those beziers is kind of interesting
+19:35 < matches> inkscape has used absolute commands for all except one of the beziers
+19:35 < matches> Why?
+19:35 < matches> The first one was copied and pasted with the control points moved
+19:35 < matches> Also for some reason random "translate" applied to the whole group
+19:36 < matches> It might make some sense if it caused the coordinates of the actual paths to come out as integers maybe
+19:36 < matches> But they don't
+19:37 < matches> There is translate and then the initial "moveto" is not 0,0
+19:37 < matches> I guess we shouldn't be trusting an svg editor that segfaults if you try recursion anyway
+19:59 < matches> Ok, high school maths:1, 5th year science/engineering student:0
+20:15 < matches> Also my amazingly clever shading algorithm has
+20:15 < matches> ...
+20:15 < matches> issues
+20:15 < matches> When the paths are not in the view
+20:16 < sulix> Ah...
+20:18 < matches> In fact it has many issues in many cases
+20:27 < matches> Hmm
+20:27 < matches> I wonder if this is what causes problems with evince/atril
+20:27 < matches> Ok not this
+20:28 < matches> I mean, if they use a similarly terrible except actually working shading algorithm
+20:28 < matches> And just draw everything to a really big texture so they can use it
+20:28 < matches> As opposed to clipping things
+20:28 < matches> That seems a little unbelievable though
+20:29 < matches> Surely that would crash long before you even got to >1600%
+20:30 < matches> I suppose what I should really do is look up some papers on shading
+20:30 < matches> Blergh
+20:35 < matches> Things are pushed
+20:37 < matches> Ah crap
+20:38 < matches> Things will be pushed in 8 hours according to my clock
+20:38 < matches> Just don't do anything until after 4am tomorrow and everything will be in the right order
+20:38 < matches> :P
+20:39 < sulix> That shading is _amazing_
+20:40 < matches> Try replacing the colour with rand()%255 for even more amazingness
+20:40 < sulix> If you zoom in _just_ the right amount, all hell breaks loose. I love it!
+20:40 < matches> Haha
+20:40 < sulix> Slowly panning across it is also magical!
+20:41 < matches> Try it on rabbit_simple.svg
+20:42 < sulix> I think Humphrey might have come down with a case of stripey binary myxomatosis.
+20:43 < matches> So I will have to think about shading a bit more :P
+20:43  * sulix braves the unholy combination of shading and quadtree.
+20:43 < matches> Oh I didn't try that
+20:44 < sulix> It actually doesn't look any different.
+20:44 < sulix> I think the quadtree only breaks w/ the GPU.
+20:44 < matches> Yes
+20:45 < matches> You lose the debug message if the node # > 9 it seems too
+20:46 < matches> At least the quad tree works on the CPU
+20:46 < matches> But why doesn't it work on the GPU they are now using the same bounds
+20:47 < matches> So should I prepare a report for Tim?
+20:47 < matches> Progress Report: Arbitrary precision numbers are unsurprisingly, totally infeasible
+20:47 < matches> Therefore, we implemented random bits of SVG
+20:47 < matches> Figure 1: A totally broken shading algorithm
+20:48 < sulix> You should include this image of the quadtree: http://davidgow.net/stuff/ipdf-humphreys-ghost-face.png
+20:48 < matches> Yes
+20:48 < matches> I wonder if since we're allegedly engineers we should document what bugs go with what images
+20:48 < matches> Hmmm
+20:49 < sulix> That's why I name the screenshots like that, I know this goes with the "Humphrey's Ghost Face" bug.
+20:49 < matches> Haha
+20:49 < matches> So we have the svg-test images
+20:50 < matches> Would it be worth while to have a commit script that automatically drew them and did screnshots
+20:50 < matches> It might be tricky though because you have to test panning and zooming and things
+20:50 < sulix> Yeah... perhaps videos?
+20:51 < matches> We'd need to be able to control the view automatically
+20:51 < matches> Which is actually required for that list of things in the proposal we are supposed to do anyway
+20:52 < sulix> I think we'll want that feature at some point anyway for doing proper performance tests
+20:54 < matches> I kind of want some sort of debug overlay for things like the bounding boxes too
+20:54 < sulix> Hmmm... the bounds look right: http://davidgow.net/stuff/ipdf-humphrey-bounds-ahead.png
+20:54 < matches> And a menu system
+20:54 < matches> And the ability to "insert SVG here"
+20:54 < matches> And open a file browser
+20:54 < matches> And...
+20:54 < matches> And...
+20:54 < matches> Yeah
+20:54 < sulix> I've been seriously considering doing a menu system.
+20:54 < matches> Too bad christmas is after the thesis is due
+20:54 < matches> Do it!
+20:55 < matches> We're running out of mouse buttons to toggle things :P
+20:55 < matches> Are there any SDL based menu systems that we can use easily?
+20:55 < sulix> There are a couple of OpenGL-y ones that might work.
+20:56 < matches> Let's not port the project from SDL -> FreeGlut
+20:56 < sulix> No.
+20:56 < sulix> Let's not.
+20:57 < sulix> (I'm looking for an SDL/OpenGL menu system so that I can replace FreeGLUT in the Graphics project(
+20:57 < matches> Could we use Qt or is that overkill?
+20:57 < sulix> I suspect it's probably overkill.
+20:59 < sulix> I've got a couple of old GUI libraries for SDL/OpenGL I wrote in high school I could dig up as a last resort.
+20:59 < matches> ... I have seen your high school code
+20:59 < matches> :P
+20:59 < sulix> (I think one of them uses a tiny bit of boost, though, so I'd rather avoid it)
+21:03 < matches> I kind of want to look at Qt at some point
+21:03 < matches> Maybe if we have the menu in a seperate window...
+21:03 < matches> Then we need threads...
+21:03 < matches> Then we have two problems...
+21:09 < matches> All the links to SDL libraries are broken
+21:34 < sulix> I'm not sure what changed, but now ipdf crashes my OpenGL debugger.
+21:42 < sulix> The QuadTree/GPU code works again!
+21:42 < sulix> Somehow the bug I fixed last night reappeared, but I've added the needed *2s back in.
+--- Day changed Fri Aug 15 2014
+08:43 < matches> So it seems to work well but things still go wierd on the GPU
+08:44 < matches> I'm in Quadtree node 32 looking at the tip of Humphrey's eyebrow
+08:44 < matches> The bottom line moves normally
+08:44 < matches> Vertically only sorry
+08:44 < matches> It doesn't move horizontally
+08:44 < matches> The top line stays still and every so often jumps to a new (wrong) position
+08:45 < matches> On the CPU it appears fine though
+08:45 < matches> Although on the CPU it doesn't show the "Current View QuadTree Node: 32"
+08:46 < matches> Hrm, I should add a 2d view of a car to the svg-tests
+08:47 < matches> Then I can be like "IT IS RELEVANT TO MECHANICAL ENGINEERING BECAUSE BEZIERS"
+08:47 < matches> In the conference/thesis offense
+08:48 < matches> My concern is actually more how I'm going to present the arbitrary precision number representations because they don't even work
+08:49 < matches> Well I should probably try Gmp rationals and Gmp floats before totally giving up I guess
+08:49 < matches> And also those p-adic things
+08:50 < matches> I never looked them up
+--- Day changed Sun Aug 17 2014
+14:38 < matches> Hey Qt has a lot of stuff in it
+14:38 < matches> They have their own iostreams that seem identical to std::iostream
+14:39 < matches> It's kind of cool I guess except there are "Qs" everywhere
+14:41 < matches> Ok we need a window icon
+14:41 < matches> This is vital
+15:54 < sulix> I've got SDL2 window icon setting code if you want it: https://github.com/sulix/omnispeak/blob/master/src/icon.c#L555
+16:04 < matches> Cool
+16:39 < matches> I'm bringing in spaghetti
+16:39 < matches> I mean Qt
+16:40 < matches> In theory this means the Debug functions should have a mutex if we want to debug things in the Qt stuff
+16:40 < matches> But in practice screw it
+16:40 < matches> What could go wrong?
+16:41 < matches> (Don't worry, I have a CONTROLPANEL_DISABLED define)
+16:42 < matches> This View/Document/Screen thing could probably be tidied up a lot
+16:42 < matches> But effort
+16:42 < matches> I think I'll just give ControlPanel direct access to document, screen and view
+16:42 < matches> Currently everything has to go through view
+16:43 < matches> Which would make more sense if some of screen was in view maybe
+16:43 < matches> Bah screw design
+16:51 < matches> So now we have 4 main classes!
+16:51 < matches> 4 x the fun!
+17:29 < matches> Bargh Qt needs its own version of make
+17:29 < matches> That's stupid
+21:09 < matches> So
+21:10 < matches> I have a mysterious LMS deadline that suddenly appeared
+21:10 < matches> "Progres Report"
+21:10 < matches> Description
+21:10 < matches> "asadf"
+21:10 < matches> Due
+21:10 < matches> 19th August, 11:01PM
+21:10 < matches> What
+21:14 < sulix> Oh dear.
+21:15 < matches> I have sent an email
+21:15 < matches> I hope that's not the conference abstract
+21:15 < matches> I also really hope we're allowed to use our own computer and things in the conference
+21:16 < matches> Also I really hope that if I can use my own computer it doesn't decide to shit itself anyway just to spite me
+--- Day changed Mon Aug 18 2014
+17:06 < matches> Good news and bad news!
+17:07 < matches> The kerning now appears to kern in the right direction
+17:07 < matches> But this means "BleedingCowboys.ttf" works
+20:30 < sulix> It's a pain to look up clipping of beziers, because there's a separate technique for doing something else called "bézier clipping"
+20:40 < matches> Baha
+20:41 < matches> I'm basically just procrastinating with Qt
+20:41 < matches> I mean
+20:41 < matches> Doing *awesome* things with Qt
+20:48 < sulix> I am looking with considerable envy at SolveQuadratic().
+20:49 < sulix> SolveCubic() will get very ugly.
+20:49 < sulix> Assuming I don't just sample the cubic at 100 points and look for roots.
+20:49 < matches> Haha
+20:49 < matches> Newton Raphson?
+20:50 < sulix> Very tempting.
+20:50 < matches> Then you can solve any bezier!
+20:50 < matches> Then we can put in Quintics!
+20:50 < sulix> Solving cubics exactly is not fun.
+20:50 < sulix> Dear god no.
+20:50 < matches> Imagine how many loops a quintic could have...
+20:51  * sulix cries quietly in the corner.
+20:53 < matches> So I'm calling AddText with sane values and nothing is happening :(
+20:56 < sulix> With or without quadtree?
+20:56 < sulix> With quadtree, everything is broken if you try adding things.
+20:56 < sulix> Because they won't be added to a node.
+20:57 < matches> No quad trees I think
+20:57 < matches> Yeah no quad tree
+21:00 < matches> Wait I think we need to rebuild the buffers or something
+21:07 < matches> Ah, ForceRenderDirty()
+21:14 < matches> I don't think the scale of our text is quite right?
+21:14 < sulix> Well, the scale of everything is wrong, but it's entirely possible that the text is _extra wrong_
+21:16 < sulix> In theory, the "scale" input to addText is the "height" of a character.
+21:19 < matches> Mmm
+21:19 < matches> I'm trying to add text relative to the current view
+21:19 < matches> But it isn't consistent
+21:19 < matches> When I go to a different view it is definitely not adding it in the same relative place
+21:20 < matches> The scale and positions aren't *already* relative are they?
+21:22 < sulix> Not to the view...
+21:24 < matches> What are they relative to?
+21:24 < matches> Anyway instead of fixing that bug I'm adding more
+21:25 < sulix> Umm... The bounding box maybe?
+21:25  * sulix investigates.
+21:26 < sulix> Scale and position should (I think) be normal, document coordinates.
+21:26 < matches> Odd
+21:26 < matches> Oh well
+21:26 < matches> Having Qt is totally worth it by the way
+21:27 < matches> Although it is still slightly embarrassing that it has its own SVG parser
+21:27 < matches> Ours is better!
+21:27 < matches> It has Reals everywhere!
+21:27 < matches> Except where it constructs Real from floats...
+21:27 < matches> And converts them to floats...
+21:28 < sulix> Thesis title should be "Keepin' it real: Staying afloat on the sea of document precision"
+21:31 < matches> Bahaha
+21:31 < matches> That is brilliant
+21:32 < matches> The Qt stuff is never deleting anything
+21:32 < matches> I suppose I should fix that at some point
+21:33 < matches> So basically it is a state machine and you use the menu to change the state
+21:33 < matches> Pressing OK does something depending on the state
+21:34 < matches> And there is a single text edit you can type stuff into
+21:34 < matches> In theory it can hide/show different widgets depending on the state
+21:34 < matches> I feel like I should add a "Generate Thesis Title" widget now...
+21:35 < matches> Also I can sort of see the appeal of lambdas for GUI programming now
+21:35 < matches> But I have a feeling they would totally break Qt anyway
+21:49 < matches> ...
+21:49 < matches> Ok sometimes the text gets added upside down...
+21:49  * sulix disclaims any and all responsibility for that.
+21:51 < matches> Yes!
+21:51 < matches> I finally did that thing I was saying I'd do for like 3 weeks
+21:51 < matches> Zoom in to floating point limit
+21:51 < matches> Add SVG
+21:51 < matches> Watch it explode!
+21:52 < sulix> Oooh...
+21:52 < matches> It is glorious
+21:54 < matches> We need to be a bit careful with thread safety in qt
+21:55 < matches> Really we should be able to request that the qt thread call UpdateAll itself
+21:55 < matches> Rather than calling it directly from the viewer thread
+21:55 < matches> But I'm not sure how that's done
+21:55 < matches> There's all this stuff about "Cross thread signals" on the internet
+21:56 < matches> It seems you can hide/show things but not much else
+22:47 < matches> Bah you pushed things!
+22:55  * sulix proclaims the new features as excellent and promptly goes to bed.
+--- Day changed Tue Aug 19 2014
+18:08 < matches> My conference is in the week starting 13th October
+18:08 < matches> Is Tim back then?
+18:08 < matches> "your supervisor will be invited to attend and mark your presentation"
+18:09 < matches> So if he can't go... I don't get a mark?
+18:12 < matches> It sounds suspiciously like they are going to get everyone's supervisors to mark them and then just scale everyone :S
+18:13 < matches> Surely at least one other person is going to read the final report...
+18:13 < matches> I've heard bad things about the engineering scaling system
+18:14 < matches> Your mark becomes inversely proportional to how well your supervisor's students did the previous year or something like that
+18:15 < matches> Anyway, two months left to accomplish something!
+20:05 < sulix> Worked out why the font bounds were weird.
+20:06 < sulix> AddText takes (msg, scale, x, y) not (msg, x, y, scale), so the coordinates were all bunk.
+20:09 < sulix> Fonts looks _amazing_ with floating pt errors, too.
+20:09 < sulix> http://davidgow.net/stuff/ipdf-i-think-you-mean-comic-fail.png
+20:29 < sulix> The Art of Computer Programming briefly mentions the Stern-Brocot tree, btw.
+20:29 < sulix> I can't see it being really useful, though.
+21:06 < sulix> My difficulty clipping bézier paths may be because it is actually impossible.
+21:06 < sulix> I think I've just found a paper saying that it is only possible for béziers which happen to be straight lines.
+22:55 < sulix> Never mind, it is possible, it's just very nasty.
+23:15 < sulix> Also C++14, because we need more lambdas: https://isocpp.org/blog/2014/08/we-have-cpp14

UCC git Repository :: git.ucc.asn.au