this snippet code taken form Hermite3d  what are

 p0,p1,p2,p3 and

how to calculate tangent vector

and pRight,pLeft,sRight and pLeft used for.

 

void render(boolean tFill, short colix, int tension,int diameterBeg, int diameterMid, int diameterEnd,Point3i p0, Point3i p1, Point3i p2, Point3i p3) {

int x1 = p1.x, y1 = p1.y, z1 = p1.z;

int x2 = p2.x, y2 = p2.y, z2 = p2.z;

int xT1 = ((x2 - p0.x) * tension) / 8;

int yT1 = ((y2 - p0.y) * tension) / 8;

int zT1 = ((z2 - p0.z) * tension) / 8;

int xT2 = ((p3.x - x1) * tension) / 8;

int yT2 = ((p3.y - y1) * tension) / 8;

int zT2 = ((p3.z - z1) * tension) / 8;

sLeft[0] = 0;

pLeft[0].set(p1);

sRight[0] = 1;

pRight[0].set(p2);

sp = 0;

int dDiameterFirstHalf = 0;

int dDiameterSecondHalf = 0;

if (tFill) {

dDiameterFirstHalf = 2 * (diameterMid - diameterBeg);

dDiameterSecondHalf = 2 * (diameterEnd - diameterMid);

} else {

g3d.setColix(colix);

}

do {

Point3i a = pLeft[sp];

Point3i b = pRight[sp];

int dx = b.x - a.x;

if (dx >= -1 && dx <= 1) {

int dy = b.y - a.y;

if (dy >= -1 && dy <= 1) {

// mth 2003 10 13

// I tried drawing short cylinder segments here,

// but drawing spheres was faster

float s = sLeft[sp];

if (tFill) {

int d =(s < 0.5f

? diameterBeg + (int)(dDiameterFirstHalf * s)

: diameterMid + (int)(dDiameterSecondHalf * (s - 0.5f)));

g3d.fillSphereCentered(colix, d, a);

} else {

g3d.plotPixelClipped(a);

}

--sp;

continue;

}

------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ Jmol-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to