toxi.processing
Class ToxiclibsSupport

java.lang.Object
  extended by toxi.processing.ToxiclibsSupport

public class ToxiclibsSupport
extends java.lang.Object

In addition to providing new drawing commands, this class provides wrappers for using datatypes of the toxiclibs core package directly with Processing's drawing commands. The class can be configured to work with any PGraphics instance (incl. offscreen buffers).


Constructor Summary
ToxiclibsSupport(processing.core.PApplet app)
           
ToxiclibsSupport(processing.core.PApplet app, processing.core.PGraphics gfx)
           
 
Method Summary
 void box(toxi.geom.AABB box)
           
 void box(toxi.geom.AABB box, boolean smooth)
           
 void circle(toxi.geom.Vec2D p, float radius)
           
 void cone(toxi.geom.Cone cone)
           
 void cone(toxi.geom.Cone cone, boolean topClosed, boolean bottomClosed)
           
 void cone(toxi.geom.Cone cone, int res, boolean smooth)
           
 void cone(toxi.geom.Cone cone, int res, boolean topClosed, boolean bottomClosed, boolean smooth)
           
 void cylinder(toxi.geom.AxisAlignedCylinder cylinder)
           
 void cylinder(toxi.geom.AxisAlignedCylinder cylinder, int res, boolean smooth)
           
 void ellipse(toxi.geom.Ellipse e)
           
 processing.core.PGraphics getGraphics()
           
 void line(toxi.geom.Line2D line)
           
 void line(toxi.geom.Line3D line)
           
 void line(toxi.geom.ReadonlyVec2D a, toxi.geom.ReadonlyVec2D b)
           
 void line(toxi.geom.ReadonlyVec3D a, toxi.geom.ReadonlyVec3D b)
           
 void line(toxi.geom.Vec2D a, toxi.geom.Vec2D b)
           
 void line(toxi.geom.Vec3D a, toxi.geom.Vec3D b)
           
 void lineStrip2D(java.util.List<? extends toxi.geom.Vec2D> points)
          Draws a 2D line strip using all points in the given list of vectors.
 void lineStrip3D(java.util.List<? extends toxi.geom.Vec3D> points)
          Draws a 3D line strip using all points in the given list of vectors.
 void mesh(toxi.geom.mesh.Mesh3D mesh)
          Draws a mesh instance using flat shading.
 void mesh(toxi.geom.mesh.Mesh3D mesh, boolean smooth)
          Draws a mesh instance.
 void mesh(toxi.geom.mesh.Mesh3D mesh, boolean smooth, float normalLength)
          Draws a mesh instance.
 void meshNormalMapped(toxi.geom.mesh.Mesh3D mesh, boolean vertexNormals, float normalLength)
          Draws the given mesh with each face or vertex tinted using its related normal vector as RGB color.
 void origin(float len)
           
 void origin(toxi.geom.ReadonlyVec3D o, float len)
          Draws the major axes from the given point.
 void plane(toxi.geom.Plane plane, float size)
          Draws a square section of a plane at the given size.
 void point(toxi.geom.ReadonlyVec2D v)
           
 void point(toxi.geom.ReadonlyVec3D v)
           
 void point(toxi.geom.Vec2D v)
          Draws a 2D point at the given position.
 void point(toxi.geom.Vec3D v)
          Draws a 3D point at the given position.
 void points2D(java.util.Iterator<? extends toxi.geom.Vec2D> iterator)
           
 void points2D(java.util.List<? extends toxi.geom.Vec2D> points)
           
 void points3D(java.util.Iterator<? extends toxi.geom.Vec3D> iterator)
           
 void points3D(java.util.List<? extends toxi.geom.Vec3D> points)
           
 void polygon2D(toxi.geom.Polygon2D poly)
           
 void processVertices2D(java.util.Iterator<? extends toxi.geom.Vec2D> iterator, int shapeID, boolean closed)
           
 void processVertices3D(java.util.Iterator<? extends toxi.geom.Vec3D> iterator, int shapeID, boolean closed)
           
 void ray(toxi.geom.Ray2D ray, float length)
           
 void ray(toxi.geom.Ray3D ray, float length)
           
 void rect(toxi.geom.Rect r)
           
 void rotate(float theta, toxi.geom.ReadonlyVec3D v)
           
 void scale(toxi.geom.ReadonlyVec2D v)
           
 void scale(toxi.geom.ReadonlyVec3D v)
           
 void scale(toxi.geom.Vec2D v)
           
 void scale(toxi.geom.Vec3D v)
           
 void setGraphics(processing.core.PGraphics gfx)
           
 void sphere(toxi.geom.Sphere sphere, int res)
           
 void sphere(toxi.geom.Sphere sphere, int res, boolean smooth)
           
 void texturedMesh(toxi.geom.mesh.TriangleMesh mesh, processing.core.PImage tex, boolean smooth)
           
 void translate(toxi.geom.ReadonlyVec2D v)
           
 void translate(toxi.geom.ReadonlyVec3D v)
           
 void translate(toxi.geom.Vec2D v)
           
 void translate(toxi.geom.Vec3D v)
           
 void triangle(toxi.geom.Triangle2D tri)
           
 void triangle(toxi.geom.Triangle2D tri, boolean isFullShape)
           
 void triangle(toxi.geom.Triangle3D tri)
           
 void triangle(toxi.geom.Triangle3D tri, boolean isFullShape)
           
 void vertex(toxi.geom.ReadonlyVec2D v)
           
 void vertex(toxi.geom.ReadonlyVec3D v)
           
 void vertex(toxi.geom.Vec2D v)
           
 void vertex(toxi.geom.Vec3D v)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToxiclibsSupport

public ToxiclibsSupport(processing.core.PApplet app)

ToxiclibsSupport

public ToxiclibsSupport(processing.core.PApplet app,
                        processing.core.PGraphics gfx)
Method Detail

box

public final void box(toxi.geom.AABB box)

box

public final void box(toxi.geom.AABB box,
                      boolean smooth)

circle

public final void circle(toxi.geom.Vec2D p,
                         float radius)

cone

public final void cone(toxi.geom.Cone cone)

cone

public final void cone(toxi.geom.Cone cone,
                       boolean topClosed,
                       boolean bottomClosed)

cone

public final void cone(toxi.geom.Cone cone,
                       int res,
                       boolean smooth)

cone

public final void cone(toxi.geom.Cone cone,
                       int res,
                       boolean topClosed,
                       boolean bottomClosed,
                       boolean smooth)

cylinder

public final void cylinder(toxi.geom.AxisAlignedCylinder cylinder)

cylinder

public final void cylinder(toxi.geom.AxisAlignedCylinder cylinder,
                           int res,
                           boolean smooth)

ellipse

public final void ellipse(toxi.geom.Ellipse e)

getGraphics

public final processing.core.PGraphics getGraphics()
Returns:
the gfx

line

public final void line(toxi.geom.Line2D line)

line

public final void line(toxi.geom.Line3D line)

line

public final void line(toxi.geom.ReadonlyVec2D a,
                       toxi.geom.ReadonlyVec2D b)

line

public final void line(toxi.geom.ReadonlyVec3D a,
                       toxi.geom.ReadonlyVec3D b)

line

public final void line(toxi.geom.Vec2D a,
                       toxi.geom.Vec2D b)

line

public final void line(toxi.geom.Vec3D a,
                       toxi.geom.Vec3D b)

lineStrip2D

public final void lineStrip2D(java.util.List<? extends toxi.geom.Vec2D> points)
Draws a 2D line strip using all points in the given list of vectors.

Parameters:
points - point list

lineStrip3D

public final void lineStrip3D(java.util.List<? extends toxi.geom.Vec3D> points)
Draws a 3D line strip using all points in the given list of vectors.

Parameters:
points - point list

mesh

public final void mesh(toxi.geom.mesh.Mesh3D mesh)
Draws a mesh instance using flat shading.

Parameters:
mesh -

mesh

public final void mesh(toxi.geom.mesh.Mesh3D mesh,
                       boolean smooth)
Draws a mesh instance.

Parameters:
mesh -
smooth - true to enable gouroud shading (uses vertex normals, which should have been computed beforehand) or false for flat shading

mesh

public final void mesh(toxi.geom.mesh.Mesh3D mesh,
                       boolean smooth,
                       float normalLength)
Draws a mesh instance.

Parameters:
mesh -
smooth - true to enable gouroud shading (uses vertex normals, which should have been computed beforehand) or false for flat shading
normalLength - if >0 then face (or vertex) normals are rendered at this length

meshNormalMapped

public final void meshNormalMapped(toxi.geom.mesh.Mesh3D mesh,
                                   boolean vertexNormals,
                                   float normalLength)
Draws the given mesh with each face or vertex tinted using its related normal vector as RGB color. Normals can also optionally be shown as lines.

Parameters:
mesh -
vertexNormals - true, if using vertex normals (else face normals only)
normalLength -

origin

public void origin(float len)

origin

public final void origin(toxi.geom.ReadonlyVec3D o,
                         float len)
Draws the major axes from the given point.

Parameters:
o - origin point
len - axis length

plane

public final void plane(toxi.geom.Plane plane,
                        float size)
Draws a square section of a plane at the given size.

Parameters:
plane - plane to draw
size - edge length

point

public final void point(toxi.geom.ReadonlyVec2D v)

point

public final void point(toxi.geom.ReadonlyVec3D v)

point

public final void point(toxi.geom.Vec2D v)
Draws a 2D point at the given position.

Parameters:
v -

point

public final void point(toxi.geom.Vec3D v)
Draws a 3D point at the given position.

Parameters:
v -

points2D

public final void points2D(java.util.Iterator<? extends toxi.geom.Vec2D> iterator)

points2D

public final void points2D(java.util.List<? extends toxi.geom.Vec2D> points)

points3D

public final void points3D(java.util.Iterator<? extends toxi.geom.Vec3D> iterator)

points3D

public final void points3D(java.util.List<? extends toxi.geom.Vec3D> points)

polygon2D

public final void polygon2D(toxi.geom.Polygon2D poly)

processVertices2D

public final void processVertices2D(java.util.Iterator<? extends toxi.geom.Vec2D> iterator,
                                    int shapeID,
                                    boolean closed)

processVertices3D

public final void processVertices3D(java.util.Iterator<? extends toxi.geom.Vec3D> iterator,
                                    int shapeID,
                                    boolean closed)

ray

public final void ray(toxi.geom.Ray2D ray,
                      float length)

ray

public final void ray(toxi.geom.Ray3D ray,
                      float length)

rect

public final void rect(toxi.geom.Rect r)

rotate

public final void rotate(float theta,
                         toxi.geom.ReadonlyVec3D v)

scale

public final void scale(toxi.geom.ReadonlyVec2D v)

scale

public final void scale(toxi.geom.ReadonlyVec3D v)

scale

public final void scale(toxi.geom.Vec2D v)

scale

public final void scale(toxi.geom.Vec3D v)

setGraphics

public final void setGraphics(processing.core.PGraphics gfx)
Parameters:
gfx - the gfx to set

sphere

public final void sphere(toxi.geom.Sphere sphere,
                         int res)

sphere

public final void sphere(toxi.geom.Sphere sphere,
                         int res,
                         boolean smooth)

texturedMesh

public final void texturedMesh(toxi.geom.mesh.TriangleMesh mesh,
                               processing.core.PImage tex,
                               boolean smooth)

translate

public final void translate(toxi.geom.ReadonlyVec2D v)

translate

public final void translate(toxi.geom.ReadonlyVec3D v)

translate

public final void translate(toxi.geom.Vec2D v)

translate

public final void translate(toxi.geom.Vec3D v)

triangle

public final void triangle(toxi.geom.Triangle2D tri)

triangle

public final void triangle(toxi.geom.Triangle2D tri,
                           boolean isFullShape)

triangle

public final void triangle(toxi.geom.Triangle3D tri)

triangle

public final void triangle(toxi.geom.Triangle3D tri,
                           boolean isFullShape)

vertex

public final void vertex(toxi.geom.ReadonlyVec2D v)

vertex

public final void vertex(toxi.geom.ReadonlyVec3D v)

vertex

public final void vertex(toxi.geom.Vec2D v)

vertex

public final void vertex(toxi.geom.Vec3D v)