L3D
Class L3D

java.lang.Object
  extended by L3D.L3D

public class L3D
extends Object

This is a template class and can be used to start a new processing library or tool. Make sure you rename this class as well as the name of the example package 'template' to your own library or tool naming convention. (the tag example followed by the name of an example included in folder 'examples' will automatically include the example in the javadoc.)


Field Summary
static PVector center
           
static int[][][] cube
           
static boolean manualUpdate
           
 boolean pose
           
static int scale
           
static int side
           
static int size
           
static Spark spark
           
static Streaming stream
           
static Text text
           
static String VERSION
           
static double xAngle
           
static double yAngle
           
 
Constructor Summary
L3D(PApplet _parent)
          This is the simplest constructor for the cube -- it's only used for local simulation of the cube In order to stream data to the cube, call the other constructor, L3D(this, "yourSparkAccessToken)
L3D(PApplet _parent, int _side)
           
L3D(PApplet _parent, String accessToken)
          This constructor sets up the computer to stream the data it's displaying to a cube on your local network.
L3D(PApplet _parent, String accessToken, String name)
          This constructor sets up the computer to stream the data it's displaying to a cube on your local network.
L3D(PApplet _parent, String username, String password, int _size)
          This constructor uses your spark/cubetube username and password to get an existing access token from your account, and then streams to your core named
L3D(PApplet _parent, String username, String password, String coreName)
          This constructor uses your spark/cubetube username and password to get an existing access token from your account, and then streams to your core named
 
Method Summary
static void addVoxel(double x, double y, double z, int col)
           
static void background(int col)
           
static int color(int r, int g, int b)
           
static int colorMap(float val, float min, float max)
           
 void disableDrawing()
           
 void disablePoseCube()
           
 void draw()
           
 void enableDrawing()
           
static void enableMulticastStreaming()
           
static void enableMulticastStreaming(int port)
           
 void enablePoseCube()
           
static int getVoxel(int x, int y, int z)
           
static int getVoxel(PVector p)
           
static void line(PVector p1, PVector p2, int col)
           
 void loadFile(File file)
           
 void marquis(String message, float initialPosition, int col)
          Marches a text marquis across the sides and front of the cube
 void mouseEvent(MouseEvent event)
           
 void poseCube()
           
 void saveFile()
           
 void saveFile(boolean binaryFormat)
           
 void scrollSpinningText(String message, PVector initialPosition, int col)
          This will a text message across the zPlane of the initialPosition message, with the letters rotating along their y axes For more elaborate letter rotations, check out the Text.showChar function
 void scrollText(String message, PVector initialPosition, int col)
          This will a text message across the zPlane of the initialPosition message.
static void setAutomaticStreaming()
           
static void setManualStreaming()
           
static void setVoxel(double x, double y, double z, int col)
           
static void setVoxel(int x, int y, int z, int col)
           
static void setVoxel(int x, int y, int z, int r, int g, int b)
           
static void setVoxel(PVector p, int col)
           
static void setVoxel(PVector p, int r, int g, int b)
           
static void sphere(PVector center, float radius, int col)
           
static void streamToCore(int port, String name)
           
static void streamToCore(String name)
           
static void update()
           
static String version()
          return the version of the library.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stream

public static Streaming stream

spark

public static Spark spark

text

public static Text text

VERSION

public static final String VERSION
See Also:
Constant Field Values

side

public static int side

size

public static int size

scale

public static int scale

xAngle

public static double xAngle

yAngle

public static double yAngle

pose

public boolean pose

cube

public static int[][][] cube

center

public static PVector center

manualUpdate

public static boolean manualUpdate
Constructor Detail

L3D

public L3D(PApplet _parent)
This is the simplest constructor for the cube -- it's only used for local simulation of the cube In order to stream data to the cube, call the other constructor, L3D(this, "yourSparkAccessToken)


L3D

public L3D(PApplet _parent,
           int _side)

L3D

public L3D(PApplet _parent,
           String accessToken)
This constructor sets up the computer to stream the data it's displaying to a cube on your local network.

Parameters:
accessToken - -- the access token for your spark account. The library uses this to find which of your cores are available, and to get the local IP Address of each of your online cores so that it can stream data to those cores

L3D

public L3D(PApplet _parent,
           String username,
           String password,
           int _size)
This constructor uses your spark/cubetube username and password to get an existing access token from your account, and then streams to your core named

Parameters:
username -
password -
size -

L3D

public L3D(PApplet _parent,
           String username,
           String password,
           String coreName)
This constructor uses your spark/cubetube username and password to get an existing access token from your account, and then streams to your core named

Parameters:
username -
password -

L3D

public L3D(PApplet _parent,
           String accessToken,
           String name)
This constructor sets up the computer to stream the data it's displaying to a cube on your local network.

Parameters:
accessToken - -- the access token for your spark account. The library uses this to find which of your cores are available, and to get the local IP Address of each of your online cores so that it can stream data to those cores
Method Detail

enableMulticastStreaming

public static void enableMulticastStreaming()

enableMulticastStreaming

public static void enableMulticastStreaming(int port)

streamToCore

public static void streamToCore(String name)

streamToCore

public static void streamToCore(int port,
                                String name)

setManualStreaming

public static void setManualStreaming()

setAutomaticStreaming

public static void setAutomaticStreaming()

draw

public void draw()

update

public static void update()

setVoxel

public static void setVoxel(int x,
                            int y,
                            int z,
                            int col)

setVoxel

public static void setVoxel(double x,
                            double y,
                            double z,
                            int col)

setVoxel

public static void setVoxel(int x,
                            int y,
                            int z,
                            int r,
                            int g,
                            int b)

setVoxel

public static void setVoxel(PVector p,
                            int col)

setVoxel

public static void setVoxel(PVector p,
                            int r,
                            int g,
                            int b)

addVoxel

public static void addVoxel(double x,
                            double y,
                            double z,
                            int col)

scrollText

public void scrollText(String message,
                       PVector initialPosition,
                       int col)
This will a text message across the zPlane of the initialPosition message.

Parameters:
message - -- the text string to scroll
initialPosition - -- a PVector with the position of the first character in the string. The function will draw the rest of the string relative to this point
col - -- the color of the text
+Example
import L3D.*;

L3D cube;

float pos=0;
float posInc=.1;
int mode=0;
String message=" ";
void setup()
{
  size(500, 500, P3D);
  cube=new L3D(this);
//  cube=new L3D(this, "your@spark.email", "your password", "cube name");
}

void draw()
{
  background(0);
  cube.background(0);
  switch(mode) {

    case(0):    
    cube.text.showChar('L', new PVector(3.5, 0, 3.5), new PVector(0, pos), cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(1):
    cube.text.showChar('3', new PVector(1, 3.5, 3.5), new PVector(0, 3.5), new PVector(pos, 0), cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(2):
    cube.text.showChar('D', new PVector(1.5, 0, 3.5), new PVector(0, 0), new PVector(0, -pos), cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(3):
    message="L3D cube!";
    cube.marquis(message, pos, cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(4):
    message="cubism";
    cube.scrollText(message, new PVector(pos, 0, 4), cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(5):
    message="1^3";
    cube.scrollSpinningText(message, new PVector(pos, 0, 3), cube.colorMap(frameCount%1000, 0, 1000));
    break;
  }

  pos+=posInc;
  if (pos>(message.length()+1)*8)
  {
    pos=0;
    mode++;
    if(mode>5)
      mode=0;
  }
}


scrollSpinningText

public void scrollSpinningText(String message,
                               PVector initialPosition,
                               int col)
This will a text message across the zPlane of the initialPosition message, with the letters rotating along their y axes For more elaborate letter rotations, check out the Text.showChar function

Parameters:
message - -- the text string to scroll
initialPosition - -- a PVector with the position of the first character in the string. The function will draw the rest of the string relative to this point
col - -- the color of the text
+Example
import L3D.*;

L3D cube;

float pos=0;
float posInc=.1;
int mode=0;
String message=" ";
void setup()
{
  size(500, 500, P3D);
  cube=new L3D(this);
//  cube=new L3D(this, "your@spark.email", "your password", "cube name");
}

void draw()
{
  background(0);
  cube.background(0);
  switch(mode) {

    case(0):    
    cube.text.showChar('L', new PVector(3.5, 0, 3.5), new PVector(0, pos), cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(1):
    cube.text.showChar('3', new PVector(1, 3.5, 3.5), new PVector(0, 3.5), new PVector(pos, 0), cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(2):
    cube.text.showChar('D', new PVector(1.5, 0, 3.5), new PVector(0, 0), new PVector(0, -pos), cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(3):
    message="L3D cube!";
    cube.marquis(message, pos, cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(4):
    message="cubism";
    cube.scrollText(message, new PVector(pos, 0, 4), cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(5):
    message="1^3";
    cube.scrollSpinningText(message, new PVector(pos, 0, 3), cube.colorMap(frameCount%1000, 0, 1000));
    break;
  }

  pos+=posInc;
  if (pos>(message.length()+1)*8)
  {
    pos=0;
    mode++;
    if(mode>5)
      mode=0;
  }
}


marquis

public void marquis(String message,
                    float initialPosition,
                    int col)
Marches a text marquis across the sides and front of the cube

Parameters:
message - -- the text string to scroll
initialPosition - -- a float indicating how far the message is (in voxels) from the back right corner of the tube. The rest of the message will be drawn relative to this position
col - -- the color of the text
+Example
import L3D.*;

L3D cube;

float pos=0;
float posInc=.1;
int mode=0;
String message=" ";
void setup()
{
  size(500, 500, P3D);
  cube=new L3D(this);
//  cube=new L3D(this, "your@spark.email", "your password", "cube name");
}

void draw()
{
  background(0);
  cube.background(0);
  switch(mode) {

    case(0):    
    cube.text.showChar('L', new PVector(3.5, 0, 3.5), new PVector(0, pos), cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(1):
    cube.text.showChar('3', new PVector(1, 3.5, 3.5), new PVector(0, 3.5), new PVector(pos, 0), cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(2):
    cube.text.showChar('D', new PVector(1.5, 0, 3.5), new PVector(0, 0), new PVector(0, -pos), cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(3):
    message="L3D cube!";
    cube.marquis(message, pos, cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(4):
    message="cubism";
    cube.scrollText(message, new PVector(pos, 0, 4), cube.colorMap(frameCount%1000, 0, 1000));
    break;  
    case(5):
    message="1^3";
    cube.scrollSpinningText(message, new PVector(pos, 0, 3), cube.colorMap(frameCount%1000, 0, 1000));
    break;
  }

  pos+=posInc;
  if (pos>(message.length()+1)*8)
  {
    pos=0;
    mode++;
    if(mode>5)
      mode=0;
  }
}


color

public static int color(int r,
                        int g,
                        int b)

enableDrawing

public void enableDrawing()

disableDrawing

public void disableDrawing()

saveFile

public void saveFile()

saveFile

public void saveFile(boolean binaryFormat)

loadFile

public void loadFile(File file)

line

public static void line(PVector p1,
                        PVector p2,
                        int col)

sphere

public static void sphere(PVector center,
                          float radius,
                          int col)

background

public static void background(int col)

getVoxel

public static int getVoxel(PVector p)

getVoxel

public static int getVoxel(int x,
                           int y,
                           int z)

enablePoseCube

public void enablePoseCube()

disablePoseCube

public void disablePoseCube()

poseCube

public void poseCube()

mouseEvent

public void mouseEvent(MouseEvent event)

colorMap

public static int colorMap(float val,
                           float min,
                           float max)

version

public static String version()
return the version of the library.

Returns:
String


Processing library L3D by Alex Hornstein. (c) 2015