Index: src/librt/primitives/bot/bot.c
===================================================================
--- src/librt/primitives/bot/bot.c	(Revision 54124)
+++ src/librt/primitives/bot/bot.c	(Arbeitskopie)
@@ -5087,7 +5087,144 @@
     bu_free(headRblp, "rt_bot_list_free: headRblp");
 }
 
+void
+rt_bot_surf_area(fastf_t *area, const struct rt_db_internal *ip)
+{   
+    struct rt_bot_internal *bot_ip =
+	(struct rt_bot_internal *)ip->idb_ptr;
+    char buf[256];
+    size_t j;
+    int a,b;
+    fastf_t whole_bot_vertices[bot_ip->num_faces][3][3]; /* [face][corner][x,y,z] */
+    fastf_t whole_bot_lengths[bot_ip->num_faces][3];
+    fastf_t whole_bot_overall_area;  
+    
+    whole_bot_overall_area = 0;
 
+       
+    for (a = 0; a < bot_ip->num_faces; a++) {
+	point_t pt[3];
+        
+        
+	for (j = 0; j < 3; j++) {
+	    size_t ptnum;
+	    ptnum = bot_ip->faces[a*3+j];
+	    /*convert vertices into new array for calculating lengths*/
+	    whole_bot_vertices[a][j][0] = pt[j][X];
+	    whole_bot_vertices[a][j][1] = pt[j][Y];
+	    whole_bot_vertices[a][j][2] = pt[j][Z];
+	    VSCALE(pt[j], &bot_ip->vertices[ptnum*3], 1);
+	}
+        
+	whole_bot_overall_area = bn_area_of_triangle(&pt[0], &pt[1], &pt[2]) + whole_bot_overall_area;
+    }
+    
+    
+    /*calculating length of each edge*/
+    
+
+    for (a = 0; a < bot_ip->num_faces; a++) {
+        
+	whole_bot_lengths[a][0] = sqrt(
+	    (whole_bot_vertices[a][0][0] - whole_bot_vertices[a][1][0]) * (whole_bot_vertices[a][0][0] - whole_bot_vertices[a][1][0]) +
+	    (whole_bot_vertices[a][0][1] - whole_bot_vertices[a][1][1]) * (whole_bot_vertices[a][0][1] - whole_bot_vertices[a][1][1]) +
+	    (whole_bot_vertices[a][0][2] - whole_bot_vertices[a][1][2]) * (whole_bot_vertices[a][0][2] - whole_bot_vertices[a][1][2])        
+	    );
+        
+	whole_bot_lengths[a][1] = sqrt(
+	    (whole_bot_vertices[a][1][0] - whole_bot_vertices[a][2][0]) * (whole_bot_vertices[a][1][0] - whole_bot_vertices[a][2][0]) +
+	    (whole_bot_vertices[a][1][1] - whole_bot_vertices[a][2][1]) * (whole_bot_vertices[a][1][1] - whole_bot_vertices[a][2][1]) +
+	    (whole_bot_vertices[a][1][2] - whole_bot_vertices[a][2][2]) * (whole_bot_vertices[a][1][2] - whole_bot_vertices[a][2][2])
+	    );
+        
+	whole_bot_lengths[a][2] = sqrt(
+	    (whole_bot_vertices[a][0][0] - whole_bot_vertices[a][2][0]) * (whole_bot_vertices[a][0][0] - whole_bot_vertices[a][2][0]) +
+	    (whole_bot_vertices[a][0][1] - whole_bot_vertices[a][2][1]) * (whole_bot_vertices[a][0][1] - whole_bot_vertices[a][2][1]) +
+	    (whole_bot_vertices[a][0][2] - whole_bot_vertices[a][2][2]) * (whole_bot_vertices[a][0][2] - whole_bot_vertices[a][2][2])
+	    );
+    }
+    
+   
+    
+    switch (bot_ip->mode) {
+    case RT_BOT_SURFACE:
+	whole_bot_overall_area = whole_bot_overall_area*2;
+	break;
+    case RT_BOT_SOLID:
+	break;
+    default:
+	whole_bot_overall_area = whole_bot_overall_area * 2;
+	for (a = 0; a-1 < bot_ip->num_faces; a++) {
+	    int a_is_exterior_edge, b_is_exterior_edge, c_is_exterior_edge;
+	    a_is_exterior_edge = 1;
+	    b_is_exterior_edge = 1;
+	    c_is_exterior_edge = 1;               
+	    for (b = 0; b < bot_ip->num_faces; b++) {
+		/*get exterior edges*/
+		if (a == b)
+		    continue;
+		if((whole_bot_vertices[a][0] == whole_bot_vertices[b][0] && whole_bot_vertices[a][1] == whole_bot_vertices[b][1]))
+		    a_is_exterior_edge = 0;
+		else if ((whole_bot_vertices[a][0] == whole_bot_vertices[b][1] && whole_bot_vertices[a][1] == whole_bot_vertices[b][2]))
+		    a_is_exterior_edge = 0;
+		else if ((whole_bot_vertices[a][0] == whole_bot_vertices[b][2] && whole_bot_vertices[a][1] == whole_bot_vertices[b][0]))
+		    a_is_exterior_edge = 0;
+		else if((whole_bot_vertices[a][0] == whole_bot_vertices[b][1] && whole_bot_vertices[a][1] == whole_bot_vertices[b][0]))
+		    a_is_exterior_edge = 0;
+		else if ((whole_bot_vertices[a][0] == whole_bot_vertices[b][2] && whole_bot_vertices[a][1] == whole_bot_vertices[b][1]))
+		    a_is_exterior_edge = 0;
+		else if ((whole_bot_vertices[a][0] == whole_bot_vertices[b][0] && whole_bot_vertices[a][1] == whole_bot_vertices[b][2]))
+		    a_is_exterior_edge = 0;
+		if((whole_bot_vertices[a][1] == whole_bot_vertices[b][0] && whole_bot_vertices[a][2] == whole_bot_vertices[b][1]))
+		    b_is_exterior_edge = 0;
+		else if ((whole_bot_vertices[a][1] == whole_bot_vertices[b][1] && whole_bot_vertices[a][2] == whole_bot_vertices[b][2]))
+		    b_is_exterior_edge = 0;
+		else if ((whole_bot_vertices[a][1] == whole_bot_vertices[b][2] && whole_bot_vertices[a][2] == whole_bot_vertices[b][0]))
+		    b_is_exterior_edge = 0;
+		else if((whole_bot_vertices[a][1] == whole_bot_vertices[b][1] && whole_bot_vertices[a][2] == whole_bot_vertices[b][0]))
+		    b_is_exterior_edge = 0;
+		else if ((whole_bot_vertices[a][1] == whole_bot_vertices[b][2] && whole_bot_vertices[a][2] == whole_bot_vertices[b][1]))
+		    b_is_exterior_edge = 0;
+		else if ((whole_bot_vertices[a][1] == whole_bot_vertices[b][0] && whole_bot_vertices[a][2] == whole_bot_vertices[b][2]))
+		    b_is_exterior_edge = 0;
+		if((whole_bot_vertices[a][0] == whole_bot_vertices[b][0] && whole_bot_vertices[a][2] == whole_bot_vertices[b][1]))
+		    c_is_exterior_edge = 0;
+		else if ((whole_bot_vertices[a][0] == whole_bot_vertices[b][1] && whole_bot_vertices[a][2] == whole_bot_vertices[b][2]))
+		    c_is_exterior_edge = 0;
+		else if ((whole_bot_vertices[a][0] == whole_bot_vertices[b][2] && whole_bot_vertices[a][2] == whole_bot_vertices[b][0]))
+		    c_is_exterior_edge = 0;
+		else if((whole_bot_vertices[a][0] == whole_bot_vertices[b][1] && whole_bot_vertices[a][2] == whole_bot_vertices[b][0]))
+		    c_is_exterior_edge = 0;
+		else if ((whole_bot_vertices[a][0] == whole_bot_vertices[b][2] && whole_bot_vertices[a][2] == whole_bot_vertices[b][1]))
+		    c_is_exterior_edge = 0;
+		else if ((whole_bot_vertices[a][0] == whole_bot_vertices[b][0] && whole_bot_vertices[a][2] == whole_bot_vertices[b][2]))
+		    c_is_exterior_edge = 0;
+                   
+	    }
+	    if (a_is_exterior_edge == 1){
+		fastf_t rectangle_size;
+		rectangle_size = bot_ip->thickness[a] * whole_bot_lengths[a][0];
+		whole_bot_overall_area = whole_bot_overall_area + rectangle_size;
+                    
+	    }
+	    if (b_is_exterior_edge == 1){
+		fastf_t rectangle_size;
+		rectangle_size = bot_ip->thickness[a] * whole_bot_lengths[a][1];
+		whole_bot_overall_area = whole_bot_overall_area + rectangle_size;
+                    
+	    }
+	    if (c_is_exterior_edge == 1){
+		fastf_t rectangle_size;
+		rectangle_size = bot_ip->thickness[a] * whole_bot_lengths[a][2];
+		whole_bot_overall_area = whole_bot_overall_area + rectangle_size;
+	    }
+	}
+
+    }
+    *area = whole_bot_overall_area;
+    return;
+}
+
 /** @} */
 /*
  * Local Variables:
Index: src/librt/primitives/table.c
===================================================================
--- src/librt/primitives/table.c	(Revision 54124)
+++ src/librt/primitives/table.c	(Arbeitskopie)
@@ -1419,7 +1419,7 @@
 	rt_bot_params,
 	rt_bot_bbox,
 	NULL,
-	NULL,
+	rt_bot_surf_area,
 	rt_bot_centroid,
     },
 
