]> granicus.if.org Git - graphviz/commitdiff
*** empty log message ***
authorarif <devnull@localhost>
Tue, 8 Apr 2008 17:36:37 +0000 (17:36 +0000)
committerarif <devnull@localhost>
Tue, 8 Apr 2008 17:36:37 +0000 (17:36 +0000)
cmd/smyrna/draw.c
cmd/smyrna/gltemplate.c
cmd/smyrna/topview.c
cmd/smyrna/topview.h

index bfc6800bc0fff58d600c17743c20ae846d7ff342..8a01b18dc2bdafd9e7c747ee0955e14240189b12 100755 (executable)
@@ -586,10 +586,16 @@ void draw_fisheye_magnifier(ViewInfo * view)
                     &mg_y, &mg_z);
        glColor4f((GLfloat) 0.3, (GLfloat) 0.1, (GLfloat) 0.8,
                  (GLfloat) 1);
-       if ((view->fmg.x != mg_x) || (view->fmg.y != mg_y)) {
-           fisheye_polar(mg_x, mg_y, view->Topview);
+       if (((view->fmg.x != mg_x) || (view->fmg.y != mg_y))&&(view->active_camera==-1)) {
+               fisheye_polar(mg_x, mg_y, view->Topview);
            draw_circle(mg_x, mg_y, a);
        }
+       if (((view->fmg.x != mg_x) || (view->fmg.y != mg_y))&&(view->active_camera>-1)) {
+               fisheye_spherical(mg_x, mg_y,0.00,view->Topview);
+           draw_circle(mg_x, mg_y, a);
+       }
+
+
        view->fmg.x = mg_x;
        view->fmg.y = mg_y;
 
index e4f9b6516073391e58b9de71a5a82004db7cf8fa..35f014628a763f2e86aab03968c1975ea59420ad 100755 (executable)
@@ -379,11 +379,25 @@ static gboolean motion_notify_event(GtkWidget * widget,
     if ((event->state & GDK_BUTTON1_MASK)
        && (view->mouse.mouse_mode == MM_ZOOM)) {
        float x;
-       view->zoom = view->zoom + dx / 10 * (view->zoom * -1 / 20);
-       if (view->zoom > MAX_ZOOM)
-           view->zoom = (float) MAX_ZOOM;
-       if (view->zoom < MIN_ZOOM)
-           view->zoom = (float) MIN_ZOOM;
+       float real_zoom;
+       if(view->active_camera==-1)
+               real_zoom=view->zoom + dx / 10 * (view->zoom * -1 / 20);
+       else
+               real_zoom=(view->cameras[view->active_camera]->r + dx / 10 * (view->cameras[view->active_camera]->r  / 20))*-1;
+
+       if (real_zoom > MAX_ZOOM)
+               real_zoom = (float) MAX_ZOOM;
+       if (real_zoom < MIN_ZOOM)
+           real_zoom = (float) MIN_ZOOM;
+
+       if(view->active_camera==-1)
+               view->zoom = real_zoom;
+       else{
+               view->cameras[view->active_camera]->r=real_zoom*-1;
+               set_camera_x_y(view->cameras[view->active_camera]);
+       }
+
+
        /*set label to new zoom value */
        x = ((float) 100.0 - (float) 1.0) * (view->zoom -
                                             (float) MIN_ZOOM) /
index 4ef9f723053ba4f38dfefe537edcbed6cca62b7e..fca688a6fe4d85bd8b0275791759287a04bcb4e4 100755 (executable)
@@ -307,17 +307,21 @@ void drawTopViewGraph(Agraph_t * g)
            {
                ddx = dx;
                ddy = dy;
+               ddz=0;
            } else {
                ddx = 0;
                ddy = 0;
+               ddz=0;
            }
            if (((custom_object_data *) AGDATA(e->Node2->Node))->Selected == 1) //head
            {
                dddx = dx;
                dddy = dy;
+               dddz=0;
            } else {
                dddx = 0;
                dddy = 0;
+               dddz=0;
            }
 
            if (get_color_from_edge(e)) {
@@ -807,6 +811,12 @@ static double dist(double x1, double y1, double x2, double y2)
 {
     return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
 }
+static double dist3d(double x1, double y1,double z1, double x2, double y2,double z2)
+{
+    return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)+(z1 - z2) * (z1 - z2));
+}
+
+
 static double G(double x)
 {
     // distortion function for fisheye display
@@ -858,6 +868,62 @@ void fisheye_polar(double x_focus, double y_focus, topview * t)
        }
     }
 }
+void fisheye_spherical(double x_focus, double y_focus,double z_focus, topview * t)
+{
+    int i;
+    double distance, distorted_distance, ratio, range;
+
+    range = 0;
+    for (i = 1; i < t->Nodecount; i++) {
+       if (    point_within_sphere_with_coords((float) x_focus, (float) y_focus, (float)z_focus, (float) view->fmg.R
+                                                               ,t->Nodes[i].x, t->Nodes[i].y,t->Nodes[i].z))
+       {
+               
+               
+           range =
+               MAX(range,
+                   dist3d(t->Nodes[i].x, t->Nodes[i].y,t->Nodes[i].z, x_focus, y_focus,z_focus));
+       }
+    }
+
+    for (i = 1; i < t->Nodecount; i++) {
+
+
+       if (
+                       point_within_sphere_with_coords((float) x_focus, (float) y_focus, (float)z_focus, (float) view->fmg.R
+                                                               ,t->Nodes[i].x, t->Nodes[i].y,t->Nodes[i].z))
+       {
+           distance =
+               dist3d(t->Nodes[i].x, t->Nodes[i].y,t->Nodes[i].z, x_focus, y_focus,z_focus);
+           distorted_distance = G(distance / range) * range;
+           if (distance != 0) {
+               ratio = distorted_distance / distance;
+           } else {
+               ratio = 0;
+           }
+           t->Nodes[i].distorted_x =
+               (float) x_focus + (t->Nodes[i].x -
+                                  (float) x_focus) * (float) ratio;
+           t->Nodes[i].distorted_y =
+               (float) y_focus + (t->Nodes[i].y -
+                                  (float) y_focus) * (float) ratio;
+           t->Nodes[i].distorted_z =
+               (float) z_focus + (t->Nodes[i].z -
+                                  (float) z_focus) * (float) ratio;
+           t->Nodes[i].zoom_factor =
+               (float) 1 *(float) distorted_distance / (float) distance;
+       } else {
+           t->Nodes[i].distorted_x = t->Nodes[i].x;
+           t->Nodes[i].distorted_y = t->Nodes[i].y;
+           t->Nodes[i].distorted_z = t->Nodes[i].z;
+           t->Nodes[i].zoom_factor = 1;
+       }
+    }
+}
+
+
+
+
 void originate_distorded_coordinates(topview * t)
 {
     //sets original coordinates values to distorded coords. this happens when lieft mouse click is released in geometrical fisyehey mode
index ee0fe05afd88a7820ac8b6b3d5743e72a34b3eed..03f35c1a3e9df17c2e5b253658cbcdc78a30edd7 100755 (executable)
@@ -46,6 +46,7 @@ _BB void on_host_alpha_change(GtkWidget * widget, gpointer user_data);
 /* double G(double x); */
 glCompSet *glcreate_gl_topview_menu();
 void fisheye_polar(double x_focus, double y_focus, topview * t);
+void fisheye_spherical(double x_focus, double y_focus,double z_focus, topview * t);
 void prepare_topological_fisheye(topview * t);