Something is up with my attempt at rendering this sketch as a PDF. In the PDF render the ellipses are misaligned. The drawing outputs perfectly to the screen. Any help would be appreciated (trying to output for printing).
On screen render:
PDF render:
import processing.pdf.*;
boolean record = true;
PGraphics pdf;
int d = 300;
int r = 300;
float z = random(1, 5);
float rand;
int stepX = 15;
int stepY = 15;
color[] palette = {
#556270, #4ECDC4, #C7F464, #FF6B6B, #C44D58
};
void setup(){
//background (palette[(int)random(1, 5)]);
size(960, 645);
ellipseMode(CORNER);
smooth();
pdf = (PGraphics) createGraphics((width), (height), PDF, "frame.pdf");
noLoop();
}
void draw(){
if(record){
beginRecord(pdf);
println("Recording started.");
record = true;
}
float n = noise(d)*d;
noiseSeed(0);
noStroke();
background (#556270);
for (int y = stepY; y < height +d; y += d + stepY){
So, my project is to take GPS points I've mapped out and turn them into a digital sculpture (either 3D printed or CNC machined, or both). At this point I've cobbled together some code to make a Voronoi mesh based on the GPS points, but I'd like to be able to add the elevation data to make it 3D. I've taken the code from another post here on how to add Terrain values to a mesh, but I'm getting an error that says "the elevation array doesn't match the Terrain". Am I headed down the right road here? I.E. what is the best way to add height/elevation to a mesh (preferably using Toxi as that's what I've slogged through over the last week, though it seems like HE-Mesh would work).
Here is the code so far:
import processing.dxf.*;
import toxi.processing.*;
import toxi.geom.*;
import toxi.geom.Vec3D;
import toxi.geom.Vec2D;
import toxi.geom.mesh.*;
import toxi.util.*;
import toxi.util.datatypes.*;
import toxi.geom.mesh2d.*;
import processing.pdf.*;
import processing.dxf.*;
import processing.opengl.*;
import tomc.gpx.*;
// declare a GPX object
GPX gpx;
// various recording objects
boolean record;
boolean pdfrecord;
PGraphicsPDF pdf;
// variables
float x, y;
int z;
int rad;
// toxi
Voronoi voronoi;
ToxiclibsSupport gfx;
TriangleMesh mesh;
// optional polygon clipper
PolygonClipper2D clip;
float xpos[] = new float[9799];
float ypos[] = new float[9799];
float zpos[] = new float[9799];
void setup(){
size(700, 600, P3D);
// smooth();
//initialise the GPX object
gpx = new GPX(this);
// parse test.gpx from the sketch data folder
gpx.parse("MasterTest02.gpx"); // or a URL
//pdf Object
pdf = (PGraphicsPDF) createGraphics((width), (height), PDF, "line.pdf");
So, my question is would using the GPS data to the points as part of a mesh feasible? Would the same concepts apply as in the above tutorial i.e. make a grid and place the points within that grid? I've mapped out the data successfully in 2D space using toxiclibs, so I feel the move to 3D should be possible.