[ANN] thi.ng collection update (CLJ/CLJS)

310 views
Skip to first unread message

Karsten Schmidt

unread,
Feb 25, 2015, 12:07:09 AM2/25/15
to clo...@googlegroups.com, clojur...@googlegroups.com
Hi guys,

thi.ng is a collection of over a dozen largely x-platform Clojure &
Clojurescript libs for computational/generative design & data
visualization tasks.

I just wanted to give a little heads up that this project has recently
seen a number of releases and, as a whole, by now is generally quite
stable and usable (*is used*) for realworld projects (although most
libs remain in constant parallel development to make them more feature
complete). I've collated a number of images of projects and links to
the most important libs here:

http://thi.ng/

Most notably of those:

http://thi.ng/geom
By far the largest sub-project and backbone for most others: A 2D/3D
geometry package w/ comprehensive vector algebra, swizzling,
intersections, matrix types & helpers, quaternions, pure shape
primitives with ~50 protocols for polymorphic enquiry & manipulation,
meshes (incl. I/O), mesh subdivisions, CSG mesh ops, Verlet physics
engine (only particles, springs, behaviors)... Most of this lib is
pure geometry w/ no rendering specifics, although there're separate
modules for SVG rendering w/ shader support & decorators [1], WebGL
wrapper and converters from shapes/meshes to VBOs and various shader
presets/utils.

http://thi.ng/shadergraph
GLSL (WebGL) pure function library & dependency graph (based on
com.stuartsierra/dependency), GLSL minification during CLJS compile
time

http://thi.ng/color
RGB, HSV, CMYK, CSS conversions, color presets (incl. D3 category schemes)

http://thi.ng/luxor
Complete scene compiler DSL for http://luxrender.net, based around thi.ng/geom

http://thi.ng/morphogen
Declarative 3D form evolution through tree-based transformations,
basically an AST generator of geometric operations to transform a
single seed node into complex 3D objects

http://thi.ng/tweeny
Interpolation of nested (presumably animation related) data
structures. Allows tweening of deeply nested maps/vectors with
completely flexible tween fns/targets and hence easy definition of
complex timelines

http://thi.ng/validate
Purely functional, composable data validation & optional corrections
for nested data. Supports both maps & vectors, wildcards, comes with
many predefined validators, but extensible...

http://thi.ng/trio
A generic, non-RDF specific triple store API and feature rich
SPARQL-like query engine
(and my prime example of using the literate programming approach with
org-mode[2][3])

Last but not least: Super special thanks are due to the following people:

Rich, Alex + rest of clojure.core
David (+everyone else involved) for the immense effort on making CLJS
proper useful,
Chas, Kevin and anyone else working on CLJX...
none of this would have been possible without these amazing tools!

Best, K.

Ps. There're a number of other libs in this collection which are in
dire need of updating (last touched spring 2013) - these are related
to general OpenCL functionality and voxel rendering. Some of the
example images on the above site were created with these...

[1] https://github.com/thi-ng/geom/blob/master/geom-svg/src/examples.org
[2] https://github.com/thi-ng/trio/blob/master/src/query.org
[3] http://orgmode.org/

--
Karsten Schmidt
http://postspectacular.com | http://thi.ng/

adriaan...@gmail.com

unread,
Feb 25, 2015, 2:59:52 AM2/25/15
to clo...@googlegroups.com, clojur...@googlegroups.com, in...@toxi.co.uk
Just took a look at your website,

Very nice project. In my opinion a prime example that clojure is suitable for large projects.

I don't know if anyone ever thought about it. But I guess the geom library would be a good option as a backend for a plotting library (ggplot style). (eg in incanter, gorilla repl ...)
Especially since it both works in clojure and clojurescript.

greets and keep up the good work

Op woensdag 25 februari 2015 06:07:09 UTC+1 schreef Karsten Schmidt:

Dylan Butman

unread,
Feb 25, 2015, 12:04:23 PM2/25/15
to clojur...@googlegroups.com, clo...@googlegroups.com, in...@toxi.co.uk
Hey Karsten,

Really glad to see you've been continuing the awesome work here! I used toxiclibs extensively when I first starting programming in processing and it was hugely influential for me! I've been drifting away from computational design since then but I'm hoping to get some serious time to play with your clojure work soon.

Best
Dylan

Bruce Durling

unread,
Feb 25, 2015, 5:35:05 PM2/25/15
to clojur...@googlegroups.com, clo...@googlegroups.com
Karsten,

Is there a reason why you went with a README.md and then an index.org
rather than a plain README.org?

(love all the rest of it and loved your use of it at The Barbican. I
need to get my head around it all. I'm wondering if I can use it for
some of the geographic and other charting things I do a lot of).

cheers,
Bruce
> --
> Note that posts from new members are moderated - please be patient with your first post.
> ---
> You received this message because you are subscribed to the Google Groups "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
> To post to this group, send email to clojur...@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.

Karsten Schmidt

unread,
Feb 25, 2015, 6:13:31 PM2/25/15
to clojur...@googlegroups.com, clo...@googlegroups.com
That's a good point, Bruce! To be honest, I don't know anymore, but it
makes complete sense to change it. Consider it done! :)

As for your mapping question, yes, of course! I've done a few of them.
E.g. the first pic on the website [1] was a project for The ODI in
2013 and is a map of different council/borough stats of London (here
knife crime). The shape files were first retrieved & processed with
the thi.ng/trio lib directly from the UK statistics office's SPARQL
endpoint [2], then projected to Mercator, converted to 2d polygons,
smoothed them and then extruded as 3D walled meshes and exported as
STL files using geom. To create that rendered image, another function
then combined all borough meshes into a complete render scene for
Luxrender (using the luxor lib). Since this all was for a 60sec
animation, I also wrote the tweeny lib for that project to allow me to
define the timeline for the various camera, mesh, light & shader
changes. The whole bundle was then sent to EC2 and rendered on 340+
CPUs... basically, spawned a private render farm.

Alternatively with < 30 lines of code you could query any UK
constituency (or use similar endpoints for other countries), do those
initial shape transformations and send the resulting STL mesh file
straight to a 3D printer... For online use, of course the SVG or WebGL
modules would be more interesting, but these really would just deal
with that last transformation/visualization step, i.e. turning a
thi.ng.geom.Polygon2 into an SVG <polygon> node or tesselate it and
stuff it into WebGL buffer to display...

For more flexible mapping, it'd be great to port some/all of the
projections from [3] in its own clj lib for easier (and non-JS
related) access...

[1] http://thi.ng/img/04.jpg
[2] http://statistics.data.gov.uk/doc/statistical-geography
[3] https://github.com/d3/d3-geo-projection/

Hth!
http://postspectacular.com | http://toxiclibs.org | http://toxi.co.uk

Jason Felice

unread,
Feb 25, 2015, 6:22:01 PM2/25/15
to clo...@googlegroups.com, clojur...@googlegroups.com
So... what is "computational design"?

I've been using OpenSCAD to make models for 3D printing, and I keep wishing for a Clojure syntax and real functions and things.  Is this it?

(It doesn't seem to have constructive solid geometry for things which aren't meshes.)

-Jason


--

You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com

Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Karsten Schmidt

unread,
Feb 25, 2015, 6:49:44 PM2/25/15
to clo...@googlegroups.com
Computational design = using computational approaches to design
problems, for anything from analysis, implementation to
representation...

CSG is indeed only for meshes since it's based on BSP partitioning and
because of that also has a few edge cases (due to float precision)
where it breaks down and can cause small holes to appear (but these
can be fixed with Meshlab/Blender etc). Does OpenSCAD *not* use
tessellated geometry for boolean ops? I always was under the
impression it does too... need to double check! The other way to do it
(and actually easier) is via voxels. There's a really old iso surface
implementation in [1], but that needs a complete rewrite and is
therefore not bundled with any current releases...

Again, I wish there would be more activity in Clojureland underway in
these non-web-tech related fields (we have dozens of server & dom
libs, but not that much for design, modelling, architecture,
fabrication). That's not trying to be defensive in any way, but a
single person can only do that much and all the features & tools
provided so far were purely developed on a need to have basis
(obviously with a priority to be as re-usable as possible).

Hth! K.

Dylan Butman

unread,
Feb 25, 2015, 7:42:38 PM2/25/15
to clojur...@googlegroups.com, clo...@googlegroups.com
I totally thought that map was a photo of 3d printed shapes, but it makes sense that you're using luxrender now. Is there a video of the animation online somewhere?

>> To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscribe@googlegroups.com.

>> To post to this group, send email to clojur...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/clojurescript.
>
> --
> Note that posts from new members are moderated - please be patient with your first post.
> ---
> You received this message because you are subscribed to the Google Groups "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscribe@googlegroups.com.

> To post to this group, send email to clojur...@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.



--
Karsten Schmidt
http://postspectacular.com | http://toxiclibs.org | http://toxi.co.uk

--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to a topic in the Google Groups "ClojureScript" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/RlESPn4PHkM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojurescript+unsubscribe@googlegroups.com.

Karsten Schmidt

unread,
Feb 25, 2015, 7:59:01 PM2/25/15
to clojur...@googlegroups.com, clo...@googlegroups.com
This draft anim was created for The ODI and shows 2 years (summer
2011-2013) worth of London knife crime (based on open data ambulance &
A&E reports):

http://media.thi.ng/2013/odi/20131029-heatmap-draft-1280x960.mp4
>> >> an email to clojurescrip...@googlegroups.com.
>> >> To post to this group, send email to clojur...@googlegroups.com.
>> >> Visit this group at http://groups.google.com/group/clojurescript.
>> >
>> > --
>> > Note that posts from new members are moderated - please be patient with
>> > your first post.
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups "ClojureScript" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an email to clojurescrip...@googlegroups.com.
>> > To post to this group, send email to clojur...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/clojurescript.
>>
>>
>>
>> --
>> Karsten Schmidt
>> http://postspectacular.com | http://toxiclibs.org | http://toxi.co.uk
>>
>> --
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "ClojureScript" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/clojurescript/RlESPn4PHkM/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> clojurescrip...@googlegroups.com.
>> To post to this group, send email to clojur...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/clojurescript.
>
> --
> Note that posts from new members are moderated - please be patient with your
> first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojurescrip...@googlegroups.com.

Daniel

unread,
Feb 25, 2015, 10:56:07 PM2/25/15
to clo...@googlegroups.com
This is incredible work. Thanks for sharing!

kovas boguta

unread,
Mar 12, 2015, 8:19:04 PM3/12/15
to clojur...@googlegroups.com, clo...@googlegroups.com
Hi Karsten,

Technical usage question. 

I want to associate a color to each face of a cuboid, tesselate the cuboid, and end up with an array of vertices and an array of matching colors. 

My problem is associating the colors of the cuboid faces to their tessellated versions. AFAICT tessellation simply produces new faces and does not have facilities for propagating annotations from the old face to the new faces. Furthermore, because the faces are stored in an unordered set, it is not possible to somehow match the new faces to the old ones based on ordering, at least in this simple case.

I tried to work around this by supplying the face set as an empty vector to the mesh constructor. Unfortunately this doesn't work because the creation of the new mesh simply calls the default constructor function, so the new faces end up getting poured into a set anyway. 

If instead, it called (empty) on the faces of the supplied mesh, this workaround could work. However it is brittle, requiring to one know ahead of time how many new faces will be generated for each input face. 

Is there a better way to do this?

Thanks!

kovas boguta

unread,
Mar 12, 2015, 8:25:50 PM3/12/15
to clojur...@googlegroups.com, clo...@googlegroups.com
On Thu, Mar 12, 2015 at 8:18 PM, kovas boguta <kovas....@gmail.com> wrote:

I want to associate a color to each face of a cuboid, tesselate the cuboid, and end up with an array of vertices and an array of matching colors. 

To clarify, I want to turn the cuboid into a mesh, and then do the tessellation of the mesh. Tessellating the cuboid directly gives me the faces in an obvious predictable order. However I want the mesh b/c theres other computations I want to perform with it. 
 

Karsten Schmidt

unread,
Mar 13, 2015, 8:28:06 AM3/13/15
to clojur...@googlegroups.com, clo...@googlegroups.com

Hi Kovas, so far the mesh types (GMesh & BasicMesh) were mainly used for 3d printing rather than viz purposes and have not yet support for vertex or face attributes. It is something I still need to port over from the previous version of the lib. I held off on that so far to first let the WebGL conversion parts settle (almost done) and will address this in the next month. The aim is to provide an attribute structure allowing any type of attribute along with serializers for common attribs (UVs, colors, IDs) for WebGL and provide hooks to interpolate attribs (e.g. for subdivisions). Ultimately this might even become available for other types too, i.e. directly on the cuboid, aabb, lines etc.

As for the current state: I've created a gist showing how this can be achieved currently, in principle:

https://gist.github.com/postspectacular/894fc58d75005069a546

Thanks for the feedback, as always highly appreciated!

K.

Reply all
Reply to author
Forward
0 new messages