Exemplo n.º 1
0
        // primary constructor
        public FollowerRobot(float initialX, float initialY, int interval)
            : base(initialX, initialY, INITIAL_ANGLE, ACCEL, interval,
                   MAX_DISTANCE_PER_SECOND, Color.Red, Color.Blue)
        {
            Boundary = new RectangularBoundary(Center, Angle, WIDTH, HEIGHT, Color.Black);

            InitializeFuzzyEngine();
        }
        public void CtorSetWithFourCornerPositions_SetIndexMovementCorretly()
        {
            var boundary = new RectangularBoundary(lt, rt, rb, lb);

            var actual = lt + boundary.IndexMovement;

            var expected = lb;

            Assert.True(Vector3D.Equals(expected.Position, actual.Position));
            Assert.True(Vector3D.Equals(expected.Rotation, actual.Rotation));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Set the initial layout state such that our current margin is stored and the new margin is taken from the given rb
 /// </summary>
 public void SetInitialLayoutState(RectangularClusterBoundary bounds)
 {
     isInInitialLayoutState = true;
     if (RectangularBoundary != null && bounds != null)
     {
         RectangularBoundary.StoreDefaultMargin();
         RectangularBoundary.LeftMargin   = bounds.LeftMargin;
         RectangularBoundary.RightMargin  = bounds.RightMargin;
         RectangularBoundary.BottomMargin = bounds.BottomMargin;
         RectangularBoundary.TopMargin    = bounds.TopMargin;
     }
 }
Exemplo n.º 4
0
 // URscript control
 private void Generate_Click(object sender, RoutedEventArgs e)
 {
     if ((point1 != null) && (point2 != null) && (point3 != null))
     {
         var    scanmove = new URMovement(point1, point2);
         var    boundary = new RectangularBoundary(scanmove, point3);
         double aperture = 0.06;
         double overlap  = 0.1;
         var    urMoves  = PathPlanner.SStyle(boundary, aperture, overlap);
         var    safeDist = new URVector(new Vector3D(0, 0, 0.02), new Vector3D(0, 0, 0));
         URScriptTextBox.Text = URScript.Generate("cscan", urMoves, safeDist);
     }
 }
Exemplo n.º 5
0
        public PathPlannerTests()
        {
            Point3D rotation = new Point3D(-0.5, 0, 1);
            var     lt       = new URPose(new Point3D(-1, +1, 0), rotation);
            var     rt       = new URPose(new Point3D(+1, +1, 0), rotation);
            var     lb       = new URPose(new Point3D(-1, -1, 0), rotation);
            var     rb       = new URPose(new Point3D(+1, -1, 0), rotation);

            Boundary = new RectangularBoundary(lt, rt, rb, lb);

            BrushThickness = 0.5;

            Overlay = 0.2;
        }
Exemplo n.º 6
0
 /// <summary>
 ///     Calculate cluster's RectangularBoundary to preserve the offsets calculated in initial layout, for example,
 ///     to allow for extra space required for non-shortest path edge routes or for labels.
 /// </summary>
 /// <param name="padding">amount of padding between child node bounding box and expected inner bounds</param>
 internal void SetInitialLayoutState(double padding)
 {
     isInInitialLayoutState = true;
     if (RectangularBoundary != null)
     {
         RectangularBoundary.StoreDefaultMargin();
         var childBounds =
             new Rectangle(from v in Nodes.Concat(Clusters) select v.BoundingBox);
         childBounds.Pad(padding);
         RectangularBoundary.LeftMargin   = childBounds.Left - RectangularBoundary.Rect.Left;
         RectangularBoundary.RightMargin  = RectangularBoundary.Rect.Right - childBounds.Right;
         RectangularBoundary.BottomMargin = childBounds.Bottom - RectangularBoundary.Rect.Bottom;
         RectangularBoundary.TopMargin    = RectangularBoundary.Rect.Top - childBounds.Top;
     }
 }
        public void CtorSetWithScanMovement_SetScanMovementCorretly()
        {
            var scanMove = new URMovement(lt, rt);
            var point    = new Point3D(-0.5, -1, 0);
            var pose     = new URPose(point, rotation);

            var boundary = new RectangularBoundary(scanMove, pose);

            var actual = lt + boundary.ScanMovement;

            var expected = rt;

            Assert.True(Vector3D.Equals(expected.Position, actual.Position));
            Assert.True(Vector3D.Equals(expected.Rotation, actual.Rotation));
        }
        public void CtorSetWithFourCornerPositions_SetCornerPositionsCorretly()
        {
            var boundary = new RectangularBoundary(lt, rt, rb, lb);

            Assert.True(Vector3D.Equals(boundary.LeftTop.Position, lt.Position));
            Assert.True(Vector3D.Equals(boundary.LeftTop.Rotation, lt.Rotation));

            Assert.True(Vector3D.Equals(boundary.RightTop.Position, rt.Position));
            Assert.True(Vector3D.Equals(boundary.RightTop.Rotation, rt.Rotation));

            Assert.True(Vector3D.Equals(boundary.RightBottom.Position, rb.Position));
            Assert.True(Vector3D.Equals(boundary.RightBottom.Rotation, rb.Rotation));

            Assert.True(Vector3D.Equals(boundary.LeftBottom.Position, lb.Position));
            Assert.True(Vector3D.Equals(boundary.LeftBottom.Rotation, lb.Rotation));
        }
        public void CtorSetWithScanMovement_SetCornerPositionsCorretly()
        {
            var scanMove = new URMovement(lt, rt);
            var point    = new Point3D(-0.5, -1, 0);
            var pose     = new URPose(point, rotation);

            var boundary = new RectangularBoundary(scanMove, pose);

            Assert.True(Vector3D.Equals(boundary.LeftTop.Position, lt.Position));
            Assert.True(Vector3D.Equals(boundary.LeftTop.Rotation, lt.Rotation));

            Assert.True(Vector3D.Equals(boundary.RightTop.Position, rt.Position));
            Assert.True(Vector3D.Equals(boundary.RightTop.Rotation, rt.Rotation));

            Assert.Equal(rb.Position.X, boundary.RightBottom.Position.X, precision);
            Assert.Equal(rb.Position.Y, boundary.RightBottom.Position.Y, precision);
            Assert.Equal(rb.Position.Z, boundary.RightBottom.Position.Z, precision);
            Assert.True(Vector3D.Equals(boundary.RightBottom.Rotation, rb.Rotation));

            Assert.Equal(lb.Position.X, boundary.LeftBottom.Position.X, precision);
            Assert.Equal(lb.Position.Y, boundary.LeftBottom.Position.Y, precision);
            Assert.Equal(lb.Position.Z, boundary.LeftBottom.Position.Z, precision);
            Assert.True(Vector3D.Equals(boundary.LeftBottom.Rotation, lb.Rotation));
        }
Exemplo n.º 10
0
 /// <summary>
 ///     Translates the cluster and all of it's contents by the delta.
 /// </summary>
 internal void DeepTranslation(Point delta, bool translateEdges)
 {
     DeepContentsTranslation(delta, translateEdges);
     RectangularBoundary.TranslateRectangle(delta);
     Center += delta;
 }