public void Complex_GenerateTrackerMesh(Vector2 pos, Dictionary <Slicer2D, SlicerTrackerObject> trackerList, Transform transform, float lineWidth, float zPosition, float squareSize, Slicer2DLineEndingType endingType, int edges)
        {
            float size = squareSize;

            GenerateSquare(pos, size, transform, lineWidth, zPosition, endingType, edges);

            CreateLine(new Pair2(pos, pos), transform.localScale, lineWidth, zPosition);

            foreach (KeyValuePair <Slicer2D, SlicerTrackerObject> trackerPair in trackerList)
            {
                SlicerTrackerObject tracker = trackerPair.Value;
                if (trackerPair.Key != null && tracker.tracking)
                {
                    List <Vector2D> pointListWorld = Vector2DList.PointsToWorldSpace(trackerPair.Key.transform, tracker.pointsList);

                    pointListWorld.Add(new Vector2D(pos));

                    List <Pair2> pairList = Pair2.GetList(pointListWorld, false);

                    foreach (Pair2 pair in pairList)
                    {
                        CreateLine(pair, transform.localScale, lineWidth, zPosition);
                    }
                }
            }
        }
        ///// COMPLEX /////
        public void Complex_GenerateMesh(Vector2List complexSlicerPointsList, Transform transform, float lineWidth, float minVertexDistance, float zPosition, float squareSize, float lineEndWidth, float vertexSpace, Slicer2DLineEndingType endingType, int edges)
        {
            float size = squareSize;

            Vector2 vA, vB;
            float   rot;

            List <Pair2> list = Pair2.GetList(complexSlicerPointsList, false);

            foreach (Pair2 pair in list)
            {
                vA = pair.a;
                vB = pair.b;

                rot = (float)Vector2D.Atan2(pair.a, pair.b);

                vA = vA.Push(rot, -minVertexDistance * vertexSpace);
                vB = vB.Push(rot, minVertexDistance * vertexSpace);

                CreateLine(new Pair2(vA, vB), transform.localScale, lineWidth, zPosition);
            }

            Pair2 linearPair = Pair2.zero;;

            linearPair.a = complexSlicerPointsList.First();
            linearPair.b = complexSlicerPointsList.Last();

            GenerateSquare(linearPair.a, size, transform, lineEndWidth, zPosition, endingType, edges);

            GenerateSquare(linearPair.b, size, transform, lineEndWidth, zPosition, endingType, edges);
        }
        public void Linear_GenerateCutMesh(Pair2 linearPair, float cutSize, Transform transform, float lineWidth, float zPosition)
        {
            LinearCut linearCutLine = LinearCut.Create(linearPair, cutSize);

            foreach (Pair2 pair in Pair2.GetList(linearCutLine.GetPointsList(), true))
            {
                CreateLine(pair, transform.localScale, lineWidth, zPosition);
            }
        }
        public void Complex_GenerateCutMesh(List <Vector2D> complexSlicerPointsList, float cutSize, Transform transform, float lineWidth, float zPosition)
        {
            ComplexCut complexCutLine = ComplexCut.Create(complexSlicerPointsList, cutSize);

            foreach (Pair2 pair in Pair2.GetList(complexCutLine.GetPointsList(), true))
            {
                CreateLine(pair, transform.localScale, lineWidth, zPosition);
            }
        }
        public void GeneratePolygon2DMesh(Transform transform, Polygon2D polygon, float lineOffset, float lineWidth, bool connectedLine)
        {
            Polygon2D poly = polygon;

            foreach (Pair2 p in Pair2.GetList(poly.pointsList, connectedLine))
            {
                CreateLine(p, transform.localScale, lineWidth, lineOffset);
            }

            foreach (Polygon2D hole in poly.holesList)
            {
                foreach (Pair2 p in Pair2.GetList(hole.pointsList, connectedLine))
                {
                    CreateLine(p, transform.localScale, lineWidth, lineOffset);
                }
            }
        }
        ///// POLYGON /////
        public void GeneratePolygonMesh(Vector2 pos, Polygon2D.PolygonType polygonType, float polygonSize, float minVertexDistance, Transform transform, float lineWidth, float zPosition)
        {
            Polygon2D slicePolygon = Polygon2D.Create(polygonType, polygonSize).ToOffset(pos);

            Vector2 vA, vB;

            foreach (Pair2 pair in Pair2.GetList(slicePolygon.pointsList, true))
            {
                vA = pair.a;
                vB = pair.b;

                vA = vA.Push(pair.a.Atan2(pair.b), -minVertexDistance / 5);
                vB = vB.Push(pair.a.Atan2(pair.b), minVertexDistance / 5);

                CreateLine(new Pair2(vA, vB), transform.localScale, lineWidth, zPosition);
            }
        }
        ///// Create /////
        public void GenerateCreateMesh(Vector2 pos, Polygon2D.PolygonType polygonType, float polygonSize, Slicer2DCreateControllerObject.CreateType createType, List <Vector2D> complexSlicerPointsList, Pair2D linearPair, float minVertexDistance, Transform transform, float lineWidth, float zPosition, float squareSize, Slicer2DLineEndingType endingType, int edges)
        {
            float size = squareSize;

            if (createType == Slicer2DCreateControllerObject.CreateType.Slice)
            {
                if (complexSlicerPointsList.Count > 0)
                {
                    linearPair.A = new Vector2D(complexSlicerPointsList.First());
                    linearPair.B = new Vector2D(complexSlicerPointsList.Last());

                    GenerateSquare(linearPair.A.ToVector2(), size, transform, lineWidth, zPosition, endingType, edges);

                    GenerateSquare(linearPair.B.ToVector2(), size, transform, lineWidth, zPosition, endingType, edges);

                    Vector2D vA, vB;
                    foreach (Pair2 pair in Pair2.GetList(complexSlicerPointsList, true))
                    {
                        vA = new Vector2D(pair.a);
                        vB = new Vector2D(pair.b);

                        vA.Push(Vector2D.Atan2(pair.a, pair.b), -minVertexDistance / 5);
                        vB.Push(Vector2D.Atan2(pair.a, pair.b), minVertexDistance / 5);

                        CreateLine(new Pair2(vA.ToVector2(), vB.ToVector2()), transform.localScale, lineWidth, zPosition);
                    }
                }
            }
            else
            {
                Polygon2D poly = Polygon2D.Create(polygonType, polygonSize).ToOffset(pos);

                Vector2D vA, vB;
                foreach (Pair2 pair in Pair2.GetList(poly.pointsList, true))
                {
                    vA = new Vector2D(pair.a);
                    vB = new Vector2D(pair.b);

                    vA.Push(Vector2D.Atan2(pair.a, pair.b), -minVertexDistance / 5);
                    vB.Push(Vector2D.Atan2(pair.a, pair.b), minVertexDistance / 5);

                    CreateLine(new Pair2(vA.ToVector2(), vB.ToVector2()), transform.localScale, lineWidth, zPosition);
                }
            }
        }
        public void Linear_GenerateTrackerMesh(Vector2 pos, Dictionary <Slicer2D, SlicerTrackerObject> trackerList, Transform transform, float lineWidth, float zPosition, float size, Slicer2DLineEndingType endingType, int edges)
        {
            GenerateSquare(pos, size, transform, lineWidth, zPosition, endingType, edges);

            CreateLine(new Pair2(pos, pos), transform.localScale, lineWidth, zPosition);

            foreach (KeyValuePair <Slicer2D, SlicerTrackerObject> trackerPair in trackerList)
            {
                SlicerTrackerObject tracker = trackerPair.Value;
                if (trackerPair.Key != null && tracker.tracking)
                {
                    foreach (Pair2 pair in Pair2.GetList(Vector2DList.PointsToWorldSpace(trackerPair.Key.transform, tracker.GetLinearPoints()), false))
                    {
                        CreateLine(pair, transform.localScale, lineWidth, zPosition);
                    }
                }
            }
        }
        public void GenerateTrailMesh(Dictionary <Slicer2D, SlicerTrailObject> trailList, Transform transform, float lineWidth, float zPosition, float squareSize)
        {
            foreach (KeyValuePair <Slicer2D, SlicerTrailObject> s in trailList)
            {
                if (s.Key != null)
                {
                    List <Vector2D> points = new List <Vector2D>();
                    foreach (TrailPoint trailPoint in s.Value.pointsList)
                    {
                        points.Add(trailPoint.position);
                    }

                    foreach (Pair2 pair in Pair2.GetList(points, false))
                    {
                        CreateLine(pair, new Vector3(1, 1, 1), lineWidth, zPosition);
                    }
                }
            }
        }
 public void Complex_GenerateTrackerMesh(Dictionary <Slicer2D, SlicerTrackerObject> trackerList, Transform transform, float lineWidth, float zPosition)
 {
     foreach (KeyValuePair <Slicer2D, SlicerTrackerObject> trackerPair in trackerList)
     {
         SlicerTrackerObject tracker = trackerPair.Value;
         if (trackerPair.Key != null && tracker.tracking)
         {
             if (tracker.firstPosition == null || tracker.lastPosition == null)
             {
                 continue;
             }
             List <Vector2D> points = Vector2DList.PointsToWorldSpace(trackerPair.Key.transform, tracker.GetLinearPoints());
             foreach (Pair2 pair in Pair2.GetList(points, false))
             {
                 CreateLine(pair, transform.localScale, lineWidth, zPosition);
             }
         }
     }
 }