@Override public void draw(DrawContext dc) { _ellipsoid.draw(0,0,0,0,0,1,0,1,0,1,0,0); } @Override
public void draw(DrawContext dc) { float cx = 0.0f, cy = 0.0f, cz = 0.0f; float ux = 0.0f, uy = 0.0f, uz = _thickness; float vx = 0.0f, vy = 1.0f, vz = 0.0f; float wx = 1.0f, wy = 0.0f, wz = 0.0f; _ellipsoid.draw(cx,cy,cz,ux,uy,uz,vx,vy,vz,wx,wy,wz); } public BoundingSphere computeBoundingSphere(boolean finite) {
/** * Draws a sphere centered at a specified point with specified radius. * @param cx x coordinate of the center point. * @param cy y coordinate of the center point. * @param cz z coordinate of the center point. * @param r radius of the sphere. */ public void draw(float cx, float cy, float cz, float r) { draw(cx,cy,cz,r,r,r); }
public void draw(DrawContext dc) { int ns = _cx.length; int nt = _cx[0].length; for (int is=0; is<ns; ++is) { for (int it=0; it<nt; ++it) { _ellipsoid.draw( _cx[is][it],_cy[is][it],_cz[is][it], _ux[is][it],_uy[is][it],_uz[is][it], _vx[is][it],_vy[is][it],_vz[is][it], _wx[is][it],_wy[is][it],_wz[is][it]); } } } public BoundingSphere computeBoundingSphere(boolean finite) {
public void draw(DrawContext dc) { float cx = 0.5f, cy = 0.5f, cz = 0.5f; float ux = 0.5f, uy = 0.0f, uz = 0.0f; float vx = 0.0f, vy = 0.1f, vz = 0.0f; float wx = 0.0f, wy = 0.0f, wz = 0.5f; _ellipsoid.draw(-cx, cy,-cz,ux,uy,uz,vx,vy,vz,wx,wy,wz); _ellipsoid.draw( cx, cy,-cz,ux,uy,uz,vx,vy,vz,wx,wy,wz); _ellipsoid.draw(-cx,-cy,-cz,ux,uy,uz,vx,vy,vz,wx,wy,wz); _ellipsoid.draw( cx,-cy,-cz,ux,uy,uz,vx,vy,vz,wx,wy,wz); _ellipsoid.draw(-cx, cy, cz,ux,uy,uz,vx,vy,vz,wx,wy,wz); _ellipsoid.draw( cx, cy, cz,ux,uy,uz,vx,vy,vz,wx,wy,wz); _ellipsoid.draw(-cx,-cy, cz,ux,uy,uz,vx,vy,vz,wx,wy,wz); _ellipsoid.draw( cx,-cy, cz,ux,uy,uz,vx,vy,vz,wx,wy,wz); } public BoundingSphere computeBoundingSphere(boolean finite) {
/** * Draws an axis-aligned ellipsoid centered at a specified point. * The lengths of the specified semi-principal axes must be positive. * @param cx x coordinate of the center point. * @param cy y coordinate of the center point. * @param cz z coordinate of the center point. * @param dx semi-principal length in direction of x axis. * @param dy semi-principal length in direction of y axis. * @param dz semi-principal length in direction of z axis. */ public void draw( float cx, float cy, float cz, float dx, float dy, float dz) { glPushMatrix(); glTranslatef(cx,cy,cz); glScalef(dx,dy,dz); draw(); glPopMatrix(); }
draw(); glPopMatrix();
vx *= sv*dx; vy *= sv*dy; vz *= sv*dz; wx *= sw*dx; wy *= sw*dy; wz *= sw*dz; _eg.draw(xc,yc,zc,ux,uy,uz,vx,vy,vz,wx,wy,wz); vx *= sv*dx; vy *= sv*dy; vz *= sv*dz; wx *= sw*dx; wy *= sw*dy; wz *= sw*dz; _eg.draw(xc,yc,zc,ux,uy,uz,vx,vy,vz,wx,wy,wz); vx *= sv*dx; vy *= sv*dy; vz *= sv*dz; wx *= sw*dx; wy *= sw*dy; wz *= sw*dz; _eg.draw(xc,yc,zc,ux,uy,uz,vx,vy,vz,wx,wy,wz);