public static double Length(this Face3D face3D) { if (face3D == null) { return(double.NaN); } Planar.IClosed2D closed2D = face3D.ExternalEdge2D; if (closed2D == null) { return(double.NaN); } Planar.ISegmentable2D segmentable2D = closed2D as Planar.ISegmentable2D; if (segmentable2D == null) { throw new System.NotImplementedException(); } return(Planar.Query.MaxDistance(segmentable2D.GetPoints(), out Planar.Point2D point2D_1, out Planar.Point2D point2D_2)); }
public static double HydraulicDiameter(this Face3D face3D, double tolerance = Core.Tolerance.Distance) { Plane plane_Face3D = face3D?.GetPlane(); if (plane_Face3D == null) { return(double.NaN); } Plane plane = Plane.WorldXY; if (plane.Perpendicular(plane_Face3D, tolerance)) { return(0); } Face3D face3D_Project = plane.Project(face3D); if (face3D_Project == null || !face3D_Project.IsValid()) { return(0); } Planar.ISegmentable2D segmentable2D = face3D_Project.ExternalEdge2D as Planar.ISegmentable2D; if (segmentable2D == null) { throw new System.NotImplementedException(); } double area = face3D_Project.GetArea(); if (area <= tolerance) { return(0); } //return (4 * area) / segmentable2D.GetLength(); return(segmentable2D.GetLength()); }