private void AddTriangulated()
    {
        var points = new[]
        {
            new Vector2(-7, -1),
            new Vector2(-6, -1),
            new Vector2(-6, -2),
            new Vector2(-6.8f, -3),
            new Vector2(-6.4f, -1.5f),
        };

        TriangulatedMesh triangulated = TriangulatedMesh.Add(Vector3.zero, points);

        triangulated.GetComponent <MeshRenderer>().material.color = Color.green;
    }
    private MeshBase GetChoosenMesh(MeshCreator meshCreator)
    {
        float?minArea = meshCreator.splineSimplification != SplineSimplification.Type.None
            ? meshCreator.minAbsoluteSplineArea
            : (float?)null;

        switch (meshCreator.meshType)
        {
        case MeshCreator.MeshType.Triangle:
            return(TriangleMesh.AddTriangle(meshCreator.transform.position, meshCreator.triangleVertex1,
                                            meshCreator.triangleVertex2, meshCreator.triangleVertex3, Space.World, meshCreator.material,
                                            meshCreator.attachRigidbody));

        case MeshCreator.MeshType.Rectangle:
            return(RectangleMesh.AddRectangle(meshCreator.transform.position, meshCreator.boxSize,
                                              meshCreator.material, meshCreator.attachRigidbody));

        case MeshCreator.MeshType.Circle:
            return(CircleMesh.AddCircle(meshCreator.transform.position, meshCreator.circleRadius,
                                        meshCreator.circleSides, meshCreator.circleUseCircleCollider, meshCreator.material,
                                        meshCreator.attachRigidbody));

        case MeshCreator.MeshType.Quadrangle:
            Vector2[] verts = new Vector2[4] {
                meshCreator.quadrangleVertex1, meshCreator.quadrangleVertex2,
                meshCreator.quadrangleVertex3, meshCreator.quadrangleVertex4
            };
            return(QuadrangleMesh.AddQuadrangle(meshCreator.transform.position, verts, Space.World,
                                                meshCreator.material, meshCreator.attachRigidbody));

        case MeshCreator.MeshType.Ellipse:
            return(EllipseMesh.AddEllipse(meshCreator.transform.position, meshCreator.ellipseHorizontalRadius,
                                          meshCreator.ellipseVerticalRadius, meshCreator.ellipseSides, meshCreator.material,
                                          meshCreator.attachRigidbody));

        case MeshCreator.MeshType.PointedCircle:
            return(PointedCircleMesh.AddPointedCircle(meshCreator.transform.position, meshCreator.pointedCircleRadius,
                                                      meshCreator.pointedCircleSides, meshCreator.pointedCircleShift, meshCreator.material,
                                                      meshCreator.attachRigidbody));

        case MeshCreator.MeshType.Cake:
            return(CakeMesh.AddCakeMesh(meshCreator.transform.position, meshCreator.cakeRadius, meshCreator.cakeSides,
                                        meshCreator.cakeSidesToFill, meshCreator.material, meshCreator.attachRigidbody));

        case MeshCreator.MeshType.Convex:
            return(ConvexMesh.AddConvexMesh(meshCreator.transform.position,
                                            MeshHelper.ConvertVec2ToVec3(meshCreator.convexPoints),
                                            meshCreator.material, meshCreator.attachRigidbody));

        case MeshCreator.MeshType.Star:
            return(StarMesh.AddStar(meshCreator.transform.position, meshCreator.starRadiusA, meshCreator.starRadiusB,
                                    meshCreator.starSides, meshCreator.material, meshCreator.attachRigidbody));

        case MeshCreator.MeshType.Gear:
            return(GearMesh.AddGear(meshCreator.transform.position, meshCreator.gearInnerRadius, meshCreator.gearRootRadius,
                                    meshCreator.gearOuterRadius, meshCreator.gearSides, meshCreator.material, meshCreator.attachRigidbody));

        case MeshCreator.MeshType.Line:
            return(LineMesh.AddLine(meshCreator.transform.position, meshCreator.linePoints.ToArray(), meshCreator.lineWidth,
                                    meshCreator.lineUseDoubleCollider, Space.World, meshCreator.material, meshCreator.attachRigidbody));

        case MeshCreator.MeshType.TriangulatedMesh:
            return(TriangulatedMesh.Add(meshCreator.transform.position, meshCreator.triangulatedPoints.ToArray(),
                                        meshCreator.material, meshCreator.attachRigidbody));

        case MeshCreator.MeshType.SplineShape:
            return(SplineShapeMesh.AddSplineShape(meshCreator.transform.position, meshCreator.splinePoints.ToArray(), meshCreator.splineResolution,
                                                  minArea, Space.World, meshCreator.material, meshCreator.attachRigidbody));

        case MeshCreator.MeshType.SplineCurve:
            return(SplineCurveMesh.AddSplineCurve(meshCreator.transform.position, meshCreator.splineCurvePoints.ToArray(),
                                                  meshCreator.splineResolution, meshCreator.splineCurveWidth, meshCreator.splineCurveUseDoubleCollider, minArea,
                                                  Space.World, meshCreator.material, meshCreator.attachRigidbody));

        case MeshCreator.MeshType.SplineConvexShape:
            return(ConvexSplineMesh.AddConvexSpline(meshCreator.transform.position, meshCreator.convexSplinePoints.ToArray(),
                                                    meshCreator.splineResolution, minArea, Space.World, meshCreator.material, meshCreator.attachRigidbody));

        default:
            throw new System.ArgumentOutOfRangeException();
        }
    }