/// <summary> /// Calculate the total offset of the mid-point of this profile /// from the set-out point of the section with the specified horizontal /// and vertical set-out /// </summary> /// <param name="centroid">The centroid of the section profile</param> /// <returns></returns> protected Vector CalculateOriginOffset(Vector centroid, HorizontalSetOut horizontalSetOut, VerticalSetOut verticalSetOut) { Vector result = Offset; if (verticalSetOut == VerticalSetOut.Centroid) { result = result.AddY(-centroid.Y); } else if (verticalSetOut == VerticalSetOut.Bottom) { result = result.AddY(OverallDepth / 2); } else if (verticalSetOut == VerticalSetOut.Top) { result = result.AddY(-OverallDepth / 2); } if (horizontalSetOut == HorizontalSetOut.Centroid) { result = result.AddX(-centroid.X); } else if (horizontalSetOut == HorizontalSetOut.Left) { result = result.AddX(OverallWidth / 2); } else if (horizontalSetOut == HorizontalSetOut.Right) { result = result.AddX(-OverallWidth / 2); } return(result); }
public void AddYTest() { var vector = new Vector(71.0, 67.0); vector.AddY(100.0); Assert.AreEqual(167.0, vector.Y); }