public static SurfaceComponentGeometry CreateExtrudedPolygonCapGeometry( float radius, float height, int segmentP, int segmentH, float topRatio = 1, int surfaceGroup = 0, RenderGeometry.FaceType faceType = RenderGeometry.FaceType.Smooth, bool splitBoundary = false) { if (topRatio == 0) { return(CreateConeCapGeometry(radius, height, segmentP, segmentH, 0, surfaceGroup, faceType, splitBoundary)); } if (topRatio == 1 && height == 0) { return(CreateRegularPolygonGeometry(radius, segmentP, surfaceGroup, RenderGeometry.FaceType.Polygonal, true)); } StructureGeometry structure = new StructureGeometry(); SurfaceComponentGeometry upperCap = CreateRegularPolygonGeometry(radius * topRatio, segmentP, surfaceGroup + 1); SurfaceComponentGeometry side = CreateConeSideGeometry(radius, radius * topRatio, height, segmentP, segmentH, 0, false, surfaceGroup, faceType); side.ApplyOffset(Vector3.up * (height / 2)); Vertex cornerUp = structure.CreateVertex(new Vector3(radius * topRatio, height, 0)); Vertex cornerDown = structure.CreateVertex(new Vector3(radius, 0, 0)); structure.CreateFace(side, false, cornerUp, cornerUp, cornerDown, cornerDown); structure.CreateFace(upperCap, true, cornerUp); SurfaceComponentGeometry geometry = new SurfaceComponentGeometry(structure.Build()); geometry.DefineBoundaries(structure.GetBuiltVertex(cornerDown)); if (splitBoundary) { geometry.SplitBoundaries(); } return(geometry); }