Index: include/bn.h
===================================================================
--- include/bn.h	(Revision 59233)
+++ include/bn.h	(Arbeitskopie)
@@ -4597,6 +4597,30 @@
 
 typedef struct tri_float_specific tri_specific_float;
 
+
+/*----------------------------------------------------------------------*/
+
+
+/* polygon.c */
+
+
+/**
+ * calculate the interior area of a polygon.
+ *
+ * If npts > 4, Greens Theorem is used. The polygon mustn't 
+ * be self-intersecting.
+ * 
+ * @param[out] area The interior area of the polygon
+ * @param[in] npts Number of point_ts, stored in pts
+ * @param[in] pts All points of the polygon, sorted counter-clockwise. 
+ * The array mustn't contain duplicated points.
+ *
+ * @return 0 if calculation was successful
+ * @return 1 if calculation failed, e.g. because one parameter is a NULL-pointer
+ */
+BN_EXPORT extern int bn_polygon_area(fastf_t *area, size_t npts, const point_t *pts);
+
+
 #endif /* BN_H */
 
 /** @} */
Index: src/libbn/CMakeLists.txt
===================================================================
--- src/libbn/CMakeLists.txt	(Revision 59233)
+++ src/libbn/CMakeLists.txt	(Arbeitskopie)
@@ -23,6 +23,7 @@
   plane.c
   plot3.c
   poly.c
+  polygon.c
   qmath.c
   rand.c
   randmt.c
Index: src/libbn/polygon.c
===================================================================
--- src/libbn/polygon.c	(Revision 0)
+++ src/libbn/polygon.c	(Arbeitskopie)
@@ -0,0 +1,80 @@
+/*                     P O L Y G O N . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2004-2013 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+
+#include "bu.h"
+#include "bn.h"
+
+
+/**
+ * calculate the interior area of a polygon.
+ *
+ * If npts > 4, Greens Theorem is used. The polygon mustn't
+ * be self-intersecting.
+ *
+ * @param[out] area The interior area of the polygon
+ * @param[in] npts Number of point_ts, stored in pts
+ * @param[in] pts All points of the polygon, sorted counter-clockwise.
+ * The array mustn't contain duplicated points.
+ *
+ * @return 0 if calculation was successful
+ * @return 1 if calculation failed, e.g. because one parameter is a NULL-pointer
+ */
+int
+bn_polygon_area(fastf_t *area, size_t npts, const point_t *pts)
+{
+    size_t i;
+    vect_t v1, v2, tmp, tot = VINIT_ZERO;
+    plane_t plane_eqn;
+    struct bn_tol tol;
+
+    if (!pts || !area || npts < 3)
+	return 1;
+    BN_TOL_INIT(&tol);
+    tol.dist_sq = BN_TOL_DIST * BN_TOL_DIST;
+    if (bn_mk_plane_3pts(plane_eqn, pts[0], pts[1], pts[2], &tol) == -1)
+	return 1;
+
+    switch (npts) {
+	case 3:
+	    /* Triangular Face - for triangular face T:V0, V1, V2,
+	     * area = 0.5 * [(V2 - V0) x (V1 - V0)] */
+	    VSUB2(v1, pts[1], pts[0]);
+	    VSUB2(v2, pts[2], pts[0]);
+	    VCROSS(tot, v2, v1);
+	    break;
+	case 4:
+	    /* Quadrilateral Face - for planar quadrilateral
+	     * Q:V0, V1, V2, V3 with unit normal N,
+	     * area = N/2 ⋅ [(V2 - V0) x (V3 - V1)] */
+	    VSUB2(v1, pts[2], pts[0]);
+	    VSUB2(v2, pts[3], pts[1]);
+	    VCROSS(tot, v2, v1);
+	    break;
+	default:
+	    /* N-Sided Face - compute area using Green's Theorem */
+	    for (i = 0; i < npts; i++) {
+		VCROSS(tmp, pts[i], pts[i + 1 == npts ? 0 : i + 1]);
+		VADD2(tot, tot, tmp);
+	    }
+	    break;
+    }
+    *area = fabs(VDOT(plane_eqn, tot)) * 0.5;
+    return 0;
+}
