/// <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)
        {
            StrokeSketchObject stroke = gameObject.GetComponent <StrokeSketchObject>();

            //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 (stroke == null && gameObject.GetComponent <SphereCollider>() && gameObject.transform.parent.GetComponent <StrokeSketchObject>())
            {
                stroke = gameObject.transform.parent.GetComponent <StrokeSketchObject>();
            }

            stroke?.DeleteControlPoints(point, radius, out List <StrokeSketchObject> 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="newStrokeSketchObjects">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 <StrokeSketchObject> newStrokeSketchObjects)
        {
            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);
            }

            newStrokeSketchObjects = new List <StrokeSketchObject>();

            //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)
                {
                    StrokeSketchObject newStroke = Instantiate(this, this.transform.parent);
                    this.SplineMesh.GetCrossSectionShape(out List <Vector3> crossSectionVertices, out List <Vector3> crossSectionNormals);
                    newStroke.SetStrokeCrossSection(crossSectionVertices, crossSectionNormals, this.lineDiameter);
                    newStroke.SetInterpolationSteps(this.InterpolationSteps);
                    newStroke.SetControlPointsLocalSpace(section);

                    newStrokeSketchObjects.Add(newStroke);
                }
            }
            else
            {
                if (SketchWorld.ActiveSketchWorld)
                {
                    SketchWorld.ActiveSketchWorld.DeleteObject(this);
                }
                else
                {
                    Destroy(this.gameObject);
                }
            }

            return(true);
        }