#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# 3d plot

edited December 2015 in Arduino

Hello Guys, i am trying to make a processing app which will give me 3d plot circular for the value i get from serial port. The x,y,z values are received from serial port and in plot in 3d area in circular shape. similar to this video:- request help for the same

Tagged:

Just use a 3d renderer in your size () call and then you can use point () to draw 3d points. You might need to scale all three axes but that's fine.

I'd also recommend peasycam library which will let you rotate and zoom using the mouse.

• Thanks koogs for the help, I'll try to develop the code.

• ``````import peasy.*;

PeasyCam cam;

float angle;
PVector [] ellOuter = new PVector [ 40 ];
PShape floor;

void setup() {
size( 800, 800, OPENGL );
background(0);

defineFloor(); // (optional)

cam = new PeasyCam(this, 500);
// cam.setMinimumDistance(50);
// cam.setMaximumDistance(500);

int count = 0;
for (int i=0; i<360; i+=10) {
float x = 50+244 + 133*sin(radians(i));
float y = 20+44 + 133*cos(radians(i));

ellOuter[ count ] = new PVector();
ellOuter[ count ].x = x;
ellOuter[ count ].y = y;
ellOuter[ count ].z = -50.0;
count++;
} //
//
} // setup

void draw()
{
background(0);

// Floor (optional)
shape (floor, 0, 0);

// show the array with the data
stroke(225);
strokeWeight(4);
for (int i=0; i<ellOuter.length-4; i+=1) {
point ( ellOuter[i].x, ellOuter[i].y, ellOuter[i].z );
}

// help text
cam.beginHUD();
fill(255);
text("use mouse", 22, 22);
cam.endHUD();

angle+=.01;
} // draw

void defineFloor() {
//  floor

floor = createShape();
floor.beginShape();
float floorY=300;

floor.stroke(255);
floor.fill(255, 2, 2, 10);

// to the right (in the background)
floor.vertex ( 20, floorY, -300);
floor.vertex ( width-20, floorY, -300);
// right side
floor.vertex ( width-20, floorY, -300);
floor.vertex ( width-20, floorY, -0);

// to right (in the front)
floor.vertex ( width-20, floorY, -0);
floor.vertex ( 20, floorY, -0);

// left side
floor.vertex ( 20, floorY, -0);
floor.vertex ( 20, floorY, -300);

floor.endShape();
}
//
``````
• this shows the usage of peasycam - you have to download the library

ellOuter holds the 3D data