Ignore:
Timestamp:
Nov 25, 2008, 9:56:29 AM (16 years ago)
Author:
gah
Message:
 
Location:
trunk/packages/vizservers/nanovis
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/Command.cpp

    r1229 r1236  
    732732        return TCL_ERROR;
    733733    }
    734     /* Convert to normalized coordinates */
    735     x = x / (float)NanoVis::win_width;
    736     y = y / (float)NanoVis::win_height;
    737     /* Move the camera and its target by equal amounts along the x and y
    738      * axes. */
    739     NanoVis::cam->x(NanoVis::cam->x() + x);
    740     NanoVis::cam->y(NanoVis::cam->y() + y);
    741     fprintf(stderr, "dx=%f, dy=%f\n", x, y);
    742     fprintf(stderr, "set eye to %f %f\n", NanoVis::cam->x(), NanoVis::cam->y());
    743     Vector3 target;
    744     target = NanoVis::cam->aim();
    745     x += target.x;
    746     y += target.y;
    747     NanoVis::cam->aim(x, y, target.z);
    748     fprintf(stderr, "set aim to %f %f\n", x, y);
     734    NanoVis::pan(x, y);
    749735    return TCL_OK;
    750736}
  • trunk/packages/vizservers/nanovis/NvCamera.h

    r1215 r1236  
    4242
    4343    //move location of camera
    44     void x(double loc_x) {
     44    void x(float loc_x) {
    4545        location_.x = loc_x;
    4646    }
     
    4848        return location_.x;
    4949    }
    50     void y(double loc_y) {
     50    void y(float loc_y) {
    5151        location_.y = loc_y;
    5252    }
     
    5454        return location_.y;
    5555    }
    56     void z(double loc_z) {
     56    void z(float loc_z) {
    5757        location_.z = loc_z;
    5858    }
     
    6161    }
    6262
    63     void aim(double target_x, double target_y, double target_z) {
    64         target_ = Vector3(target_x, target_y, target_z);
     63    //move location of target
     64    void xAim(float x) {
     65        aim_.x = x;
    6566    }
    66     Vector3 aim(void) {
    67         return target_;
     67    float xAim(void) {
     68        return aim_.x;
    6869    }
    69     void rotate(double angle_x, double angle_y, double angle_z) {
     70    void yAim(float y) {
     71        aim_.y = y;
     72    }
     73    float yAim(void) {
     74        return aim_.y;
     75    }
     76    void zAim(float z) {
     77        aim_.z = z;
     78    }
     79    float zAim(void) {
     80        return aim_.z;
     81    }
     82
     83    void rotate(float angle_x, float angle_y, float angle_z) {
    7084        angle_ = Vector3(angle_x, angle_y, angle_z);
    7185    }
  • trunk/packages/vizservers/nanovis/nanovis.cpp

    r1219 r1236  
    442442    return result;
    443443}
     444
     445static void
     446NanoVis::pan(int dx, int dy)
     447{
     448    float x, y;
     449
     450    /* Normalize coordinates */
     451    x = (float)dx / (float)win_width;
     452    y = (float)dy / (float)win_height;
     453
     454    /* Move the camera and its target by equal amounts along the x and y
     455     * axes. */
     456    fprintf(stderr, "x=%f, y=%f\n", x, y);
     457   
     458    cam->x(cam->x() + x);
     459    cam->y(cam->y() + y);
     460    fprintf(stderr, "set eye to %f %f\n", cam->x(), cam->y());
     461
     462    cam->xAim(cam->xAim() + x);
     463    cam->yAim(cam->yAim() + y);
     464    fprintf(stderr, "set aim to %f %f\n", cam->xAim(), cam->yAim());
     465}
     466
    444467
    445468/* Load a 3D volume
Note: See TracChangeset for help on using the changeset viewer.