Is there a way to make 3d spheres?
in
Programming Questions
•
5 months ago
How do we make our cirlces look 3d like this?
I tried making 3d spheres but all i have is this:
void setup()
{
size(900,700, P3D);
smooth();
//background(0, 0, 255);
//for( int i=120; i<=520; i+=100)
//{
// line(140, i, 600, i);
//line(i, 100, i, 560);
//}
//for( int i=220; i<560; i+=100)
//{
// line(i, 60, i, 620);
//}
}
{
size(900,700, P3D);
smooth();
//background(0, 0, 255);
//for( int i=120; i<=520; i+=100)
//{
// line(140, i, 600, i);
//line(i, 100, i, 560);
//}
//for( int i=220; i<560; i+=100)
//{
// line(i, 60, i, 620);
//}
}
void draw()
{
background(0, 0, 255);
for( int i=120; i<=520; i+=100)
{
line(140, i, 600, i);
//line(i, 100, i, 560);
}
for( int i=220; i<560; i+=100)
{
line(i, 60, i, 620);
}
{
background(0, 0, 255);
for( int i=120; i<=520; i+=100)
{
line(140, i, 600, i);
//line(i, 100, i, 560);
}
for( int i=220; i<560; i+=100)
{
line(i, 60, i, 620);
}
textSize(12);
//Columns
fill(255);
text("Points/Game", 190, 50);
text("Rebounds/Game", 280, 50);
text("Assists/Game", 390, 50);
text("Steals/Game", 490, 50);
//Lebron James Stats
fill(255,255,0);
text("Lebron James", 25, 125);
pushMatrix();
translate(220, 120);
sphere(26.5);
translate(100,0);
sphere(20.5);
translate(100,0);
sphere(31.5);
translate(100,0);
sphere(18.5);
popMatrix();
//ellipse(220, 120, 53, 53);
// ellipse(320, 120, 41, 41);
// ellipse(420, 120, 63, 63);
// ellipse(520, 120, 39, 39);
//Dwyane Wade Stats
fill(255,0,0);
text("Dwyane Wade", 25, 225);
pushMatrix();
translate(220, 220);
sphere(21);
translate(100,0);
sphere(13);
translate(100,0);
sphere(22);
translate(100,0);
sphere(21.5);
popMatrix();
//ellipse(220, 220, 42, 42);
// ellipse(320, 220, 26, 26);
//ellipse(420, 220, 44, 44);
//ellipse(520, 220, 43, 43);
//Chris Bosh Stats
fill(0,255,0);
text("Chris Bosh", 25, 325);
//ellipse(220, 320, 33, 33);
pushMatrix();
translate(220, 320);
sphere(16.5);
translate(100, 0);
sphere(17.5);
//ellipse(320, 320, 35, 35);
translate(100, 0);
sphere(7.5);
//ellipse(420, 320, 15, 15);
translate(100,0);
sphere(10.5);
popMatrix();
//ellipse(520, 320, 21, 21);
//Mario Chalmers Dots
fill(0,255,255);
text("Mario Chalmers", 25, 425);
pushMatrix();
translate(220, 420);
sphere(8.5);
translate(100, 0);
sphere(7.5);
translate(100,0);
sphere(15);
translate(100,0);
sphere(17.5);
//ellipse(220, 420, 17, 17);
//ellipse(320, 420, 15, 15);
//ellipse(420, 420, 30, 30);
//ellipse(520, 420, 35, 35);
popMatrix();
//Ray Allen Dots
fill(255,0,255);
text("Ray Allen", 25, 525);
pushMatrix();
translate(220, 520);
sphere(22);
translate(100,0);
sphere(15);
translate(100,0);
sphere(15);
translate(100, 0);
sphere(20);
popMatrix();
//ellipse(220, 520, 22, 22);
//ellipse(320, 520, 15, 15);
//ellipse(420, 520, 15, 15);
//ellipse(520, 520, 20, 20);
//Scaler
fill(255);
ellipse(720, 200, 200, 200);
text("100% Circle", 685, 200);
textSize(30);
text("Dot Chart", 25, 50);
}
//Columns
fill(255);
text("Points/Game", 190, 50);
text("Rebounds/Game", 280, 50);
text("Assists/Game", 390, 50);
text("Steals/Game", 490, 50);
//Lebron James Stats
fill(255,255,0);
text("Lebron James", 25, 125);
pushMatrix();
translate(220, 120);
sphere(26.5);
translate(100,0);
sphere(20.5);
translate(100,0);
sphere(31.5);
translate(100,0);
sphere(18.5);
popMatrix();
//ellipse(220, 120, 53, 53);
// ellipse(320, 120, 41, 41);
// ellipse(420, 120, 63, 63);
// ellipse(520, 120, 39, 39);
//Dwyane Wade Stats
fill(255,0,0);
text("Dwyane Wade", 25, 225);
pushMatrix();
translate(220, 220);
sphere(21);
translate(100,0);
sphere(13);
translate(100,0);
sphere(22);
translate(100,0);
sphere(21.5);
popMatrix();
//ellipse(220, 220, 42, 42);
// ellipse(320, 220, 26, 26);
//ellipse(420, 220, 44, 44);
//ellipse(520, 220, 43, 43);
//Chris Bosh Stats
fill(0,255,0);
text("Chris Bosh", 25, 325);
//ellipse(220, 320, 33, 33);
pushMatrix();
translate(220, 320);
sphere(16.5);
translate(100, 0);
sphere(17.5);
//ellipse(320, 320, 35, 35);
translate(100, 0);
sphere(7.5);
//ellipse(420, 320, 15, 15);
translate(100,0);
sphere(10.5);
popMatrix();
//ellipse(520, 320, 21, 21);
//Mario Chalmers Dots
fill(0,255,255);
text("Mario Chalmers", 25, 425);
pushMatrix();
translate(220, 420);
sphere(8.5);
translate(100, 0);
sphere(7.5);
translate(100,0);
sphere(15);
translate(100,0);
sphere(17.5);
//ellipse(220, 420, 17, 17);
//ellipse(320, 420, 15, 15);
//ellipse(420, 420, 30, 30);
//ellipse(520, 420, 35, 35);
popMatrix();
//Ray Allen Dots
fill(255,0,255);
text("Ray Allen", 25, 525);
pushMatrix();
translate(220, 520);
sphere(22);
translate(100,0);
sphere(15);
translate(100,0);
sphere(15);
translate(100, 0);
sphere(20);
popMatrix();
//ellipse(220, 520, 22, 22);
//ellipse(320, 520, 15, 15);
//ellipse(420, 520, 15, 15);
//ellipse(520, 520, 20, 20);
//Scaler
fill(255);
ellipse(720, 200, 200, 200);
text("100% Circle", 685, 200);
textSize(30);
text("Dot Chart", 25, 50);
}
1