/// <summary> /// This method will be used to build /// </summary> /// <param name="pos">Position of left/front/down corner of box</param> /// <param name="dimOriented">Projections of box on axes X/Y/Z</param> /// <param name="dimOriginal">Box length, width, height</param> /// <returns></returns> public static BoxPosition FromPositionDimension(Vector3D pos, Vector3D dimOriented, Vector3D dimOriginal) { BoxPositionIndexed bpi = BoxPositionIndexed.Zero; // search for length (dimOriginal[0]) if (MostlyEqual(dimOriented[0], dimOriginal[0])) { // L W H if (MostlyEqual(dimOriented[1], dimOriginal[1])) { bpi = new BoxPositionIndexed(pos, 1); } // L H W else if (MostlyEqual(dimOriented[1], dimOriginal[2])) { bpi = new BoxPositionIndexed(pos, 5); } } else if (MostlyEqual(dimOriented[0], dimOriginal[1])) { // W L H if (MostlyEqual(dimOriented[1], dimOriginal[0])) { bpi = new BoxPositionIndexed(pos, 2); } // W H L else if (MostlyEqual(dimOriented[1], dimOriginal[2])) { bpi = new BoxPositionIndexed(pos, 3); } } else if (MostlyEqual(dimOriented[0], dimOriginal[2])) { // H L W if (MostlyEqual(dimOriented[1], dimOriginal[0])) { bpi = new BoxPositionIndexed(pos, 6); } // H W L else if (MostlyEqual(dimOriented[1], dimOriginal[1])) { bpi = new BoxPositionIndexed(pos, 4); } } return(bpi.ToBoxPosition(dimOriginal)); }
public BoxPositionIndexed Adjusted(Vector3D dimensions) { var boxPosTemp = new BoxPositionIndexed(BPos.Position, BPos.DirectionLength, BPos.DirectionWidth, Index); // reverse if oriented to Z- (AXIS_Z_N) if (BPos.DirectionHeight == HalfAxis.HAxis.AXIS_Z_N) { if (BPos.DirectionLength == HalfAxis.HAxis.AXIS_X_P) boxPosTemp.BPos = new BoxPosition(BPos.Position + new Vector3D(0.0, -dimensions.Y, -dimensions.Z), HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P); else if (BPos.DirectionLength == HalfAxis.HAxis.AXIS_Y_P) boxPosTemp.BPos = new BoxPosition(BPos.Position + new Vector3D(dimensions.Y, 0.0, -dimensions.Z), HalfAxis.HAxis.AXIS_Y_P, HalfAxis.HAxis.AXIS_X_N); else if (BPos.DirectionLength == HalfAxis.HAxis.AXIS_X_N) boxPosTemp.BPos = new BoxPosition(BPos.Position + new Vector3D(-dimensions.X, 0.0, -dimensions.Z), HalfAxis.HAxis.AXIS_X_P, BPos.DirectionWidth); else if (BPos.DirectionLength == HalfAxis.HAxis.AXIS_Y_N) boxPosTemp.BPos = new BoxPosition(BPos.Position + new Vector3D(-dimensions.Y, 0.0, -dimensions.Z), HalfAxis.HAxis.AXIS_Y_N, HalfAxis.HAxis.AXIS_X_P); } return boxPosTemp; }
public void AddPosition(BoxPositionIndexed position) => Add(position);
protected void Add(BoxPositionIndexed position) => _listBoxPosition.Add(position);
public BoxPositionIndexed(BoxPositionIndexed boxPosition) { BPos = boxPosition.BPos; Index = boxPosition.Index; }