gems4
The most convenient library to use in ruby
is a gem
, and picrate
is no different, however in addition to pure ruby gems
there are a number of gems
that are wrappers for java
libraries that can be used in picrate
:-
ArcBall gem
This library is installed as a picrate
dependency, and is used in 3D sketches to provide arcball manipulation of a 3D object (using quaternions in java).
require 'arcball'
class MySketch
...
def setup
...
Processing::ArcBall.init(self)
...
In the above snippet the sketch viewport is centered at half width and half height of the sketch, which is also the center of rotation. Manipulate the object in the sketch center by dragging the mouse in direction of rotation, or us the mousewheel to zoom.
Toxiclibs gem
Is a ruby wrapper around Karsten Schmidts (aka toxi / postspectacular) toxiclibs libraries, in picrate
you should prefer to use this collection of libraries as a gem
. The toxiclibs libraries are a set of building blocks for computational design, that were designed to be compatible with processing-2.2.1 (and earlier versions of java). The gem is maintained independently from the version available in the processing ide, and the java code has been updated to make use java-8 and to be compatible with processing-3.3.7
and hence picrate
. The gem also provides a convenient namespaces for the toxiclibs libraries see examples sketches, so you don’t have to individualy import the java classes/packages.
Geomerative gem
Is a ruby wrapper around Ricard Marxer (@rikrd @ricardmp) geomerative library. It extends 2D geometry operations to facilitate generative geometry. Includes a TrueType font and an SVG interpreters. See the gem here, which has been updated for java-8 and under the hood imports for Geomerative classes, so that you don’t have to.
PBox2D gem
Is a java and ruby wrapper around Daniel Murphy (@dmurph) JBox2D library (JBox2D is a close Java port of Erin Catto’s excellent C++ Box2D physics engine and Google’s LiquidFun physics Engine.). The java wrapper provides an interface between the processing and game physics worlds.
Wordcram gem
Is a ruby wrapper around the Wordcram library by Dan Bernier, that can be used to create world clouds in JRubyArt or picrate. See documentation.
Raytracing gem
The joonsrenderer gem can be used to ray trace 3D objects in processing sketches. Includes an updated to java-8 version of the java sunflow library, and uses a more up to date version of the janino compiler.