]> granicus.if.org Git - graphviz/commitdiff
consolidate PI into M_PI
authorellson <devnull@localhost>
Mon, 3 Mar 2008 23:01:51 +0000 (23:01 +0000)
committerellson <devnull@localhost>
Mon, 3 Mar 2008 23:01:51 +0000 (23:01 +0000)
lib/circogen/blockpath.c
lib/circogen/circpos.c

index bcbc089aef2a8b466ac70cf1f0a27b84882dec1e..b8d52abf1003284957308f82ad52777ab964eff3 100644 (file)
@@ -646,7 +646,7 @@ nodelist_t *layout_block(Agraph_t * g, block_t * sn, double min_dist)
     if (N == 1)
        radius = 0;
     else
-       radius = (N * (min_dist + largest_node)) / (2 * PI);
+       radius = (N * (min_dist + largest_node)) / (2 * M_PI);
 
     for (item = longest_path->first; item; item = item->next) {
        n = item->curr;
@@ -662,7 +662,7 @@ nodelist_t *layout_block(Agraph_t * g, block_t * sn, double min_dist)
        n = item->curr;
        POSITION(n) = k;
        PSI(n) = 0.0;
-       theta = k * ((2.0 * PI) / N);
+       theta = k * ((2.0 * M_PI) / N);
 
        ND_pos(n)[0] = radius * cos(theta);
        ND_pos(n)[1] = radius * sin(theta);
index 5b1aae84499c29e3c7207fc8dddc845c33fd1146..2ae9e5d1b0ef2f240dd1ec15357939e8acda2d30 100644 (file)
  * actual block. Then, the angle to rotate the coalesced block to
  * that the edge from the parent is tangent to the neighbor on the
  * actual child block circle is
- *    alpha = theta + PI/2 - phi - arcsin((l/R)*(sin B))
- * where l = r - rho/(cos phi) and beta = PI/2 + phi.
+ *    alpha = theta + M_PI/2 - phi - arcsin((l/R)*(sin B))
+ * where l = r - rho/(cos phi) and beta = M_PI/2 + phi.
  * Thus, 
- *    alpha = theta + PI/2 - phi - arcsin((l/R)*(cos phi))
+ *    alpha = theta + M_PI/2 - phi - arcsin((l/R)*(cos phi))
  */
 static double
 getRotation(block_t * sn, Agraph_t * g, double x, double y, double theta)
@@ -72,16 +72,16 @@ getRotation(block_t * sn, Agraph_t * g, double x, double y, double theta)
     list = sn->circle_list;
 
     if (sn->parent_pos >= 0) {
-       theta += PI - sn->parent_pos;
+       theta += M_PI - sn->parent_pos;
        if (theta < 0)
-           theta += 2 * PI;
+           theta += 2 * M_PI;
 
        return theta;
     }
 
     count = sizeNodelist(list);
     if (count == 2) {
-       return (theta - PI / 2.0);
+       return (theta - M_PI / 2.0);
     }
 
     /* Find node in block connected to block's parent */
@@ -128,12 +128,12 @@ getRotation(block_t * sn, Agraph_t * g, double x, double y, double theta)
            double phi = atan2(n_y, n_x + r);
            double l = r - rho / (cos(phi));
 
-           theta += PI / 2.0 - phi - asin((l / R) * (cos(phi)));
+           theta += M_PI / 2.0 - phi - asin((l / R) * (cos(phi)));
        } else {                /* Origin still at center of this block */
            double phi = atan2(ND_pos(neighbor)[1], ND_pos(neighbor)[0]);
-           theta += PI - phi - PSI(neighbor);
-           if (theta > 2 * PI)
-               theta -= 2 * PI;
+           theta += M_PI - phi - PSI(neighbor);
+           if (theta > 2 * M_PI)
+               theta -= 2 * M_PI;
        }
     } else
        theta = 0;
@@ -247,7 +247,7 @@ doParent(Agraph_t * g, double theta, Agnode_t * n,
     else
        childAngle = theta - stp->nodeAngle / 2;
 
-    childRadius = length * diameter / (2 * PI);
+    childRadius = length * diameter / (2 * M_PI);
 
     /* FIX: If the parent block stp has only 1 child, we should probably
      * also set childRadius to mindistance. In this case, can 1 prove that
@@ -338,7 +338,7 @@ position(Agraph_t * g, int childCount, int length, nodelist_t * path,
     state.subtreeR = sn->radius;
     state.radius = sn->radius;
     state.neighbor = CHILD(sn);
-    state.nodeAngle = 2 * PI / length;
+    state.nodeAngle = 2 * M_PI / length;
     state.firstAngle = -1;
     state.lastAngle = -1;
 
@@ -367,7 +367,7 @@ position(Agraph_t * g, int childCount, int length, nodelist_t * path,
     } else
        sn->radius = state.subtreeR;
 
-    angle = (state.firstAngle + state.lastAngle) / 2.0 - PI;
+    angle = (state.firstAngle + state.lastAngle) / 2.0 - M_PI;
     return angle;
 }
 
@@ -379,7 +379,7 @@ static void doBlock(Agraph_t * g, block_t * sn, double min_dist)
     block_t *child;
     nodelist_t *longest_path;
     int childCount, length;
-    double centerAngle = PI;
+    double centerAngle = M_PI;
 
     /* layout child subtrees */
     childCount = 0;
@@ -401,7 +401,7 @@ static void doBlock(Agraph_t * g, block_t * sn, double min_dist)
     if ((length == 1) && (BLK_PARENT(sn))) {
        sn->parent_pos = centerAngle;
        if (sn->parent_pos < 0)
-           sn->parent_pos += 2 * PI;
+           sn->parent_pos += 2 * M_PI;
     }
 }