Ejemplo n.º 1
0
    public QRCode(QRDimensionBridge main, PixelGrouper pixelGrouper, QRSquare square)
    {
        this.main         = main;
        this.pixelGrouper = pixelGrouper;

        this.squares = new List <QRSquare>();
        this.squares.Add(square);
    }
Ejemplo n.º 2
0
    public QRSquare[] QRSquares()
    {
        QRSquare[] qrList = new QRSquare[this.qrSquares.Count];
        for (int i = 0; i < qrList.Length; i++)
        {
            qrList[i] = this.qrSquares[i];
        }

        return(qrList);
    }
Ejemplo n.º 3
0
    public void ScanSurrounding(QRSquare square, QRSkeleton qRSkeleton)
    {
        float distance = qRSkeleton.GetSquareDistanceFromSize(square.WorldPointSize);
        float lienance = distance * 2;

        //if(!Debug.locations.ContainsKey(square.GetScreenSquareCenter()))
        //Debug.locations.Add(square.GetScreenSquareCenter(), distance + lienance);

        foreach (QRSquare qrSquare in this.pixelGrouper.QRSquares())
        {
            if (qrSquare.QRCode != null)
            {
                continue;
            }

            float currentDistance = Vector3.Distance(qrSquare.GetScreenSquareCenter(), square.GetScreenSquareCenter());

            if (currentDistance >= distance - lienance && currentDistance <= distance + lienance)
            {
                qrSquare.QRCode = this;
                squares.Add(qrSquare);

                if (distance + lienance > size)
                {
                    size = distance + lienance;
                }

                Vector3 top    = squares[0].GetScreenSquareCenter();
                Vector3 bottom = squares[0].GetScreenSquareCenter();

                foreach (QRSquare corner in squares)
                {
                    if (Vector2.Distance(corner.GetScreenSquareCenter(), top) > Vector3.Distance(bottom, top))
                    {
                        bottom = corner.GetScreenSquareCenter();
                    }
                }

                this.position = top + new Vector3(0, 0, Vector3.Distance(bottom, top) / 2);
            }
        }
    }
Ejemplo n.º 4
0
    public QRSquare GetQRSquare(PixelSquare pixelSquare)
    {
        QRSquare square = new QRSquare(map, pixelSquare.Corners);

        return(square);
    }