/// <summary> /// returns the area of the polyloop /// </summary> /// <param name="loop"></param> /// <returns></returns> public static double Area(this IfcPolyLoop loop) { XbimVector3D sum = new XbimVector3D(0, 0, 0); IList <IfcCartesianPoint> pts = loop.Polygon; for (int i = 0; i < pts.Count - 1; i++) { XbimVector3D a = new XbimVector3D(pts[i].X, pts[i].Y, pts[i].Z); XbimVector3D b = new XbimVector3D(pts[i + 1].X, pts[i + 1].Y, pts[i + 1].Z); sum = sum + a.CrossProduct(b); } XbimVector3D n = loop.NewellsNormal(); return(n.DotProduct(sum) / 2); }
/// <summary> /// returns the area of the polyloop /// </summary> /// <param name="loop"></param> /// <returns></returns> public static double Area(this IfcPolyLoop loop) { var sum = new XbimVector3D(0, 0, 0); var pts = loop.Polygon; for (var i = 0; i < pts.Count - 1; i++) { var a = new XbimVector3D(pts[i].X, pts[i].Y, pts[i].Z); var b = new XbimVector3D(pts[i + 1].X, pts[i + 1].Y, pts[i + 1].Z); sum = sum + a.CrossProduct(b); } var n = loop.NewellsNormal(); return(n.DotProduct(sum) / 2); }