private void precomputeSlope ( ) { float invDirX = 1.0f / dirX ; float invDirY = 1.0f / dirY ; float invDirZ = 1.0f / dirZ ; s_yx = dirX * invDirY ; s_xy = dirY * invDirX ; s_zy = dirY * invDirZ ; s_yz = dirZ * invDirY ; s_xz = dirZ * invDirX ; s_zx = dirX * invDirZ ; c_xy = originY - s_xy * originX ; c_yx = originX - s_yx * originY ; c_zy = originY - s_zy * originZ ; c_yz = originZ - s_yz * originY ; c_xz = originZ - s_xz * originX ; // <- original paper had a bug here. It switched originZ/originX c_zx = originX - s_zx * originZ ; // <- original paper had a bug here. It switched originZ/originX int sgnX = signum ( dirX ) ; int sgnY = signum ( dirY ) ; int sgnZ = signum ( dirZ ) ; classification = ( byte ) ( ( sgnZ + 1 ) << 4 | ( sgnY + 1 ) << 2 | ( sgnX + 1 ) ) ; }
Precompute the values necessary for the ray slope algorithm .