//Show current active point where we split triangle
    private void ShowCircle(MyVector2 p)
    {
        controller.ResetBlackMeshes();

        HashSet <Triangle2> triangles = _GenerateMesh.Circle(controller.UnNormalize(p), 0.2f, 10);

        List <Mesh> meshes = controller.GenerateTriangulationMesh(triangles, shouldUnNormalize: false);

        controller.blackMeshes = meshes;
    }
    //
    // Visualize stuff
    //

    private void ShowAllPoints(HashSet <MyVector2> points)
    {
        HashSet <Triangle2> triangles = new HashSet <Triangle2>();

        foreach (MyVector2 p in points)
        {
            HashSet <Triangle2> tCircle = _GenerateMesh.Circle(controller.UnNormalize(p), 0.1f, 10);

            triangles.UnionWith(tCircle);
        }

        //To mesh
        List <Mesh> meshes = controller.GenerateTriangulationMesh(triangles, shouldUnNormalize: false);

        controller.ResetBlackMeshes();

        controller.blackMeshes = meshes;

        //Debug.Log(meshes.Count);
    }
    //Show circles
    private void ShowCircles(MyVector2 a, MyVector2 b, MyVector2 c, MyVector2 d)
    {
        //Generate triangles
        //Will unnormalize
        HashSet <Triangle2> triangles = controller.GenerateDelaunayCircleTriangles(a, b, c, d);

        //The active edge is between a-c
        HashSet <Triangle2> edge = _GenerateMesh.LineSegment(controller.UnNormalize(a), controller.UnNormalize(c), 0.2f);

        triangles.UnionWith(edge);

        //Generate meshes
        List <Mesh> meshes = controller.GenerateTriangulationMesh(triangles, shouldUnNormalize: false);

        controller.ResetBlackMeshes();

        controller.blackMeshes = meshes;
    }
Esempio n. 4
0
    //
    // Display stuff
    //

    //Show points
    private void ShowPoints(HashSet <MyVector2> points)
    {
        controller.ResetBlackMeshes();


        HashSet <Triangle2> triangles = new HashSet <Triangle2>();

        foreach (MyVector2 p in points)
        {
            MyVector2 point = controller.UnNormalize(p);

            HashSet <Triangle2> circleTriangles = _GenerateMesh.Circle(point, 0.1f, 10);

            triangles.UnionWith(circleTriangles);
        }


        //Will unnormalize
        List <Mesh> meshes = controller.GenerateTriangulationMesh(triangles, shouldUnNormalize: false);

        controller.blackMeshes = meshes;
    }