Exemplo n.º 1
0
            public void Recalculate(NodeControlSceneData nodeI, NodeControlSceneData nodeJ)
            {
                box_i.X      = nodeI.Left;
                box_i.Y      = nodeI.Top;
                box_i.Width  = nodeI.Width;
                box_i.Height = nodeI.Height;
                box_j.X      = nodeJ.Left;
                box_j.Y      = nodeJ.Top;
                box_j.Width  = nodeJ.Width;
                box_j.Height = nodeJ.Height;

                box_distance   = BoxDistance.CalculateDistanceBetweenTwoBoxes(box_i, box_j);
                minimum_extent = Math.Min(Math.Min(nodeI.Width, nodeI.Height), Math.Min(nodeJ.Width, nodeJ.Height));

                delta_x = nodeI.CentreX - nodeJ.CentreX;
                delta_y = nodeI.CentreY - nodeJ.CentreY;

                distance = Math.Sqrt(delta_x * delta_x + delta_y * delta_y);
                if (1 > distance)
                {
                    distance = 1;
                }

                angle = Math.Atan2(delta_y, delta_x);

                unit_x = Math.Cos(angle);
                unit_y = Math.Sin(angle);
            }
Exemplo n.º 2
0
            public void Recalculate(NodeControlSceneData nodeI, NodeControlSceneData nodeJ)
            {
                box_i.X      = nodeI.Left;
                box_i.Y      = nodeI.Top;
                box_i.Width  = nodeI.Width;
                box_i.Height = nodeI.Height;
                box_j.X      = nodeJ.Left;
                box_j.Y      = nodeJ.Top;
                box_j.Width  = nodeJ.Width;
                box_j.Height = nodeJ.Height;

                box_distance = BoxDistance.CalculateDistanceBetweenTwoBoxes(box_i, box_j);

#if UNUSED_CODE
                // Utilities codebase had:
                // (https://github.com/jimmejardine/qiqqa-open-source/issues/26)
                minimum_extent = Math.Min(Math.Min(nodeI.Width, nodeI.Height), Math.Min(nodeJ.Width, nodeJ.Height));
#else
                // Qiqqa codebase had:
                //
                //Logging.Debug(" DIST {0}", box_distance);
                maximum_extent = Math.Max(Math.Max(nodeI.Width, nodeI.Height), Math.Max(nodeJ.Width, nodeJ.Height));
                //minimum_extent = Math.Min(Math.Min(nodeI.Width, nodeI.Height), Math.Min(nodeJ.Width, nodeJ.Height));
#endif

                delta_x = nodeI.CentreX - nodeJ.CentreX;
                delta_y = nodeI.CentreY - nodeJ.CentreY;

                distance = Math.Sqrt(delta_x * delta_x + delta_y * delta_y);
                if (1 > distance)
                {
                    distance = 1;
                }

                angle = Math.Atan2(delta_y, delta_x);

                unit_x = Math.Cos(angle);
                unit_y = Math.Sin(angle);
            }
Exemplo n.º 3
0
 private void Start()
 {
     boxDistance = GetComponent <BoxDistance>();
     box         = null;
 }