This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-24
Channels
@eggsyntax: with me!
@eggsyntax: if it was limited to one or two examples that would be one thing. Over the past year I have read so many math-related texts that covered stuff I was coding. And when I then wrote the code I realized that the math texts were 95% bullshit.
Right now it is polygon mesh processing. Before that is was L-Systems and cellular automata.
Do any kind of google search on L-Systems and you will find stuff about the various kinds of systems: stochastic, parametric, context-sensitive, etc. all in capitalized letters like it was special. It can all be represented with functions that take arguments - no big deal. But they act like it is.
I think only about 1% of mathematical writing is of any value - the rest is crap. Not kidding.
Sure. You might enjoy some of the Mathbox author's presentations for an awesome counterexample, eg http://acko.net/blog/how-to-fold-a-julia-fractal/ I personally don't care for his writing on social issues at all, but his math & graphics presentations are pretty amazing.
Yeah, it's nice to find someone worth reading, and they usually turn out to be good programmers as well.
@Kephale if you are lucky you can get the JVM to do the right escape analysis and allocate small fixed size 3D vectors (like the vectorz Vector3) on the stack. In which case they are pretty cheap
@mikera: I don’t quite get it, it looks like Vector3 in vectorz enumerates dimensions as x,y,z and then will translate to array vectors if you ask it to, if I’m not mistaken?
@mikera: or are you saying that the conversion is pretty cheap? (where the case that i believe we are talking about is, handling matrices Nx3 and doing a bunch of lin alg on those, then swapping back to a renderer which always expect something like Vector3)
relatedly, i’ll be gathering with a bunch of folks in germany in a few weeks to work on some code for GB/TB image analysis, and a few of these folks have different renderers (and a few are JOGL contributors)
the main Vector3 implementations folks are using seem to be vecmath’s Vector3f and org.apache.commons.math3.geometry.euclidean.threed.Vector3D
which upsets me, because the former is certainly being used on the JOGL side for rendering, and the latter is being used for a lot of mesh ops (because it has better math), but if you want to do work on meshes in real-time you’re paying unnecessary conversion overhead
Yeah my point is that the conversion is very cheap, assuming escape analysis works. You can do the bulk of processing on a big Nx3 array, and only switch to Vector3 implementaions for the final render call
(noting that most of the code is getting written in pure Java, but I’ll be writing Clojure wrappers) any thoughts on a way to consolidate (would be totally down for trying to convert people to vectorz)?
In some cases your renderer may accept double arrays directly, in which case you get a bonus :-)
perhaps the suggestion i’ll push for is to stop doing meshops on data encoded in Vector3’s and instead do it all in matrices
i’d expect some resistance though, since quite a few things are more intuitive to program with Vector3s as the variables
I think it really depends on use cases. For stuff like particle simulations, I'd definitely use matrices because there are so many identical computations and you get a huge benefit from matrix ops. If you are just storing the co-ordinates of a higher level scene object, Vector3 s are probably more convenient and performance will be fine
I tried to write vectorz and core.matrix so that the two are fairly easy to convert between, e.g (add! x dx) will do the equivalent thing with both vectors and arrays
@mikera: well a lot of the discussions i’m involved in are about meshops, which i’d argue are something of a grey area there. lots of identical operations, but sometimes you need to go Nx3 -> (N+M)x3, and sometimes you might just be drilling down and expanding from a single initial set of Vector3s (like subdivision of faces type of stuff)
oh, @eggsyntax have you poked at landofquil from this year’s clojurecup?
err more importantly, i saw someone bootstrap their rendering system with CLJS, so its fully in-browser with no serverside stuff
I took a quick look. Very cool . I did a lot of Processing for years, and I’ve played with Quil, so it wasn’t worth going through the examples in detail, but I was impressed as hell that they pulled that off
i’m just thinking cljs-mathbox + codemirrror + bootstrapped cljs for a full in-browser deal
For our project, we have to have serverside stuff, so we’re unlikely to go that direction…
im teaching a machine learning course in the spring, and the thought of being able to demo ML algorithms live (plus getting students up and running with no installation) is incredibly appealing
If you were inspired to implement that, I suspect the MB author would be really psyched to use it.
i havent quite figured out how folks are doing it, but there are some git repos up that at least have compiled working demos
@kephale I am working on a Clojure machine learning library with Jeff Rose and his company... Might be too early for your uses but it is going to be pretty awesome
What I found was a variety of initial attempts at repl in the browser, but nothing rock solid. And I wanted it to work in devcards with omnext.
@mikera: ooo, hopefully more idiomatic than clj-ml? I definitely just call Weka directly these days. any particular algorithms you’re targeting?
@eggsyntax: BTW, the thought is really just to smoosh that threejs-cljs-playground with cljs-mathbox-example to convince myself that it will work, and move on from there
Based on core.matrix, so should be portable to cljs once the core.matrix cljs support is complete
oh cool, i’d seen the CLJS issue on core.matrix, but wasn’t aware of how much of a push there was for that
Would appreciate any testing / sanity checking, I'm not really a cljs expert but I think Jeff has done a pretty impressive job
ooo, will do, that would definitely be useful for demoing ML stuff (noting that the neural net/deep learning part of the course comes at the end of the spring)
hey @eggsyntax i’ve run into a thing. does mathbox do some global stuff when it is loaded (specifically to the threeJS variables)?
Oh, at load time? Not that I recall, but I haven’t dug into that part of the MB internals. But lemme go verify that I’m not doing it at the cljs level.
like, i thiiiink it is actually still working, but just taking control of the viewport and BG color
at one point i was able to see the edge of that sine curve, but i’m whittling it down, and it seems like when that require is called, it is at least setting background color
Yeah, I just double-checked that as well & I’m sure it’s not at the cljs-mathbox level. But yeah, it could be at the MB level.
Not anything I can do today, but if MB itself is doing something globally, it should be visible in https://github.com/unconed/MathBox.js/blob/legacy/build/MathBox-core.js
Also, if it is, I might be able to prevent it by delaying by delaying the require
until instance creation time.
If you want to try delaying the require, I can test that here & send you a patch if you want. Of course, you’d have to switch to a local copy of MB to try it (instead of requiring from clojars), but that’s quite easy using checkouts
:
http://stackoverflow.com/a/7411652
but it isnt a biggie, ill eventually figure out how to override that initialization stuff, and have to get an idea about that anyway
That said, you might be able to do it with mathbox on cljsjs. https://cljsjs.github.io/
You could clone it from here: https://github.com/cljsjs/packages
No, sorry, I’m mistaken — that doesn’t have a project.clj either, only a build.boot.
But again, I just meant checking out cljs-mathbox locally — wouldn’t let you dig into the MB internals, but you could do the dependency locally and then delay the require in there.
i think it would probably be useful to just figure out how to get at the threejs variables from mathbox
since there will be a need to modify the overlay/renderer to fit the codemirror pane anyway
If you really want to do the Mathbox.js dependency, locally though, I know how you could do that (it’s what I did before I put it on cljsjs.
Yeah, you ought to be able to do that just in your own code by getting them on your MB instance.
& just use the JS interop functions. ie (.-theDesiredProperty my-instance)
and (.theDesiredMethod my-instance)
.
Totally! Coming from clj, I remember losing a couple of hours trying to figure out why the hell (.theDesiredProperty my-instance)
wasn’t working… 😡
Really useful article on JS interop here: http://www.spacjer.com/blog/2014/09/12/clojurescript-javascript-interop/