datavis

2016-01-04T14:02:08.001129Z

crawls out of the woodwork ooft missed some good stuff. @meow ported a swarm over to core.matrix, i like core.matrix, it turned out that the current implementation in Brevis is still faster than pure matrix just because of KD-trees (@mikera the comment about speed was skewed, because I’d left my video recording code enabled when doing the initial speed comparisons). @eggsyntax i was playing with that three.js playground code over break, but ran into some issues linking cljsjs/mathbox in a bootstrapped environment (i think that is cljs naivety that just requires a fresh start though) [also noting @meow that the approach was to link to that cljs-bootstrap-repl repo]

2016-01-04T14:03:39.001130Z

still going to port brevis’ matrix code to core.matrix, but that’ll be stalled a bit since 1-10k swarm agents are bearable now

2016-01-04T14:04:17.001131Z

and time constraints have me thinking about swapping back to a non-bootstrapped cljs-mathbox for now

meow 2016-01-04T14:09:01.001132Z

I have a few minor issues with core.matrix but I have to say I have been quite pleased with it so far as a library.

meow 2016-01-04T14:12:41.001133Z

Starting with the bad - I think there needs to be more documentation and I don't like some aspects of the current docs as far as how to use the library in your namespace. I've settled on simply doing (:require [clojure.core.matrix :as mx]) which doesn't pollute my namespace. I don't bother with the operators (which then have to be excluded from clojure otherwise you keep getting warnings).

meow 2016-01-04T14:13:40.001134Z

Not a big deal but this little crap sure slows you down when you first start using a new library.

meow 2016-01-04T14:15:09.001135Z

Next complaint is that the docstrings in the source code are of an inconsistent length and too many of them are > 80 chars which doesn't work well with the way I've got my code and repl windows arranged in Cursive.

meow 2016-01-04T14:15:34.001136Z

Which quickly brings us to the good stuff. There actually are docstrings! :simple_smile:

meow 2016-01-04T14:18:15.001137Z

Seriously. There are docstrings and they are pretty good. The code is readable and does a nice job of using protocols. I feel like it was a good move for me and I will have much better control and understanding of my use of matrices and vectors (in the matrix/vector sense, not to be confused with basic Clojure vectors, just like the map function shouldn't be confused with the map structure, oy vey!)

2016-01-04T14:18:53.001138Z

mmm, i do like it as well, and also immediately put it into its own namespace instead of how it is setup in the examples

meow 2016-01-04T14:19:32.001139Z

Performance is good and maybe slightly better than what was in the http://thi.ng library.

2016-01-04T14:20:17.001140Z

on what kind of operations?

2016-01-04T14:20:57.001141Z

specifically, things at the level of individual vertices represented as core.matrix vectors?

meow 2016-01-04T14:23:23.001142Z

So here is the fun part. At this point a mesh is a defrecord with one attribute which is a clojure set of faces, and a face is just a clojure vector of vertices, where a vertex is a Vector3 from vectorz. Everything else is a computed index that may or may not get assoc'd with the mesh.

meow 2016-01-04T14:23:47.001143Z

Which means there is lots of room for experimentation with alternate structures.

2016-01-04T14:24:15.001144Z

ah, so the operations are for small matrix ops?

2016-01-04T14:24:34.001145Z

1x3 and 3x3 inputs?

meow 2016-01-04T14:25:25.001146Z

well, there are small things like scale and normalize and so forth that get applied at the Vector3 level.

meow 2016-01-04T14:27:20.001147Z

But I'm putting the entire mesh through multiple operators, each of which builds a new mesh based on the old mesh and those end up producing into the millions of faces so I want to explore storing those faces in matrices instead of a clojure set.

2016-01-04T14:31:51.001148Z

gotcha

meow 2016-01-04T14:32:14.001149Z

What I have, though, is a situation where each operation might need to have different indexes into the mesh data. So rather than try to have one monolithic approach to the structure of a mesh I've adopted an approach where each operator expects to receive a mesh in some minimal representational form. Then it creates indexes that it may just hold onto locally or it can assoc to the mesh (because a mesh is just a simple defrecord that is primarily about protocol implementation, not about data structure) to do whatever the operation needs to do. Then it returns a new, simple mesh again.

meow 2016-01-04T14:33:50.001150Z

So what I will probably end up with is a wide variety of ways to quickly/temporarily get mesh data in whatever structure is needed for the duration of some function operator.

meow 2016-01-04T14:35:02.001151Z

One mesh defrecord with lots of ways to index it as opposed to several different defrecords defining different mesh structures.

meow 2016-01-04T14:37:09.001152Z

To take a seed shape, mutate the heck out of it, and produce an X3D file or anything similar, all you need is a collection of faces where a face is an ordered sequence of vertices in counter-clockwise order. That's it. Everything else is just indexing it to make it easier to perform an operation.

meow 2016-01-04T14:38:06.001153Z

This is true because I'm not trying to create a GUI editing environment where the user needs to be able to select and mutate stuff.

meow 2016-01-04T14:38:52.001154Z

If that were the case I would have to pick something like a winged-edge data structure or something.

meow 2016-01-04T14:39:22.001155Z

But I'm targeting doing everything in clojure so there functions rule the day.

meow 2016-01-04T14:50:45.001156Z

All the code is here if anyone wants to look at it or comment on the approach. I'm open to alternative points of view. https://github.com/pkobrien/cad/tree/master/src/cad/mesh

eggsyntax 2016-01-04T16:10:53.001158Z

@kephale: awesome — Lemme know if you get stuck, I’d be happy to see if I can help (although my availability is intermittent this week).

2016-01-04T16:51:12.001159Z

@eggsyntax: have you seen https://github.com/evanw/theta

2016-01-04T16:51:28.001161Z

not cljs, but just saw it released

eggsyntax 2016-01-04T17:21:13.001162Z

No, that’s cool! Haven’t heard of Skew before. I tend to just jump to http://wolframalpha.com if I just need a quick graph. For something to include in code, I’ve gone a bunch of different ways. For graphing data (in my code), I often turn to http://multigraph.org/, which a friend of mine wrote and should be much better-known IMO...

2016-01-04T17:26:02.001164Z

Oh neat, multigraph looks good… i think i’ll still try to stick it out until getting the bootstrapped cljs-mathbox working in terms of web-based plotting, but we shall see… the semester is quickly approaching