Class Rectangle | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class Rectangle

    A simple rectangle class.

    Inheritance
    System.Object
    Rectangle
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: UnityEngine.Experimental.U2D.TriangleNet.Geometry
    Syntax
    public class Rectangle

    Constructors

    Rectangle()

    Initializes a new instance of the Rectangle class.

    Declaration
    public Rectangle()

    Rectangle(Double, Double, Double, Double)

    Initializes a new instance of the Rectangle class with predefined bounds.

    Declaration
    public Rectangle(double x, double y, double width, double height)
    Parameters
    Type Name Description
    System.Double x

    Minimum x value (left).

    System.Double y

    Minimum y value (bottom).

    System.Double width

    Width of the rectangle.

    System.Double height

    Height of the rectangle.

    Rectangle(Rectangle)

    Declaration
    public Rectangle(Rectangle other)
    Parameters
    Type Name Description
    Rectangle other

    Properties

    Bottom

    Gets the minimum y value (bottom boundary).

    Declaration
    public double Bottom { get; }
    Property Value
    Type Description
    System.Double

    Height

    Gets the height of the rectangle.

    Declaration
    public double Height { get; }
    Property Value
    Type Description
    System.Double

    Left

    Gets the minimum x value (left boundary).

    Declaration
    public double Left { get; }
    Property Value
    Type Description
    System.Double

    Right

    Gets the maximum x value (right boundary).

    Declaration
    public double Right { get; }
    Property Value
    Type Description
    System.Double

    Top

    Gets the maximum y value (top boundary).

    Declaration
    public double Top { get; }
    Property Value
    Type Description
    System.Double

    Width

    Gets the width of the rectangle.

    Declaration
    public double Width { get; }
    Property Value
    Type Description
    System.Double

    Methods

    Contains(Double, Double)

    Check if given point is inside rectangle.

    Declaration
    public bool Contains(double x, double y)
    Parameters
    Type Name Description
    System.Double x

    Point to check.

    System.Double y

    Point to check.

    Returns
    Type Description
    System.Boolean

    Return true, if rectangle contains given point.

    Contains(Point)

    Check if given point is inside rectangle.

    Declaration
    public bool Contains(Point pt)
    Parameters
    Type Name Description
    Point pt

    Point to check.

    Returns
    Type Description
    System.Boolean

    Return true, if rectangle contains given point.

    Contains(Rectangle)

    Check if this rectangle contains other rectangle.

    Declaration
    public bool Contains(Rectangle other)
    Parameters
    Type Name Description
    Rectangle other

    Rectangle to check.

    Returns
    Type Description
    System.Boolean

    Return true, if this rectangle contains given rectangle.

    Expand(IEnumerable<Point>)

    Expand rectangle to include a list of points.

    Declaration
    public void Expand(IEnumerable<Point> points)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<Point> points

    Expand(Point)

    Expand rectangle to include given point.

    Declaration
    public void Expand(Point p)
    Parameters
    Type Name Description
    Point p

    Point.

    Expand(Rectangle)

    Expand rectangle to include given rectangle.

    Declaration
    public void Expand(Rectangle other)
    Parameters
    Type Name Description
    Rectangle other

    Intersects(Rectangle)

    Check if this rectangle intersects other rectangle.

    Declaration
    public bool Intersects(Rectangle other)
    Parameters
    Type Name Description
    Rectangle other

    Rectangle to check.

    Returns
    Type Description
    System.Boolean

    Return true, if given rectangle intersects this rectangle.

    Resize(Double, Double)

    Update bounds.

    Declaration
    public void Resize(double dx, double dy)
    Parameters
    Type Name Description
    System.Double dx

    Add dx to left and right bounds.

    System.Double dy

    Add dy to top and bottom bounds.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023