public void AddPosition(Vector2D vPosition, HalfAxis.HAxis lengthAxis, HalfAxis.HAxis widthAxis) { // build 4D matrix Vector3D vAxisLength = HalfAxis.ToVector3D(lengthAxis); Vector3D vAxisWidth = HalfAxis.ToVector3D(widthAxis); Vector3D vAxisHeight = Vector3D.CrossProduct(vAxisLength, vAxisWidth); Matrix4D mat = Matrix4D.Identity; mat.M11 = vAxisLength.X; mat.M12 = vAxisLength.Y; mat.M13 = vAxisLength.Z; mat.M21 = vAxisWidth.X; mat.M22 = vAxisWidth.Y; mat.M23 = vAxisWidth.Z; mat.M31 = vAxisHeight.X; mat.M32 = vAxisHeight.Y; mat.M33 = vAxisHeight.Z; Transform3D localTransf = new Transform3D(mat); Transform3D localTransfInv = localTransf.Inverse(); Transform3D originTranslation = Transform3D.Translation(localTransfInv.transform(_vecTransf)); Vector3D vPos = originTranslation.transform(new Vector3D(vPosition.X, vPosition.Y, 0.0)); LayerPosition layerPos = new LayerPosition( originTranslation.transform(new Vector3D(vPosition.X, vPosition.Y, 0.0)) , HalfAxis.ToHalfAxis(localTransfInv.transform(HalfAxis.ToVector3D(_lengthAxis))) , HalfAxis.ToHalfAxis(localTransfInv.transform(HalfAxis.ToVector3D(_widthAxis))) ); // add position this.Add(layerPos); }
public void AddPosition(Vector2D vPosition, HalfAxis.HAxis lengthAxis, HalfAxis.HAxis widthAxis) { // build 4D matrix Vector3D vAxisLength = HalfAxis.ToVector3D(lengthAxis); Vector3D vAxisWidth = HalfAxis.ToVector3D(widthAxis); Vector3D vAxisHeight = Vector3D.CrossProduct(vAxisLength, vAxisWidth); Matrix4D mat = Matrix4D.Identity; mat.M11 = vAxisLength.X; mat.M12 = vAxisLength.Y; mat.M13 = vAxisLength.Z; mat.M21 = vAxisWidth.X; mat.M22 = vAxisWidth.Y; mat.M23 = vAxisWidth.Z; mat.M31 = vAxisHeight.X; mat.M32 = vAxisHeight.Y; mat.M33 = vAxisHeight.Z; mat.M41 = 0.0; mat.M42 = 0.0; mat.M43 = 0.0; mat.M44 = 1.0; Transform3D localTransf = new Transform3D(mat); Transform3D localTransfInv = localTransf.Inverse(); Transform3D originTranslation = Transform3D.Translation(localTransfInv.transform(VecTransf) - new Vector3D(0.5 * ForcedSpace, 0.5 * ForcedSpace, 0.0)); var layerPos = new BoxPosition( originTranslation.transform(new Vector3D(vPosition.X, vPosition.Y, 0.0) + 0.5 * ForcedSpace * vAxisLength + 0.5 * ForcedSpace * vAxisWidth) , HalfAxis.ToHalfAxis(localTransfInv.transform(HalfAxis.ToVector3D(LengthAxis))) , HalfAxis.ToHalfAxis(localTransfInv.transform(HalfAxis.ToVector3D(WidthAxis))) ); layerPos.Position += new Vector3D(0.5 * ForcedSpace, 0.5 * ForcedSpace, 0.0); // add position Add(layerPos.Adjusted(DimBox)); }
public void AddPosition(Vector2D vPosition, HalfAxis.HAxis lengthAxis, HalfAxis.HAxis widthAxis) { // build 4D matrix Vector3D vAxisLength = HalfAxis.ToVector3D(lengthAxis); Vector3D vAxisWidth = HalfAxis.ToVector3D(widthAxis); Vector3D vAxisHeight = Vector3D.CrossProduct(vAxisLength, vAxisWidth); Matrix4D mat = Matrix4D.Identity; mat.M11 = vAxisLength.X; mat.M12 = vAxisLength.Y; mat.M13 = vAxisLength.Z; mat.M21 = vAxisWidth.X; mat.M22 = vAxisWidth.Y; mat.M23 = vAxisWidth.Z; mat.M31 = vAxisHeight.X; mat.M32 = vAxisHeight.Y; mat.M33 = vAxisHeight.Z; mat.M41 = 0.0; mat.M42 = 0.0; mat.M43 = 0.0; mat.M44 = 1.0; Transform3D localTransf = new Transform3D(mat); Transform3D localTransfInv = localTransf.Inverse(); Transform3D originTranslation = Transform3D.Translation(localTransfInv.transform(VecTransf) - new Vector3D(0.5 * ForcedSpace, 0.5 * ForcedSpace, 0.0)); var layerPos = new BoxPosition( originTranslation.transform(new Vector3D(vPosition.X, vPosition.Y, 0.0) + 0.5 * ForcedSpace * vAxisLength + 0.5 * ForcedSpace * vAxisWidth) , HalfAxis.ToHalfAxis(localTransfInv.transform(HalfAxis.ToVector3D(LengthAxis))) , HalfAxis.ToHalfAxis(localTransfInv.transform(HalfAxis.ToVector3D(WidthAxis))) ); // spacing ? layerPos.Position += new Vector3D(0.5 * ForcedSpace, 0.5 * ForcedSpace, 0.0); var bposAdj = layerPos.Adjusted(DimBoxTotal); // bulge ? Vector3D vecBulge = Vector3D.Zero; if (Bulge.X > 0) { vecBulge += 0.5 * Bulge.X * HalfAxis.ToVector3D(bposAdj.DirectionLength); } if (Bulge.Y > 0) { vecBulge += 0.5 * Bulge.Y * HalfAxis.ToVector3D(bposAdj.DirectionWidth); } if (Bulge.Z > 0) { vecBulge += 0.5 * Bulge.Z * HalfAxis.ToVector3D(bposAdj.DirectionHeight); } bposAdj.Position += vecBulge; // add position Add(bposAdj); }