예제 #1
0
    /// <summary>
    /// Calculate the triangulation for final mesh from entropy data
    /// </summary>
    void CalculateTriangulationFromEntropy(int width, int height)
    {
        //High detail points from entropy
        List <Vector2> imageDetailPoints = ImageDelaunay.GenerateImageDetailPointsFromEntropy(width, height, _storedEntropy, _pointAmount, _influenceLength, _influenceStrength);
        //Border around these ^ points
        List <Vector2> border = ImageDelaunay.GenerateBorderPoints(_amountBorderPoints, width, height);

        imageDetailPoints.AddRange(border);

        //Create triangulation from these points
        Vector2 textureBounds = new Vector2(width, height);

        _triangulation = DelaunayTriangulationGenerator.GenerateDelaunayTriangulationWithPoints(imageDetailPoints, textureBounds);
    }
예제 #2
0
    private void DrawSuperTriangle()
    {
        Gizmos.color = _superTriangleColors;

        Gizmos.DrawLine(Vector2.zero, Vector2.up * _bounds.y);
        Gizmos.DrawLine(Vector2.zero, Vector2.right * _bounds.x);
        Gizmos.DrawLine(Vector2.right * _bounds.x, Vector2.one * _bounds);
        Gizmos.DrawLine(Vector2.up * _bounds.y, Vector2.one * _bounds);

        Triangle superTriangle = DelaunayTriangulationGenerator.GenerateSuperTriangle(_bounds);

        Gizmos.DrawLine(superTriangle.A, superTriangle.B);
        Gizmos.DrawLine(superTriangle.B, superTriangle.C);
        Gizmos.DrawLine(superTriangle.C, superTriangle.A);
    }