Yes, after a while I finally figured it out. So now my app will accept either DIS orientation info (phi, psi, and theta) or the more common roll, pitch, and yaw. Either way it will render it correctly.

Code:

protected void draw(DrawContext dc, WWModel3D model) {
GL gl = dc.getGL();
Position pos = model.getPosition();
Vec4 loc = dc.getGlobe().computePointFromPosition(pos);
double computedSize = this.computeSize(dc, loc);
if (dc.getView().getFrustumInModelCoordinates().contains(loc)) {
dc.getView().pushReferenceCenter(dc, loc);
if (model.isDisDataUsed()){ // uses DIS coordinates
gl.glRotated(model.getPsi() , 0, 1, 0); // psi is around z-axis (north pole) in DIS (Yaw)
gl.glRotated(model.getTheta(), 1, 0, 0); // theta is around the y-axis in DIS (Pitch)
gl.glRotated(model.getPhi() , 0, 0, 1); // phi is around the x-axis in DIS (Roll)
} else { // uses normal WW/OpenGL data coordinates--model's x-axis is front, its y-axis is right, and its z-axis is down
gl.glRotated(pos.getLongitude().degrees, 0, 1, 0); // orient model with respect to world longitude
gl.glRotated(-pos.getLatitude().degrees, 1, 0, 0); // orient model with respect to world latitude
double roll = model.getRoll();
double pitch = model.getPitch();
double yaw = model.getOrientation();
double cosPitch = Math.cos(Math.toRadians(pitch));
double sinPitch = Math.sin(Math.toRadians(pitch));
double cosRoll = Math.cos(Math.toRadians(roll));
double sinRoll = Math.sin(Math.toRadians(roll));
// 1st rotate pitch (around the x-axis)
gl.glRotated(pitch, 1, 0, 0); // x-axis vector = [1 0 0]
// y' axis vector is now [ 0 cos(pitch) -sin(pitch) ]
// z' axis vector is now [ 0 sin(pitch) cos(pitch) ]
// note: to pitch in the other direction, switch the - on the two "sin(pitch)" factors
// 2nd rotate roll around the y' axis
gl.glRotated(roll, 0, cosPitch, -sinPitch);
// z" axis vector is now [ -sin(roll) sin(pitch)*cos(roll) cos(pitch)*cos(roll) ]
// 3rd rotate yaw around z" axis
gl.glRotated(-yaw, -sinRoll, sinPitch*cosRoll, cosPitch*cosRoll);
// Last step: Orient 3D model to correct coordinate system
gl.glRotated(-90, 1, 0, 0);
}
gl.glScaled(computedSize, computedSize, computedSize);
gl.glCallList(Model3DisplayListFactory.getModel(gl, model.getPath(), model.getLightingEnabled()));
dc.getView().popReferenceCenter(dc);
}
}

## Bookmarks