We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › lop sided sphere
Page Index Toggle Pages: 1
lop sided sphere (Read 1705 times)
lop sided sphere
Jun 8th, 2010, 2:13pm
 
Hi guys

I am trying to do a project that uses quite a few spheres, but when I create a few, some of their shapes go a bit wonky and they look squashed. It mainly happens when I use translate but once I do, every sphere I create is squashed.

here is the code for the sketch

void setup() {
size(600, 300, P3D);
}


void draw() {
 
 background(0);
 sphereDetail(60);
 strokeWeight(2);
 fill(200, 167, 43);
 translate(90, 70, 0);
 sphere(80);
 translate(170, 0, 0);
 sphere(80);
 translate(220, 0, 0);
 sphere(80);
}
 

(not actually part of my project, just a simple example of the problem Im running into)

Is this something to do with push and popMatrix?

thanks in advance, amazing programme!
Re: lop sided sphere
Reply #1 - Jun 8th, 2010, 2:24pm
 
its called perspective...
add  translate(0,0,-600); to the beginning of draw and you see what i mean,
Re: lop sided sphere
Reply #2 - Jun 8th, 2010, 2:29pm
 
you can change it by changing from perspective view to orthographic view. just add this line :
   ortho(-width/2, width/2, -height/2, height/2, -10, 10);


you can also change the field of view if you want to.
look at
http://processing.org/reference/ortho_.html
http://processing.org/reference/perspective_.html
and the corresponding examples
http://processing.org/learning/3d/orthovsperspective.html
http://processing.org/learning/3d/perspective.html
Re: lop sided sphere
Reply #3 - Jun 8th, 2010, 2:32pm
 
that works initially, but then when I create other spheres within that the shape gets messed up. I thought a sphere would be the same shape no matter how far away u look at it from.

Is there an easier way to have 4 equal size spheres beside each other in an 800x300 sketch?

thanks, sorry for the nube qs!

David
Re: lop sided sphere
Reply #4 - Jun 8th, 2010, 2:34pm
 
sorry i replied before i saw ur 2nd message, il give that a go cheers!
Re: lop sided sphere
Reply #5 - Jun 8th, 2010, 2:42pm
 
that ortho thing works perfectly cheers Cedric! Im using processing to communicate with Max MSP to get graphics to react to various elements of incoming sound, fun and addictive!

thanks again!

David
Page Index Toggle Pages: 1