Quick question, as I am not sure this is doable. I am new to processing as a sidenote..
I have taken an image into processing, and as all the examples on pixels show, exploded it based on the image pixels saturation or hue or brightness.
I can export those exploded mesh faces and get them into rhino no problem with a set color using muehlseife library which outputs a .mtl file and an obj. However, the whole object is one color, what I want is that each rectangle from the exploded image maintains its color.
I am using the geo.setMaterial ("string", int,int,int,int) so basically the material name and RGBA values. I thought I could use color c = img.pixels[loc] since later on in the code I fill(c) which is reading the color from the pixels. So I tried ("name", int(c), int(c), int(c), int(c)) But no luck. Anyone ever tried to export the pixel color data before? My code, which is probably sloppy is below...Any help would be great!
import peasy.*;
PeasyCam cam;
import muehlseife.*;
String outputFolder;
PImage img; // The source image
int cellsize = 6; // Dimensions of each cell in the grid
int cols, rows; // Number of columns and rows in our system
public void setup(){
size(800,764,P3D);
cam = new PeasyCam(this, width/2, height/2, 100, 100);
img = loadImage("All Surface Invert full screen_small.jpg"); // Load the image
cols = width/cellsize; // Calculate # of columns
rows = height/cellsize; // Calculate # of rows
smooth();
background (0);
}
public void draw (){
GeometryExporter geo = new GeometryExporter(this);
//start the recording
beginRaw(geo);
loadPixels();
// Begin loop for columns
for ( int i = 0; i < cols;i++) {
// Begin loop for rows
for ( int j = 0; j < rows;j++) {
int x = i*cellsize + cellsize/2; // x position
int y = j*cellsize + cellsize/2; // y position
int loc = x + y*width; // Pixel array location
color c = img.pixels[loc]; // Grab the color
// Calculate a z position as a function of mouseX and pixel brightness
float z = (mouseY/(float)width) * brightness(img.pixels[loc]) - 500.0;
// Translate to the location, set fill and stroke, and draw the rect
Very new to processing. There is a similar discussion about 2 years back about this topic, but no conclusions were drawn on the thread, just recommendations. I am using the Igeo library because I am working between rhino and processing. What I would like to do is generate a random series of points around a curve within a certain distance from that curve. So far I have drawn all the points as well as a curve based on those points, but I can't figure out how to generate a random series of points along the curve. Below is what I have. Any help would be great, I am exhausted from trying to figure this out. Thanks!