public async Task CreateVirtualAnchorWithNoAnchorSetThrowsException()
 {
     AnchorSetService anchorSetService = new AnchorSetService(new TestDatabaseHandler <AnchorSet>());
     AnchorSet        anchorSet        = await anchorSetService.CreateVirtualAnchor("anchorSetId", "anchorId");
 }
 public AnchorSetResult(AnchorSet anchorSet)
 {
     Id              = anchorSet.Id;
     Name            = anchorSet.Name;
     NumberOfAnchors = anchorSet.Anchors?.Count ?? 0;
 }
示例#3
0
    void DrawSurface(Vector3 handPosition)
    {
        if (SurfaceDrawn)
        {
            return;
        }

        AlignmentCircle.sprite = null;

        TimerCircle.sprite = null;

        if (Anchors.Count < 1)
        {
            Anchors.Add(handPosition);
        }
        else if ((handPosition - Anchors[Anchors.Count - 1]).sqrMagnitude > AnchorOffset * AnchorOffset)
        {
            Anchors.Add(handPosition);
        }

        SurfacePath.positionCount = Anchors.Count;

        SurfacePath.SetPositions(Anchors.ToArray());

        if (Anchors.Count >= AnchorSetNumber * 3)
        {
            /*
             * for (int i = 0; i < AnchorSetNumber; i++)
             * {
             *  // instead, divide anchors into thirds, group of anchor 1s, anchor 2s, and anchor 3s
             *  AnchorSets.Add(new AnchorSet(Anchors[i*3], Anchors[1*3+1], Anchors[i*3+2]));
             *
             * }
             */
            List <Vector3> firstAnchors = new List <Vector3>();

            List <Vector3> secondAnchors = new List <Vector3>();

            List <Vector3> thirdAnchors = new List <Vector3>();

            for (int i = 0; i < Anchors.Count; i++)
            {
                if (i < AnchorSetNumber)
                {
                    firstAnchors.Add(Anchors[i]);
                }
                else if (i < AnchorSetNumber * 2)
                {
                    secondAnchors.Add(Anchors[i]);
                }
                else
                {
                    thirdAnchors.Add(Anchors[i]);
                }
            }

            for (int i = 0; i < AnchorSetNumber; i++)
            {
                // instead, divide anchors into thirds, group of anchor 1s, anchor 2s, and anchor 3s
                AnchorSet newAnchorSet = new AnchorSet(firstAnchors[i], secondAnchors[i], thirdAnchors[i]);

                newAnchorSet.circumcenter = GetAnchorSetCircumcenter(newAnchorSet);

                AnchorSets.Add(newAnchorSet);
            }

            // reduce down anchor sets to half to remove anomalies
            // each loop the "least average" anchor set is removed, which creates a newer, refined average

            //RefineAnchorSets();


            SetBagPosition();

            SurfaceDrawn = true;

            // play confirmation sound

            Debug.Log("anchors count \n" + "first: " + firstAnchors.Count + "\n" + "second: " + secondAnchors.Count + "\n" + "third: " + thirdAnchors.Count);
        }
    }