示例#1
0
void
display()
{
	GLfloat  m[4][4];

	glClearColor(0.0, 0.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	/* get rotation matrix */
	build_rot_matrix(m);

	//set_orthoview_pass(width, height);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	gluLookAt(view_org[0], view_org[1], view_org[2],
		  view_tgt[0], view_tgt[1], view_tgt[2],
		  0, 1, 0);	/* Y up */

	glMultMatrixf(&(m[0][0]));

	glScalef(1.0 / scenesize, 1.0 / scenesize, 1.0 / scenesize);

	draw_node(curr);

	glutSwapBuffers();
}
static void rotate_ray_differentials(
    miState *state,
    miVector new_dir)
{
    /* Compute the old direction in camera space */
    miVector old_dir;
    mi_vector_to_camera(state, &old_dir, &state->dir);
    mi_vector_normalize(&old_dir);

    /* Normalize the new direction as well */
    mi_vector_normalize(&new_dir);

    /* Compute the transform matrix in camera space from 'old_dir' to 'new_dir' */
    miMatrix cs_rot_transform;
    build_rot_matrix(&old_dir, &new_dir, cs_rot_transform);

    /* Get pointers to the world-to-camera and camera-to-world transforms */
    miScalar *p_world_to_camera;
    mi_query(miQ_TRANS_WORLD_TO_CAMERA, state, 0, &p_world_to_camera);

    miScalar *p_camera_to_world;
    mi_query(miQ_TRANS_CAMERA_TO_WORLD, state, 0, &p_camera_to_world);

    /* Compute the complete transform matrix in world space   */
    /* (world-to-camera, then rotation, then camera-to-world) */
    miMatrix rot_transform;
    mi_matrix_prod(rot_transform, p_world_to_camera, cs_rot_transform);
    mi_matrix_prod(rot_transform, rot_transform, p_camera_to_world);

    /* Applies the computed transform to the ray differentials */
    mi_ray_differential_transform(state, rot_transform);
}
示例#3
0
static PJ_COORD helmert_reverse_4d (PJ_COORD point, PJ *P) {
    struct pj_opaque_helmert *Q = (struct pj_opaque_helmert *) P->opaque;

    /* We only need to rebuild the rotation matrix if the
     * observation time is different from the last call */
    double t_obs = (point.xyzt.t == HUGE_VAL) ? Q->t_epoch : point.xyzt.t;
    if (t_obs != Q->t_obs) {
        Q->t_obs = t_obs;
        update_parameters(P);
        build_rot_matrix(P);
    }

    point.lpz = helmert_reverse_3d (point.xyz, P);

    return point;
}