Ejemplo n.º 1
0
        public void GenerateCreateMesh(Vector2 pos, Polygon2D.PolygonType polygonType, float polygonSize, Controller.Extended.CreateController.CreateType createType, List <Vector2D> pointsList, Pair2D linearPair)
        {
            visualMeshBorder.GenerateCreateMesh(pos, polygonType, polygonSize, createType, pointsList, linearPair, minVertexDistance, transform, lineWidth * visualScale * borderScale, zPosition + 0.001f, lineEndSize, lineEndingType, lineEndingEdgeCount);
            meshBorder.Add(visualMeshBorder.Export(0));

            visualMesh.GenerateCreateMesh(pos, polygonType, polygonSize, createType, pointsList, linearPair, minVertexDistance, transform, lineWidth * visualScale, zPosition, lineEndSize, lineEndingType, lineEndingEdgeCount);
            mesh.Add(visualMesh.Export(0));
        }
Ejemplo n.º 2
0
        ///// Create /////
        public void GenerateCreateMesh(Vector2 pos, Polygon2D.PolygonType polygonType, float polygonSize, Controller.Extended.CreateController.CreateType createType, List <Vector2D> complexSlicerPointsList, Pair2D linearPair, float minVertexDistance, Transform transform, float lineWidth, float zPosition, float squareSize, LineEndingType endingType, int edges)
        {
            float size = squareSize;

            if (createType == Controller.Extended.CreateController.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);
                }
            }
        }