Exemple #1
0
        //public static IHas<IQuboidLogic> ScaleCopy(this IHas<IQuboidLogic> quboid, double x, double y, double z)
        //{
        //    if (x < 0 || y < 0 || z < 0)
        //        throw new ArgumentException("Negative scaling not allowed.");

        //    var qplace = new LWQuboid();
        //    qplace.Width(quboid.Width() * x);
        //    qplace.Length(quboid.Length() * y);
        //    qplace.Height(quboid.Height() * z);

        //    return qplace;
        //}
        //public static LWQuboid ScaleCopy(this IHas<IQuboidLogic> quboid, double factor)
        //{
        //    if (factor < 0)
        //        throw new ArgumentException("Negative scaling not allowed.");

        //    LWQuboid qplace = new LWQuboid();
        //    qplace.Width(quboid.Width() * factor);
        //    qplace.Length(quboid.Length() * factor);
        //    qplace.Height(quboid.Height() * factor);

        //    return qplace;
        //}
        public static void Scale(this IHas <IQuboidLogic> quboid, double factor)
        {
            if (factor < 0)
            {
                throw new ArgumentException("Negative scaling not allowed.");
            }

            quboid.Width(quboid.Width() * factor);
            quboid.Length(quboid.Length() * factor);
            quboid.Height(quboid.Height() * factor);
        }
Exemple #2
0
        public static void Scale(this IHas <IQuboidLogic> quboid, double x, double y, double z)
        {
            if (x < 0 || y < 0 || z < 0)
            {
                throw new ArgumentException("Negative scaling not allowed.");
            }

            quboid.Width(quboid.Width() * x);
            quboid.Length(quboid.Length() * y);
            quboid.Height(quboid.Height() * z);
        }
Exemple #3
0
 public static double Space(this IHas <IQuboidLogic> quboid)
 {
     if (quboid == null)
     {
         return(0.0);
     }
     return(quboid.Length() * quboid.Width() * quboid.Height());
 }
Exemple #4
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 #5
0
 public static bool Contains(this IHas <IQuboidLogic> quboid, IHas <IQuboidLogic> other)
 {
     if (quboid.Length() >= other.Length() &&
         quboid.Width() >= other.Width() &&
         quboid.Height() >= other.Height())
     {
         return(true);
     }
     return(false);
 }
Exemple #6
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 #7
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 #8
0
 public static double Up(this IHas <IQuboidPlaceLogic> qplace)
 {
     return(qplace.Down() + qplace.Height());
 }
Exemple #9
0
 public static string DimensionToString(this IHas <IQuboidLogic> quboid)
 {
     return("(" + Math.Round(quboid.Length(), 2) + "x" + Math.Round(quboid.Width(), 2) + "x" + Math.Round(quboid.Height(), 2) + ")");
 }