//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()); }
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(); }
public static bool Intersect2D(this IHas <IQuboidPlaceLogic> quboidPlace, IHas <IQuboidPlaceLogic> otherQuboidPlace) { if ( (quboidPlace.Back() >= otherQuboidPlace.Front()) || (quboidPlace.Front() <= otherQuboidPlace.Back()) || (quboidPlace.Left() >= otherQuboidPlace.Right()) || (quboidPlace.Right() <= otherQuboidPlace.Left()) ) { return(false); } return(true); }
public static bool IsInside(this IHas <IQuboidPlaceLogic> quboidPlace, IHas <IQuboidPlaceLogic> otherQuboidPlace) { if (otherQuboidPlace.Back() <= quboidPlace.Back()) { if (otherQuboidPlace.Front() >= quboidPlace.Front()) { if (otherQuboidPlace.Left() <= quboidPlace.Left()) { if (otherQuboidPlace.Right() >= quboidPlace.Right()) { return(true); } } } } return(false); }
//public static void Init(this IHas<IQuboidPlaceLogic> quboidplace, IHas<IPlaceLogic> place, IHas<IPackageLogic> package, bool alignLeft) //{ // if (alignLeft) // { // quboidplace.Left(place.Left()); // } // else // { // quboidplace.Left(place.Right() - package.Logic.Width()); // } // quboidplace.Back(place.Back()); // quboidplace.Down(place.Down()); // quboidplace.Length(package.Logic.Length()); // quboidplace.Height(package.Logic.Height()); // quboidplace.Width(package.Logic.Width()); //} public static double GravityLength(this IHas <IQuboidPlaceLogic> qplace) { return((qplace.Back() + qplace.Front()) / 2); }
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()); }
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); }
public static double Front(this IHas <IQuboidPlaceLogic> qplace) { return(qplace.Back() + qplace.Length()); }