/// <summary>
        /// Checks if gameObject is a LineSketchObject, then deletes control points of this LineSketchObject within radius
        /// </summary>
        /// <param name="gameObject">LineSketchObject of which control points should be deleted.</param>
        /// <param name="point">Point in world space.</param>
        /// <param name="radius">Radius in world space.</param>
        public static void DeleteControlPoints(GameObject gameObject, Vector3 point, float radius)
        {
            LineSketchObject line = gameObject.GetComponent <LineSketchObject>();

            //When there is only one control point, a sphere that is a child of the LineSketchObject is shown
            //This code checks if this child sphere of a LineSketchObject was collided with
            if (line == null && gameObject.GetComponent <SphereCollider>() && gameObject.transform.parent.GetComponent <LineSketchObject>())
            {
                line = gameObject.transform.parent.GetComponent <LineSketchObject>();
            }

            line?.DeleteControlPoints(point, radius, out List <LineSketchObject> newLines);
        }
        /// <summary>
        /// Delete the control points of this line that are within the radius around point.
        /// </summary>
        /// <param name="point">Point in world space.</param>
        /// <param name="radius">Radius in world space.</param>
        /// <param name="newLineSketchObjects">List of new line sketch objects that were created for the deletion.</param>
        /// <returns>Returns true if at least one control point was deleted, false otherwise.</returns>
        internal bool DeleteControlPoints(Vector3 point, float radius, out List <LineSketchObject> newLineSketchObjects)
        {
            List <List <Vector3> > contiguousSections = new List <List <Vector3> >();
            List <Vector3>         contiguousSection  = new List <Vector3>();

            //find contiguous sections of control points that are not in the radius
            foreach (Vector3 controlPoint in GetControlPoints())
            {
                if (!IsInRadius(controlPoint, this.transform.InverseTransformPoint(point), radius / this.transform.lossyScale.x))
                {
                    contiguousSection.Add(controlPoint);
                }
                else
                {
                    if (contiguousSection.Count > 0)
                    {
                        contiguousSections.Add(contiguousSection);
                        contiguousSection = new List <Vector3>();
                    }
                }
            }
            if (contiguousSection.Count > 0)
            {
                contiguousSections.Add(contiguousSection);
            }

            newLineSketchObjects = new List <LineSketchObject>();

            //create lines from the sections
            if (contiguousSections.Count > 0)
            {
                if (contiguousSections.Count == 1 && contiguousSections[0].Count == this.getNumberOfControlPoints())
                {
                    //if this is the case, no control points were deleted and the line stays unchanged
                    return(false);
                }

                //this line becomes the first section
                this.SetControlPointsLocalSpace(contiguousSections[0]);
                contiguousSections.RemoveAt(0);

                //create new lines for each additional section
                foreach (List <Vector3> section in contiguousSections)
                {
                    LineSketchObject newLine = Instantiate(this, this.transform.parent);
                    this.SplineMesh.GetCrossSectionShape(out List <Vector3> crossSectionVertices, out List <Vector3> crossSectionNormals);
                    newLine.SetLineCrossSection(crossSectionVertices, crossSectionNormals, this.lineDiameter);
                    newLine.SetInterpolationSteps(this.InterpolationSteps);
                    newLine.SetControlPointsLocalSpace(section);

                    newLineSketchObjects.Add(newLine);
                }
            }
            else
            {
                if (SketchWorld.ActiveSketchWorld)
                {
                    SketchWorld.ActiveSketchWorld.DeleteObject(this);
                }
                else
                {
                    Destroy(this.gameObject);
                }
            }

            return(true);
        }