Exemplo n.º 1
0
 /// <summary>
 /// Checks whether the point lies inside the rectangle or not
 /// </summary>
 /// <param name="point">point</param>
 /// <returns>bool</returns>
 public bool PointLiesInside(Point2D point) => PointLiesInside(this, point);
Exemplo n.º 2
0
 /// <summary>
 /// Rotates the rectangle by a specific angle along a specified axis point (default (null) value is midpoint of the specified rectangle)
 /// </summary>
 /// <param name="angle">Angle of rotation</param>
 /// <param name="axis">Axis of rotation</param>
 /// <returns>Rectangle</returns>
 public Rectangle2D Rotate(Angle angle, Point2D axis = null) => Rotate(this, angle, axis ?? Midpoint);
Exemplo n.º 3
0
 /// <summary>
 /// Checks whther the point lies inside a given rectangle or not
 /// </summary>
 /// <param name="rectangle">Rectangle</param>
 /// <param name="point">Point</param>
 /// <returns>bool</returns>
 public static bool PointLiesInside(Rectangle2D rectangle, Point2D point) => Math.Round(rectangle.Area, 8) == Math.Round(new Triangle2D(rectangle.A, point, rectangle.B).Area + new Triangle2D(rectangle.B, point, rectangle.C).Area + new Triangle2D(rectangle.C, point, rectangle.D).Area + new Triangle2D(rectangle.D, point, rectangle.A).Area, 8);
Exemplo n.º 4
0
 /// <summary>
 /// Rotates a given rectangle by a specific angle along a specified axis point (default (null) value is midpoint of the specified rectangle)
 /// </summary>
 /// <param name="rectangle">Rectangle to be rotated</param>
 /// <param name="angle">Angle of rotation</param>
 /// <param name="axis">Axis of rotation</param>
 /// <returns>Rectangle</returns>
 public static Rectangle2D Rotate(Rectangle2D rectangle, Angle angle, Point2D axis = null) => new Rectangle2D(rectangle.Length, rectangle.Breadth, rectangle.Midpoint = rectangle.Midpoint.Rotate(angle, axis ?? rectangle.Midpoint), rectangle.Inclination += angle);