示例#1
0
    public float ChanceOf(SymmetryDirection3D direction)
    {
        switch (direction)
        {
        case SymmetryDirection3D.TopLeftToBottomRight: return(topLeftToBottomRightChance);

        case SymmetryDirection3D.FrontBottomToTopBack: return(frontBottomToTopBackChance);

        case SymmetryDirection3D.BottomLeftToTopRight: return(bottomLeftToTopRightChance);

        case SymmetryDirection3D.FrontTopToBottomBack: return(frontTopToBottomBackChance);

        case SymmetryDirection3D.FrontRightToBackLeft: return(frontRightToBackLeftChance);

        case SymmetryDirection3D.FrontLeftToBackRight: return(frontLeftToBackRightChance);

        case SymmetryDirection3D.FrontCenterToBackCenterVertical: return(frontCenterToBackCenterVerticalChance);

        case SymmetryDirection3D.FrontCenterToBackCenterHorizontal: return(frontCenterToBackCenterHorizontalChance);

        case SymmetryDirection3D.MiddleTopToMiddleBottomVertical: return(middleTopToMiddleBottomChance);

        default: return(0);
        }
    }
示例#2
0
    public float ChanceOf(SymmetryDirection3D direction)
    {
        switch (direction)
        {
        case SymmetryDirection3D.EastTopToWestBottom: return(eastTopToWestBottomChance);

        case SymmetryDirection3D.SouthBottomToNorthTop: return(southBottomToNorthTopChance);

        case SymmetryDirection3D.WestBottomToEastTop: return(westBottomToEastTopChance);

        case SymmetryDirection3D.SouthTopToNorthBottom: return(southTopToNorthBottomChance);

        case SymmetryDirection3D.SouthEastCenterToNorthWestCenter: return(southEastCenterToNorthWestCenterChance);

        case SymmetryDirection3D.SouthWestCenterToNorthEastCenter: return(southWestCenterToNorthEastCenterChance);

        case SymmetryDirection3D.SouthCenterToNorthCenterVertical: return(southCenterToNorthCenterVerticalChance);

        case SymmetryDirection3D.SouthCenterToNorthCenterHorizontal: return(southCenterToNorthCenterHorizontalChance);

        case SymmetryDirection3D.CenterUpToCenterDown: return(centerUpToCenterDownChance);

        default: return(0);
        }
    }
示例#3
0
    static void SetSymmetricalVoxel(
        Texture3D texture, SymmetryDirection3D direction, int x, int y, int z, int halfX, int halfY, int halfZ)
    {
        Vector3Int readCoordinates;

        switch (direction)
        {
        case SymmetryDirection3D.EastTopToWestBottom:
            readCoordinates = new Vector3Int(texture.width - y - 1, texture.height - x - 1, z);
            break;

        case SymmetryDirection3D.SouthBottomToNorthTop:
            readCoordinates = new Vector3Int(x, z, y);
            break;

        case SymmetryDirection3D.WestBottomToEastTop:
            readCoordinates = new Vector3Int(y, x, z);
            break;

        case SymmetryDirection3D.SouthTopToNorthBottom:
            readCoordinates = new Vector3Int(x, texture.height - z - 1, texture.depth - y - 1);
            break;

        case SymmetryDirection3D.SouthEastCenterToNorthWestCenter:
            readCoordinates = new Vector3Int(texture.width - z - 1, y, texture.depth - x - 1);
            break;

        case SymmetryDirection3D.SouthWestCenterToNorthEastCenter:
            readCoordinates = new Vector3Int(z, y, x);
            break;

        case SymmetryDirection3D.SouthCenterToNorthCenterVertical:
            readCoordinates = new Vector3Int(halfY - (x - halfY) - 1, y, z);
            break;

        case SymmetryDirection3D.SouthCenterToNorthCenterHorizontal:
            readCoordinates = new Vector3Int(x, halfY - (y + 1 - halfY), z);
            break;

        case SymmetryDirection3D.CenterUpToCenterDown:
            readCoordinates = new Vector3Int(x, y, halfZ - (z + 1 - halfZ));
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(direction), direction, null);
        }

        texture.SetPixel(x, y, z, texture.GetPixel(readCoordinates.x, readCoordinates.y, readCoordinates.z));
    }
示例#4
0
    static void SetSymmetricalVoxel(
        Texture3D texture, SymmetryDirection3D direction, int x, int y, int z, int halfwayPoint)
    {
        var readCoordinates = new Vector3Int();

        switch (direction)
        {
        case SymmetryDirection3D.TopLeftToBottomRight:
            readCoordinates = new Vector3Int(texture.height - y + 1, texture.width - x + 1, z);
            break;

        case SymmetryDirection3D.FrontBottomToTopBack:
            break;

        case SymmetryDirection3D.BottomLeftToTopRight:
            readCoordinates = new Vector3Int(y, x, z);
            break;

        case SymmetryDirection3D.FrontTopToBottomBack:
            break;

        case SymmetryDirection3D.FrontRightToBackLeft:
            break;

        case SymmetryDirection3D.FrontLeftToBackRight:
            break;

        case SymmetryDirection3D.FrontCenterToBackCenterVertical:
            readCoordinates = new Vector3Int(halfwayPoint - (x + 1 - halfwayPoint), y, z);
            break;

        case SymmetryDirection3D.FrontCenterToBackCenterHorizontal:
            readCoordinates = new Vector3Int(x, halfwayPoint - (y + 1 - halfwayPoint), z);
            break;

        case SymmetryDirection3D.MiddleTopToMiddleBottomVertical:
            readCoordinates = new Vector3Int(x, y, halfwayPoint - (z + 1 - halfwayPoint));
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(direction), direction, null);
        }

        texture.SetPixel(x, y, z, texture.GetPixel(readCoordinates.x, readCoordinates.y, readCoordinates.z));
    }
示例#5
0
    void ApplySymmetry(ref Texture3D texture, SymmetryDirection3D direction, SymmetryOutcome3D symmetryOutcome)
    {
        var halfX       = texture.width / 2;
        var halfY       = texture.height / 2;
        var halfZ       = texture.depth / 2;
        var lowDominant = true;// symmetryOutcome.lowerIsDominant;

        for (var x = 0; x < texture.width; x++)
        {
            for (var z = 0; z < texture.depth; z++)
            {
                for (var y = 0; y < texture.height; y++)
                {
                    var setSymmetrical = false;
                    switch (direction)
                    {
                    case SymmetryDirection3D.EastTopToWestBottom:
                        if (CompareTo(x, texture.height - y - 1, lowDominant))
                        {
                            setSymmetrical = true;
                        }
                        break;

                    case SymmetryDirection3D.SouthBottomToNorthTop:
                        if (CompareTo(z, x, lowDominant))
                        {
                            setSymmetrical = true;
                        }
                        break;

                    case SymmetryDirection3D.WestBottomToEastTop:
                        if (CompareTo(x, y, lowDominant))
                        {
                            setSymmetrical = true;
                        }
                        break;

                    case SymmetryDirection3D.SouthTopToNorthBottom:
                        if (CompareTo(z, texture.width - x - 1, lowDominant))
                        {
                            setSymmetrical = true;
                        }
                        break;

                    case SymmetryDirection3D.SouthEastCenterToNorthWestCenter:
                        if (CompareTo(z, texture.height - y - 1, lowDominant))
                        {
                            setSymmetrical = true;
                        }
                        break;

                    case SymmetryDirection3D.SouthWestCenterToNorthEastCenter:
                        if (CompareTo(z, y, lowDominant))
                        {
                            setSymmetrical = true;
                        }
                        break;

                    case SymmetryDirection3D.SouthCenterToNorthCenterVertical:
                        if (CompareTo(y, halfY - 1, lowDominant))
                        {
                            setSymmetrical = true;
                        }
                        break;

                    case SymmetryDirection3D.SouthCenterToNorthCenterHorizontal:
                        if (CompareTo(x, halfX - 1, lowDominant))
                        {
                            setSymmetrical = true;
                        }
                        break;

                    case SymmetryDirection3D.CenterUpToCenterDown:
                        if (CompareTo(z, halfZ - 1, lowDominant))
                        {
                            setSymmetrical = true;
                        }
                        break;
                    }

                    if (setSymmetrical)
                    {
                        SetSymmetricalVoxel(texture, direction, y, x, z, halfX, halfY, halfZ);
                    }
                }
            }
        }
    }
示例#6
0
    void ApplySymmetry(ref Texture3D texture, SymmetryDirection3D direction, SymmetryOutcome3D symmetryOutcome)
    {
        var halfwayPoint = texture.width / 2;
        var lowDominant  = symmetryOutcome.lowerIsDominant;

        for (var x = 0; x < texture.height; x++)
        {
            for (var z = 0; z < texture.depth; z++)
            {
                for (var y = 0; y < texture.width; y++)
                {
                    switch (direction)
                    {
                    //case SymmetryDirection.Horizontal:
                    //    referenceValue = symmetryOutcome.quarterHorizontalSymmetryResult ? columnIndex : rowIndex;
                    //    if ((symmetryOutcome.lowerIsDominant && referenceValue >= halfwayPoint - 1) ||
                    //        (!symmetryOutcome.lowerIsDominant && referenceValue <= halfwayPoint + 1))
                    //        SetSymmetricalVoxel(texture, direction, columnIndex, rowIndex, depthIndex, halfwayPoint);
                    //    break;
                    //case SymmetryDirection.Vertical:
                    //    referenceValue = symmetryOutcome.quarterVerticalSymmetryResult ? rowIndex : columnIndex;
                    //    if ((symmetryOutcome.lowerIsDominant && referenceValue >= halfwayPoint - 1) ||
                    //        (!symmetryOutcome.lowerIsDominant && referenceValue <= halfwayPoint + 1))
                    //        SetSymmetricalVoxel(texture, direction, columnIndex, rowIndex, depthIndex, halfwayPoint);
                    //    break;
                    //case SymmetryDirection.ForwardDiagonal:
                    //    if (symmetryOutcome.quarterForwardDiagonalSymmetryResult) {
                    //        if (symmetryOutcome.lowerIsDominant && columnIndex > rowIndex ||
                    //            !symmetryOutcome.lowerIsDominant && columnIndex < rowIndex)
                    //            texture.SetPixel(columnIndex, rowIndex, depthIndex,
                    //                texture.GetPixel(
                    //                    texture.width - rowIndex,
                    //                    texture.width - columnIndex,
                    //                    texture.depth - depthIndex));
                    //    } else {
                    //        if (symmetryOutcome.lowerIsDominant && rowIndex < texture.width - columnIndex ||
                    //            !symmetryOutcome.lowerIsDominant && rowIndex > texture.width - columnIndex)
                    //            texture.SetPixel(columnIndex, rowIndex, depthIndex,
                    //                texture.GetPixel(
                    //                    texture.width - rowIndex,
                    //                    texture.width - columnIndex,
                    //                    texture.depth - depthIndex));
                    //    }
                    //
                    //    break;
                    //case SymmetryDirection.BackwardDiagonal:
                    //    if (symmetryOutcome.quarterBackwardDiagonalSymmetryResult) {
                    //        if (symmetryOutcome.lowerIsDominant && rowIndex < texture.width - columnIndex ||
                    //            !symmetryOutcome.lowerIsDominant && rowIndex > texture.width - columnIndex)
                    //            texture.SetPixel(columnIndex, rowIndex, depthIndex,
                    //                texture.GetPixel(rowIndex, columnIndex, depthIndex));
                    //    } else if (symmetryOutcome.lowerIsDominant && columnIndex > rowIndex ||
                    //               !symmetryOutcome.lowerIsDominant && columnIndex < rowIndex)
                    //        texture.SetPixel(columnIndex, rowIndex, depthIndex,
                    //            texture.GetPixel(rowIndex, columnIndex, depthIndex));
//
                    //    break;
                    case SymmetryDirection3D.TopLeftToBottomRight:
                        if (x < y)  //(lowDominant && x < y || !lowDominant && x > y)
                        {
                            SetSymmetricalVoxel(texture, direction, y, x, z, halfwayPoint);
                        }
                        break;

                    case SymmetryDirection3D.FrontBottomToTopBack:
                        break;

                    case SymmetryDirection3D.BottomLeftToTopRight:
                        if (lowDominant && x > y || !lowDominant && x < y)
                        {
                            SetSymmetricalVoxel(texture, direction, y, x, z, halfwayPoint);
                        }
                        break;

                    case SymmetryDirection3D.FrontTopToBottomBack:
                        break;

                    case SymmetryDirection3D.FrontRightToBackLeft:
                        break;

                    case SymmetryDirection3D.FrontLeftToBackRight:
                        break;

                    case SymmetryDirection3D.FrontCenterToBackCenterVertical:
                        if (lowDominant && y > halfwayPoint || !lowDominant && y < halfwayPoint)
                        {
                            SetSymmetricalVoxel(texture, direction, y, x, z, halfwayPoint);
                        }
                        break;

                    case SymmetryDirection3D.FrontCenterToBackCenterHorizontal:
                        if (lowDominant && x > halfwayPoint || !lowDominant && x < halfwayPoint)
                        {
                            SetSymmetricalVoxel(texture, direction, y, x, z, halfwayPoint);
                        }
                        break;

                    case SymmetryDirection3D.MiddleTopToMiddleBottomVertical:
                        if (lowDominant && z > halfwayPoint || !lowDominant && z < halfwayPoint)
                        {
                            SetSymmetricalVoxel(texture, direction, y, x, z, halfwayPoint);
                        }
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(direction), direction, null);
                    }
                }
            }
        }
    }