/// <summary>
/// Gets two points defining the axis of the object.
/// </summary>
///
public LineSegment GetAxis(AxisOrientation axis)
{
double x1, y1;
double x2, y2;
if (axis == AxisOrientation.Horizontal)
{
y1 = Math.Cos(-Angle - Math.PI) * Rectangle.Height / 2.0;
x1 = Math.Sin(-Angle - Math.PI) * Rectangle.Width / 2.0;
y2 = Math.Cos(-Angle) * Rectangle.Height / 2.0;
x2 = Math.Sin(-Angle) * Rectangle.Width / 2.0;
}
else
{
y1 = Math.Cos(-(Angle + Math.PI / 2) - Math.PI) * Rectangle.Height / 2.0;
x1 = Math.Sin(-(Angle + Math.PI / 2) - Math.PI) * Rectangle.Width / 2.0;
y2 = Math.Cos(-(Angle + Math.PI / 2)) * Rectangle.Height / 2.0;
x2 = Math.Sin(-(Angle + Math.PI / 2)) * Rectangle.Width / 2.0;
}
Point start = new Point((float)(Center.X + x1), (float)(Center.Y + y1));
Point end = new Point((float)(Center.X + x2), (float)(Center.Y + y2));
if (start.DistanceTo(end) == 0)
{
return(null);
}
return(new LineSegment(start, end));
}