private void OnTimerTick(object sender, EventArgs e)
        {
            if (-1 == SelectedIndex)
            {
                return;
            }
            BoxPosition bpos    = Layer.Positions[SelectedIndex];
            BoxPosition bposNew = bpos.Translate(MoveDir, StepMove);

            if (!BoxInteraction.HaveIntersection(Layer.Positions, Dimensions, SelectedIndex, bposNew) &&
                BoxInteraction.BoxCanMoveInside(Layer.Positions[SelectedIndex], Dimensions, PtMin, PtMax, MoveDir))
            {
                Layer.Positions[SelectedIndex] = bposNew;
            }

            else
            {
                double distance = 0;
                if (BoxInteraction.MinDistance(Layer.Positions, Dimensions, SelectedIndex, MoveDir, ref distance))
                {
                    bposNew = bpos.Translate(MoveDir, distance);
                    Layer.Positions[SelectedIndex] = bposNew;
                }
                EndMove();
            }
            CountMove++;

            UpdateArrows();
            Invalidate();
        }
Example #2
0
        public void Move(HalfAxis.HAxis moveDir, double stepMove)
        {
            // sanity check
            if (!IsSelectionValid)
            {
                return;
            }
            // update position
            BoxPosition bpos    = Positions[SelectedIndex];
            BoxPosition bposNew = bpos.Translate(moveDir, stepMove);

            if (!BoxInteraction.HaveIntersection(Positions, DimCase, SelectedIndex, bposNew) &&
                BoxInteraction.BoxCanMoveInside(Positions[SelectedIndex], DimCase, PtMin, PtMax, moveDir))
            {
                Positions[SelectedIndex] = bposNew;
            }
            else
            {
                double distance = 0;
                if (BoxInteraction.MinDistance(Positions, DimCase, SelectedIndex, moveDir, ref distance))
                {
                    bposNew = bpos.Translate(moveDir, distance);
                    Positions[SelectedIndex] = bposNew;
                }
            }
        }
Example #3
0
        public void MoveMax(HalfAxis.HAxis moveDir)
        {
            // sanity check
            if (!IsSelectionValid)
            {
                return;
            }
            // update position
            BoxPosition bpos     = Positions[SelectedIndex];
            double      distance = 0;

            if (BoxInteraction.MinDistance(Positions, DimCase, SelectedIndex, moveDir, ref distance))
            {
            }
            if (distance > 0)
            {
                Positions[SelectedIndex] = bpos.Translate(moveDir, distance);
            }
            ;
        }
Example #4
0
 public void ApplyElong(double d)
 {
     Dimensions += new Vector3D(d, d, d);
     BoxPosition = BoxPosition.Translate(-new Vector3D(-0.5 * d, -0.5 * d, -0.5 * d));
 }