public static BoxPosition Transform(BoxPosition boxPosition, Transform3D transform) { if (!boxPosition.IsValid) { throw new Exception("Invalid box position : can not transform"); } return(new BoxPosition( transform.transform(boxPosition.Position) , HalfAxis.Transform(boxPosition.DirectionLength, transform) , HalfAxis.Transform(boxPosition.DirectionWidth, transform) )); }
public Layer3DBox GetBoxLayer(int iLayerIndex, ref bool hasInterlayer, ref double zInterlayer) { if (null == _parentAnalysis) { throw new Exception("_parentAnalysis not set."); } double interlayerThickness = (null != _parentAnalysis.InterlayerProperties) ? _parentAnalysis.InterlayerProperties.Thickness : 0.0; double packHeight = _parentAnalysis.PackProperties.Height; double zLow = _parentAnalysis.PalletProperties.Height; int i = 0; while (i <= iLayerIndex - 1) { LayerDescriptor desc = _listLayers[i]; zLow += (desc.HasInterlayer ? interlayerThickness : 0.0) + packHeight; ++i; } zInterlayer = zLow; hasInterlayer = _listLayers[iLayerIndex].HasInterlayer; zLow += hasInterlayer ? interlayerThickness : 0.0; Transform3D swapTransform = Transform3D.Identity; if (_listLayers[iLayerIndex].Swapped) { Matrix4D matRot = new Matrix4D( -1.0, 0.0, 0.0, _parentAnalysis.PalletProperties.Length , 0.0, -1.0, 0.0, _parentAnalysis.PalletProperties.Width , 0.0, 0.0, 1.0, 0.0 , 0.0, 0.0, 0.0, 1.0); swapTransform = new Transform3D(matRot); } // build BoxLayer Layer3DBox layer = new Layer3DBox(zLow + (hasInterlayer ? interlayerThickness : 0.0), 0); foreach (BoxPosition b in _layer) { layer.Add( new BoxPosition( swapTransform.transform(b.Position + zLow * Vector3D.ZAxis) , HalfAxis.Transform(b.DirectionLength, swapTransform) , HalfAxis.Transform(b.DirectionWidth, swapTransform)) ); } return(layer); }
public CylPosition Transform(Transform3D transf) => new CylPosition(transf.transform(XYZ), HalfAxis.Transform(Direction, transf));