/***************************************************/ // Constructors. public Panel(Brep surface, double thickness, Material material, int id = -1, Element2D.Element2DType feType = Element2D.Element2DType.Unknown) { this._surface = surface; this._thickness = thickness; this._feType = feType; this._material = material; this._elements = new List <Element>(); // Set the local coordinate system. IEnumerable <Point3d> vertices = surface.Vertices.Select(p => p.Location); PlaneFitResult pfr = Plane.FitPlaneToPoints(vertices, out this._lcs); if (pfr != PlaneFitResult.Success) { throw new Exception("Geometry of the panel seems to be faulty!"); } this._lcs.Origin = GeometryUtil.Average(vertices); }
/***************************************************/ // Get centroid of an element. public Point3d GetCentroid() { return(GeometryUtil.Average(this.GetVertices())); }