← Back to team overview

yade-users team mailing list archive

Re: New particle shape

 

boon chiaweng said:     (by the date of Thu, 19 Nov 2009 22:50:23 +0800)

> 
> I would like to have a new particle shape, namely an ellipsoid with an equation f(x,y,z) = (x^2/a^2) + (y^2/b^2) + (z^2/c^2) -1.  I am at the moment confused with OpenGL.  How can I do it? 

That's a squashed sphere right? So to draw it in OpenGL you need to
modify just one line after you copy/paste code from GLDrawSphere:

		glScalef(radius,radius,radius);

into:

		glScalef(radius1,radius2,radius3);

this opengl scaling is linearly scaling the drawn stuff (in this case
a sphere) in x,y,z directions. 

In fact a sphere with radius=1 is drawn but is scaled beforehand in
x,y,z directions by a factor of "radius" variable.


Make sure when your ellipsoids rotate, they will update their
orientation quaternion. And before drawing anything in OpenGL it is
rotated by this rotation. So in fact those radius1,2,3 will be sizes
of your ellipsoids in x,y,z directions in coordinate system local to
ellipsoid (not the global coordinate system).

-- 
Janek Kozicki                                                         |



Follow ups

References