Pdf export - disjoined paths/curves/polygons
in
Core Library Questions
•
1 year ago
Hi i have this big problem for which i cant find any answer.
When i make shapes and then export them to pdf, they are not connected. In illustrator they seem to be just many lines and i need them to be connected.
In my program i generate z-cordinate values for my vertexes. And then make series of vertical lines which differ only in their z coordinate. I thought that when i put my loop (i dont know i can do that) between beginShape(); endShape(); that shape should be connected. But its not.
I believe the problem is in the fact that i make pdf from 3D.
Code is crazy im not great programmer sorry for that.
- import processing.pdf.*;
- import processing.opengl.*;
- int d=50; // horizontal space between vertexes
- float[][] val ;
- float xSize,ySize,xxSize,yySize ;
- float increment = 0.05; // affecting noisemap size
- float zoff = 0.0;
- float zincrement = 0.005; // affecting noisemap size
- boolean record;
- float noize = 0.6;
- float rozmezi = 25; // vertical space between lines
- void setup(){
- size(1220, 780, OPENGL);
- xSize = 30; // number of horizontal points
- ySize = 15; // number of vertical line
- xxSize = xSize;
- yySize = ySize;
- val = new float[int(xSize)][int(ySize)];
- }
- void draw(){
- if (record) {
- beginRaw(PDF, "output.pdf");
- }
- background(255);
- noStroke();
- translate(100,70, -1200);
- noiseSeed(1);
- float xoff = 0.0; // Start xoff at 0
- noiseDetail(30, noize);
- // For every x,y coordinate in a 2D space, calculate a noise value and produce a brightness value
- for (int x = 0; x < xxSize; x++) {
- xoff += increment; // Increment xoff
- float yoff = 0.0; // For every xoff, start yoff at 0
- for (int y = 0; y < yySize; y++) {
- yoff += increment; // Increment yoff
- float z = noise(xoff,yoff,zoff)*900;
- val[x][y] = z;
- }
- }
- stroke(0);
- noFill();
- //this is where i have a problem
- for(int y=0; y<ySize-1; y = y + 1){
- beginShape();
- for (int x=0; x<xSize-1; x = x + 1){
- vertex(x*d, y*rozmezi, val[x][y]);
- }
- endShape();
- }
- zoff += zincrement; // Increment zoff
- if (record) {
- endRaw();
- record = false;
- }
- }
- //controls
- void keyPressed() {
- if (key == CODED) {
- if (keyCode == UP) {
- noize = noize + 0.02;
- } else if (keyCode == DOWN) {
- noize = noize - 0.02;
- }
- else if (keyCode == LEFT) {
- camera(mouseX*1.5, mouseY*2.5, (height/2.0) / tan(PI*60.0 / 360.0),
- width/2.0, height/2.0, 0, // centerX, centerY, centerZ
- 0.0, 1.0, 0.0); // upX, upY, upZ
- rotateX(70);
- }
- else if (keyCode == RIGHT) {
- record = true;
- }
- }
- }
Like i said everything wokrs for me but i cant to find a way how to export merged lines and not many disconnected point to point lines.
I cannot find any souliton, could somebody help me please? :) Thanks
1