InscribedRectangle Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The InscribedRectangle class defines the largest rectangle within an arbitrary shape.
public ref class InscribedRectangle
public class InscribedRectangle
type InscribedRectangle = class
Public Class InscribedRectangle
- Inheritance
-
InscribedRectangle
Constructors
InscribedRectangle(Edge[], Int32) |
Finds a large inscribed rectangle. Tries to be maximal but this is best effort. The algorithm used was inspired by the blog post https://d3plus.org/blog/behind-the-scenes/2014/07/08/largest-rect/ Random points within the polygon are chosen, and then 2 lines are drawn through those points. The midpoints of those lines are used as the center of various rectangles, using a binary search to vary the size, until the largest fit-able rectangle is found. This is then repeated for predefined angles (0-180 in steps of 15) and aspect ratios (1 to 15 in steps of 0.5). |
Properties
Angle |
The rotation angle, in degrees, of the inscribed rectangle. |
Center |
The center point of the inscribed rectangle. |
Height |
The height of the inscribed rectangle. |
IsValid |
Is the described rectangle valid? |
Width |
The width of the inscribed rectangle. |
Methods
IsInsideBoundary(Vector2) |
Determine of the provided point lies within the defined rectangle. |