private BBox3D ComputeLoadBBox3D() { BBox3D bbox = new BBox3D(); bool hasInterlayer = false; double zInterlayer = 0.0; Layer3DBox layer0 = GetBoxLayer(0, ref hasInterlayer, ref zInterlayer); bbox.Extend(layer0.BoundingBox(Analysis.PackProperties)); Layer3DBox layerN = GetBoxLayer(LayerCount - 1, ref hasInterlayer, ref zInterlayer); bbox.Extend(layerN.BoundingBox(Analysis.PackProperties)); return(bbox); }
public BBox3D BoundingBox(Packable packable) { BBox3D bbox = new BBox3D(); if (packable is PackableBrick packableBrick) { Vector3D dimensions = packableBrick.OuterDimensions; foreach (BoxPosition bpos in this) { Vector3D[] pts = new Vector3D[8]; Vector3D vI = HalfAxis.ToVector3D(bpos.DirectionLength); Vector3D vJ = HalfAxis.ToVector3D(bpos.DirectionWidth); Vector3D vK = Vector3D.CrossProduct(vI, vJ); pts[0] = bpos.Position; pts[1] = bpos.Position + dimensions.X * vI; pts[2] = bpos.Position + dimensions.Y * vJ; pts[3] = bpos.Position + dimensions.X * vI + dimensions.Y * vJ; pts[4] = bpos.Position + dimensions.Z * vK; pts[5] = bpos.Position + dimensions.Y * vJ + dimensions.Z * vK; pts[6] = bpos.Position + HalfAxis.ToVector3D(bpos.DirectionWidth) * dimensions.Y; pts[7] = bpos.Position + HalfAxis.ToVector3D(bpos.DirectionLength) * dimensions.X + HalfAxis.ToVector3D(bpos.DirectionWidth) * dimensions.Y; foreach (Vector3D pt in pts) { bbox.Extend(pt); } } } return(bbox); }
public BBox3D BoundingBox(PackProperties packProperties) { BBox3D bbox = new BBox3D(); foreach (BoxPosition bpos in this) { Vector3D[] pts = new Vector3D[8]; Vector3D vI = HalfAxis.ToVector3D(bpos.DirectionLength); Vector3D vJ = HalfAxis.ToVector3D(bpos.DirectionWidth); Vector3D vK = Vector3D.CrossProduct(vI, vJ); pts[0] = bpos.Position; pts[1] = bpos.Position + packProperties.Length * vI; pts[2] = bpos.Position + packProperties.Width * vJ; pts[3] = bpos.Position + packProperties.Length * vI + packProperties.Width * vJ; pts[4] = bpos.Position + packProperties.Height * vK; pts[5] = bpos.Position + packProperties.Width * vJ + packProperties.Height * vK;; pts[6] = bpos.Position + HalfAxis.ToVector3D(bpos.DirectionWidth) * packProperties.Width; pts[7] = bpos.Position + HalfAxis.ToVector3D(bpos.DirectionLength) * packProperties.Length + HalfAxis.ToVector3D(bpos.DirectionWidth) * packProperties.Width; foreach (Vector3D pt in pts) { bbox.Extend(pt); } } return(bbox); }
/// <summary> /// Compute layer bouding box /// </summary> /// <param name="bProperties">Case properties</param> /// <returns>bounding box</returns> public BBox3D BoundingBox(Packable packable) { BBox3D bbox = new BBox3D(); if (packable is CylinderProperties cylProperties) { double radius = cylProperties.RadiusOuter; double height = cylProperties.Height; foreach (Vector3D pos in this) { Vector3D[] pts = new Vector3D[8]; pts[0] = pos - radius * Vector3D.XAxis - radius * Vector3D.YAxis; pts[1] = pos + radius * Vector3D.XAxis - radius * Vector3D.YAxis; pts[2] = pos + radius * Vector3D.XAxis + radius * Vector3D.YAxis; pts[3] = pos - radius * Vector3D.XAxis + radius * Vector3D.YAxis; pts[4] = pos - radius * Vector3D.XAxis - radius * Vector3D.YAxis + height * Vector3D.ZAxis; pts[5] = pos + radius * Vector3D.XAxis - radius * Vector3D.YAxis + height * Vector3D.ZAxis; pts[6] = pos + radius * Vector3D.XAxis + radius * Vector3D.YAxis + height * Vector3D.ZAxis; pts[7] = pos - radius * Vector3D.XAxis + radius * Vector3D.YAxis + height * Vector3D.ZAxis; foreach (Vector3D pt in pts) { bbox.Extend(pt); } } } return(bbox); }
public override BBox3D BBoxGlobal(BBox3D loadBBox) { BBox3D bbox = BBoxLoadWDeco(loadBBox); // --- extend for pallet : begin bbox.Extend(PalletProperties.BoundingBox); // --- extend for pallet : end return(bbox); }
public BBox3D BBox(Vector3D dimensions) { BBox3D bbox = new BBox3D(); foreach (Vector3D pt in Points(dimensions)) { bbox.Extend(pt); } return(bbox); }
public BBox3D BoundingBox(Packable packable) { BBox3D bbox = new BBox3D(); if (packable is PackableBrick packableBrick) { Vector3D dimensions = packableBrick.OuterDimensions; foreach (var bpos in this) { bbox.Extend(bpos.BPos.BBox(dimensions)); } } return(bbox); }
public override BBox3D BBoxLoadWDeco(BBox3D loadBBox) { BBox3D bbox = new BBox3D(loadBBox); // --- extend for pallet corners: begin if (HasPalletCorners) { double thickness = PalletCornerProperties.Thickness; Vector3D ptMin = bbox.PtMin; ptMin.X -= thickness; ptMin.Y -= thickness; Vector3D ptMax = bbox.PtMax; ptMax.X += thickness; ptMax.Y += thickness; bbox.Extend(ptMin); bbox.Extend(ptMax); } // --- extend for pallet corners: end // --- extend for pallet cap : begin if (HasPalletCap) { double zMax = bbox.PtMax.Z; Vector3D v0 = new Vector3D( 0.5 * (PalletProperties.Length - PalletCapProperties.Length), 0.5 * (PalletProperties.Width - PalletCapProperties.Width), zMax + PalletCapProperties.Height - PalletCapProperties.InsideHeight); bbox.Extend(v0); Vector3D v1 = new Vector3D( 0.5 * (PalletProperties.Length + PalletCapProperties.Length), 0.5 * (PalletProperties.Width + PalletCapProperties.Width), zMax + PalletCapProperties.Height - PalletCapProperties.InsideHeight); bbox.Extend(v1); } // --- extend for pallet cap : end return(bbox); }
private BBox3D ComputeLoadBBox3D() { BBox3D bbox = new BBox3D(); int iLayer = 0; while (iLayer < Count) { ILayer layer = this[iLayer]; Layer3DCyl blayer = layer as Layer3DCyl; if (null != blayer) { bbox.Extend(blayer.BoundingBox(Analysis.CylinderProperties)); } ++iLayer; } return(bbox); }
/// <summary> /// /// </summary> private BBox3D ComputeLoadBBox3D() { BBox3D bbox = new BBox3D(); int iLayer = 0; while (iLayer < Count) { ILayer layer = this[iLayer]; BoxLayer blayer = layer as BoxLayer; if (null != blayer) { bbox.Extend(blayer.BoundingBox(_boxCaseAnalysis.BProperties)); } ++iLayer; } return(bbox); }
private BBox3D ComputeLoadBBox3D() { double palletLength = ParentTruckAnalysis.ParentSolution.PalletLength; double palletWidth = ParentTruckAnalysis.ParentSolution.PalletWidth; double palletHeight = ParentTruckAnalysis.ParentSolution.PalletHeight; BBox3D bbox = new BBox3D(); int iLayer = 0; while (iLayer < NoLayers) { foreach (BoxPosition bPositionLayer in Layer) { // actual position in load BoxPosition bpos = new BoxPosition( new Vector3D( bPositionLayer.Position.X , bPositionLayer.Position.Y , bPositionLayer.Position.Z + palletHeight * iLayer) , bPositionLayer.DirectionLength , bPositionLayer.DirectionWidth); Vector3D[] pts = new Vector3D[8]; Vector3D vI = HalfAxis.ToVector3D(bpos.DirectionLength); Vector3D vJ = HalfAxis.ToVector3D(bpos.DirectionWidth); Vector3D vK = Vector3D.CrossProduct(vI, vJ); pts[0] = bpos.Position; pts[1] = bpos.Position + palletLength * vI; pts[2] = bpos.Position + palletWidth * vJ; pts[3] = bpos.Position + palletLength * vI + palletWidth * vJ; pts[4] = bpos.Position + palletHeight * vK; pts[5] = bpos.Position + palletWidth * vJ + palletHeight * vK;; pts[6] = bpos.Position + HalfAxis.ToVector3D(bpos.DirectionWidth) * palletWidth; pts[7] = bpos.Position + HalfAxis.ToVector3D(bpos.DirectionLength) * palletLength + HalfAxis.ToVector3D(bpos.DirectionWidth) * palletWidth; foreach (Vector3D pt in pts) { bbox.Extend(pt); } } ++iLayer; } return(bbox); }
public BBox3D BBox(double radius, double length) { Transform3D t = Transf; Vector3D[] pts = new Vector3D[] { new Vector3D(0.0, -radius, -radius), new Vector3D(0.0, -radius, radius), new Vector3D(0.0, radius, -radius), new Vector3D(0.0, radius, radius), new Vector3D(length, -radius, -radius), new Vector3D(length, -radius, radius), new Vector3D(length, radius, -radius), new Vector3D(length, radius, radius) }; BBox3D bbox = new BBox3D(); foreach (Vector3D pt in pts) bbox.Extend(t.transform(pt)); return bbox; }
public BBox3D BoundingBox(Packable packable) { BBox3D bbox = new BBox3D(); Vector3D dimensions = packable.OuterDimensions; Vector3D[] pts = new Vector3D[8]; pts[0] = new Vector3D(0.0, 0.0, _zLower); pts[1] = pts[0] + dimensions.X * Vector3D.XAxis; pts[2] = pts[0] + dimensions.Y * Vector3D.YAxis; pts[3] = pts[0] + dimensions.X * Vector3D.XAxis + dimensions.Y * Vector3D.YAxis; pts[4] = pts[0] + dimensions.Z * Vector3D.ZAxis; pts[5] = pts[1] + dimensions.Z * Vector3D.ZAxis; pts[6] = pts[2] + dimensions.Z * Vector3D.ZAxis; pts[7] = pts[3] + dimensions.Z * Vector3D.ZAxis; foreach (Vector3D pt in pts) { bbox.Extend(pt); } return(bbox); }
public BBox3D BBox(Vector3D dimensions) { BBox3D bbox = new BBox3D(); Vector3D vI = HalfAxis.ToVector3D(DirectionLength); Vector3D vJ = HalfAxis.ToVector3D(DirectionWidth); Vector3D vK = Vector3D.CrossProduct(vI, vJ); Vector3D[] pts = new Vector3D[8]; pts[0] = Position; pts[1] = Position + dimensions.X * vI; pts[2] = Position + dimensions.Y * vJ; pts[3] = Position + dimensions.X * vI + dimensions.Y * vJ; pts[4] = Position + dimensions.Z * vK; pts[5] = Position + dimensions.Y * vJ + dimensions.Z * vK; pts[6] = Position + HalfAxis.ToVector3D(DirectionWidth) * dimensions.Y; pts[7] = Position + HalfAxis.ToVector3D(DirectionLength) * dimensions.X + HalfAxis.ToVector3D(DirectionWidth) * dimensions.Y; foreach (Vector3D pt in pts) { bbox.Extend(pt); } return(bbox); }
public BBox3D BBox(double radius, double length) { Transform3D t = Transf; Vector3D[] pts = new Vector3D[] { new Vector3D(0.0, -radius, -radius), new Vector3D(0.0, -radius, radius), new Vector3D(0.0, radius, -radius), new Vector3D(0.0, radius, radius), new Vector3D(length, -radius, -radius), new Vector3D(length, -radius, radius), new Vector3D(length, radius, -radius), new Vector3D(length, radius, radius) }; BBox3D bbox = new BBox3D(); foreach (Vector3D pt in pts) { bbox.Extend(t.transform(pt)); } return(bbox); }
private BBox3D ComputeLoadBBox3D() { double palletLength = ParentTruckAnalysis.ParentSolution.PalletLength; double palletWidth = ParentTruckAnalysis.ParentSolution.PalletWidth; double palletHeight = ParentTruckAnalysis.ParentSolution.PalletHeight; BBox3D bbox = new BBox3D(); int iLayer = 0; while (iLayer < NoLayers) { foreach (BoxPosition bPositionLayer in Layer) { // actual position in load BoxPosition bpos = new BoxPosition( new Vector3D( bPositionLayer.Position.X , bPositionLayer.Position.Y , bPositionLayer.Position.Z + palletHeight * iLayer) , bPositionLayer.DirectionLength , bPositionLayer.DirectionWidth); Vector3D[] pts = new Vector3D[8]; Vector3D vI = HalfAxis.ToVector3D(bpos.DirectionLength); Vector3D vJ = HalfAxis.ToVector3D(bpos.DirectionWidth); Vector3D vK = Vector3D.CrossProduct(vI, vJ); pts[0] = bpos.Position; pts[1] = bpos.Position + palletLength * vI; pts[2] = bpos.Position + palletWidth * vJ; pts[3] = bpos.Position + palletLength * vI + palletWidth * vJ; pts[4] = bpos.Position + palletHeight * vK; pts[5] = bpos.Position + palletWidth * vJ + palletHeight * vK; ; pts[6] = bpos.Position + HalfAxis.ToVector3D(bpos.DirectionWidth) * palletWidth; pts[7] = bpos.Position + HalfAxis.ToVector3D(bpos.DirectionLength) * palletLength + HalfAxis.ToVector3D(bpos.DirectionWidth) * palletWidth; foreach (Vector3D pt in pts) bbox.Extend(pt); } ++iLayer; } return bbox; }
public override BBox3D BBoxLoadWDeco(BBox3D loadBBox) { BBox3D bbox = new BBox3D(loadBBox); // --- extend for pallet corners: begin if (HasPalletCorners) { double thickness = PalletCornerProperties.Thickness; Vector3D ptMin = bbox.PtMin; ptMin.X -= thickness; ptMin.Y -= thickness; Vector3D ptMax = bbox.PtMax; ptMax.X += thickness; ptMax.Y += thickness; bbox.Extend(ptMin); bbox.Extend(ptMax); } // --- extend for pallet corners: end // --- extend for pallet cap : begin if (HasPalletCap) { double zMax = bbox.PtMax.Z; Vector3D v0 = new Vector3D( 0.5 * (PalletProperties.Length - PalletCapProperties.Length), 0.5 * (PalletProperties.Width - PalletCapProperties.Width), zMax + PalletCapProperties.Height - PalletCapProperties.InsideHeight); bbox.Extend(v0); Vector3D v1 = new Vector3D( 0.5 * (PalletProperties.Length + PalletCapProperties.Length), 0.5 * (PalletProperties.Width + PalletCapProperties.Width), zMax + PalletCapProperties.Height - PalletCapProperties.InsideHeight); bbox.Extend(v1); } // --- extend for pallet cap : end return bbox; }
public override void Draw(Graphics3D graphics, bool showDimensions) { if (null == _solution) return; AnalysisCasePallet analysisCasePallet = _solution.Analysis as AnalysisCasePallet; // ### draw pallet Pallet pallet = new Pallet(analysisCasePallet.PalletProperties); pallet.Draw(graphics, Transform3D.Identity); // ### draw solution uint layerId = 0, pickId = 0; List<ILayer> layers = _solution.Layers; foreach (ILayer layer in layers) { // ### layer of boxes BoxLayer blayer = layer as BoxLayer; if (null != blayer) { BBox3D bbox = new BBox3D(); foreach (BoxPosition bPosition in blayer) { Box b = new Box(pickId++, analysisCasePallet.BProperties, bPosition); graphics.AddBox(b); bbox.Extend(b.BBox); } // add layer BBox AddPickingBox(bbox, layerId); // draw bounding box around selected layer if (layerId == _solution.SelectedLayerIndex) DrawLayerBoundingBox(graphics, bbox); ++layerId; } // ### intetrlayer InterlayerPos interlayerPos = layer as InterlayerPos; if (null != interlayerPos) { InterlayerProperties interlayerProp = _solution.Interlayers[interlayerPos.TypeId];//analysisCasePallet.Interlayer(interlayerPos.TypeId); if (null != interlayerProp) { Box box = new Box(pickId++, interlayerProp); box.Position = new Vector3D( 0.5 * (analysisCasePallet.PalletProperties.Length - interlayerProp.Length) , 0.5 * (analysisCasePallet.PalletProperties.Width - interlayerProp.Width) , interlayerPos.ZLow ); graphics.AddBox(box); } } } BBox3D loadBBox = _solution.BBoxLoad; BBox3D loadBBoxWDeco = _solution.BBoxLoadWDeco; #region Pallet corners // ### pallet corners : Begin Corner[] corners = new Corner[4]; if (analysisCasePallet.HasPalletCorners) { // positions Vector3D[] cornerPositions = { loadBBox.PtMin , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMin.Y, loadBBox.PtMin.Z) , new Vector3D(loadBBox.PtMax.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z) , new Vector3D(loadBBox.PtMin.X, loadBBox.PtMax.Y, loadBBox.PtMin.Z) }; // length axes HalfAxis.HAxis[] lAxes = { HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Y_N }; // width axes HalfAxis.HAxis[] wAxes = { HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Y_N, HalfAxis.HAxis.AXIS_X_P }; // corners if (analysisCasePallet.HasPalletCorners) { for (int i = 0; i < 4; ++i) { corners[i] = new Corner(0, analysisCasePallet.PalletCornerProperties); corners[i].Height = Math.Min(analysisCasePallet.PalletCornerProperties.Length, loadBBox.Height); corners[i].SetPosition(cornerPositions[i], lAxes[i], wAxes[i]); corners[i].DrawBegin(graphics); } } } #endregion #region Pallet cap #endregion #region Pallet film // ### pallet film Film film = null; if (analysisCasePallet.HasPalletFilm) { PalletFilmProperties palletFilmProperties = analysisCasePallet.PalletFilmProperties; film = new Film( palletFilmProperties.Color, palletFilmProperties.UseTransparency, palletFilmProperties.UseHatching, palletFilmProperties.HatchSpacing, palletFilmProperties.HatchAngle); film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0)); film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis, HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0)); film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Length * Vector3D.XAxis + loadBBoxWDeco.Width * Vector3D.YAxis, HalfAxis.HAxis.AXIS_X_N, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Height), 0.0)); film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Width * Vector3D.YAxis, HalfAxis.HAxis.AXIS_Y_N, HalfAxis.HAxis.AXIS_Z_P, new Vector2D(loadBBoxWDeco.Width, loadBBoxWDeco.Height), 0.0)); film.AddRectangle(new FilmRectangle(loadBBoxWDeco.PtMin + loadBBoxWDeco.Height * Vector3D.ZAxis, HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P, new Vector2D(loadBBoxWDeco.Length, loadBBoxWDeco.Width), UnitsManager.ConvertLengthFrom(200.0, UnitsManager.UnitSystem.UNIT_METRIC1))); film.DrawBegin(graphics); } #endregion // ### dimensions if (showDimensions) { graphics.AddDimensions( new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol1) , Color.Black, false)); graphics.AddDimensions( new DimensionCube(BoundingBoxDim(Properties.Settings.Default.DimCasePalletSol2) , Color.Red, true)); } #region Pallet corners // pallet corners : End if (analysisCasePallet.HasPalletCorners) { for (int i = 0; i < 4; ++i) corners[i].DrawEnd(graphics); } #endregion #region Pallet Cap // ### pallet cap if (analysisCasePallet.HasPalletCap) { PalletCapProperties capProperties = analysisCasePallet.PalletCapProperties; Vector3D pos = new Vector3D( 0.5 * (analysisCasePallet.PalletProperties.Length - capProperties.Length), 0.5 * (analysisCasePallet.PalletProperties.Width - capProperties.Width), loadBBox.PtMax.Z - capProperties.InsideHeight); PalletCap cap = new PalletCap(0, capProperties, pos); cap.DrawEnd(graphics); } #endregion #region Pallet film // pallet film : End if (analysisCasePallet.HasPalletFilm) film.DrawEnd(graphics); #endregion }
private BBox3D ComputeLoadBBox3D() { BBox3D bbox = new BBox3D(); bool hasInterlayer = false; double zInterlayer = 0.0; BoxLayer layer0 = GetBoxLayer(0, ref hasInterlayer, ref zInterlayer); bbox.Extend(layer0.BoundingBox(Analysis.PackProperties)); BoxLayer layerN = GetBoxLayer(LayerCount - 1, ref hasInterlayer, ref zInterlayer); bbox.Extend(layerN.BoundingBox(Analysis.PackProperties)); return bbox; }