Exemple #1
0
        //public static void Rotate(this IHas<IQuboidPlaceLogic> place, int direction)
        //{
        //    var left = place.Left;
        //    var back = place.Back;
        //    var length = place.Length;
        //    switch (direction)
        //    {
        //        case 0:
        //            break;
        //        case 1:
        //            place.Back = -left - place.Width;
        //            place.Left = back;
        //            place.Length = place.Width;
        //            place.Width = length;
        //            break;
        //        case 2:
        //            place.Back = -back - place.Length;
        //            place.Left = -left - place.Width;
        //            break;
        //        case 3:
        //            place.Back = left;
        //            place.Left = -back - place.Length;
        //            place.Length = place.Width;
        //            place.Width = length;
        //            break;
        //        default:
        //            break;
        //    }
        //}
        public static void Enclose(this IHas <IQuboidPlaceLogic> quboidplace, IHas <IQuboidPlaceLogic> placeToEnclose)
        {
            double right = quboidplace.Right();
            double front = quboidplace.Front();
            double up    = quboidplace.Up();

            quboidplace.Left(Math.Min(quboidplace.Left(), placeToEnclose.Left()));
            quboidplace.Back(Math.Min(quboidplace.Back(), placeToEnclose.Back()));
            quboidplace.Down(Math.Min(quboidplace.Down(), placeToEnclose.Down()));
            quboidplace.Width(Math.Max(right, placeToEnclose.Right()) - quboidplace.Left());
            quboidplace.Length(Math.Max(front, placeToEnclose.Front()) - quboidplace.Back());
            quboidplace.Height(Math.Max(up, placeToEnclose.Up()) - quboidplace.Down());
        }
Exemple #2
0
 public LWQuboidPlace(IHas <IQuboidPlaceLogic> model)
 {
     //this.TakeSimpleValues<IQuboidPlaceLogic>(model);
     Left   = model.Left();
     Width  = model.Width();
     Back   = model.Back();
     Length = model.Length();
     Down   = model.Down();
     Height = model.Height();
 }
Exemple #3
0
        //public static IQuboidPlace BiggestRest(this IQuboidPlace quboidplace, IQuboidPlace occupiedPlace)
        //{

        //}

        public static bool Intersect(this IHas <IQuboidPlaceLogic> quboidPlace, IHas <IQuboidPlaceLogic> otherQuboidPlace)
        {
            if (
                (quboidPlace.Back() >= otherQuboidPlace.Front()) || (quboidPlace.Front() <= otherQuboidPlace.Back()) ||
                (quboidPlace.Left() >= otherQuboidPlace.Right()) || (quboidPlace.Right() <= otherQuboidPlace.Left()) ||
                (quboidPlace.Down() >= otherQuboidPlace.Up()) || (quboidPlace.Up() <= otherQuboidPlace.Down()))
            {
                return(false);
            }

            return(true);
        }
Exemple #4
0
 public static bool Contains(this IHas <IQuboidPlaceLogic> quboidPlace, IHas <IQuboidPlaceLogic> otherQuboidPlace)
 {
     if (otherQuboidPlace.Back() >= quboidPlace.Back())
     {
         if (otherQuboidPlace.Left() >= quboidPlace.Left())
         {
             if (otherQuboidPlace.Front() <= quboidPlace.Front())
             {
                 if (otherQuboidPlace.Right() <= quboidPlace.Right())
                 {
                     if (otherQuboidPlace.Up() <= quboidPlace.Up())
                     {
                         if (otherQuboidPlace.Down() >= quboidPlace.Down())
                         {
                             return(true);
                         }
                     }
                 }
             }
         }
     }
     return(false);
 }
Exemple #5
0
 public static double GravityHeight(this IHas <IQuboidPlaceLogic> qplace)
 {
     return((qplace.Down() + qplace.Up()) / 2);
 }
Exemple #6
0
 public static void Move(this IHas <IPosition3D> quboidPlace, IHas <IQuboidLogic> offset)
 {
     quboidPlace.Left(quboidPlace.Left() + offset.Width());
     quboidPlace.Back(quboidPlace.Back() + offset.Length());
     quboidPlace.Down(quboidPlace.Down() + offset.Height());
 }
Exemple #7
0
 public static void Move(this IHas <IPosition3D> quboidPlace, double x, double y, double z)
 {
     quboidPlace.Left(quboidPlace.Left() + x);
     quboidPlace.Back(quboidPlace.Back() + y);
     quboidPlace.Down(quboidPlace.Down() + z);
 }
Exemple #8
0
 public static double Up(this IHas <IQuboidPlaceLogic> qplace)
 {
     return(qplace.Down() + qplace.Height());
 }