Show / Hide Table of Contents

    Class BoundingBox2D

    The BoundingBox2D class represents the axis-aligned area enclosed by a two points in 2D space.

    Inheritance
    object
    BoundingBox2D
    Inherited Members
    object.GetType()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    Namespace: DesignData.SDS2.Primitives
    Assembly: DesignData.SDS2.Primitives.dll
    Syntax
    public sealed class BoundingBox2D

    Constructors

    BoundingBox2D(BoundingBox2D)

    Instantiates a bounding box as a copy of another bounding box.

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

    BoundingBox2D(Point2D, Point2D)

    Instantiates a bounding box that contains both points

    Declaration
    public BoundingBox2D(Point2D p, Point2D q)
    Parameters
    Type Name Description
    Point2D p
    Point2D q

    Properties

    Area

    The area of the bounds

    Declaration
    public double Area { get; }
    Property Value
    Type Description
    double

    Height

    The difference bewteen the maximum Y and minimum Y

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

    Max

    The maximum X and Y-coordinate of the bounds

    Declaration
    public Point2D Max { get; }
    Property Value
    Type Description
    Point2D

    MaxX

    The maximum X-coordinate of the bounds

    Declaration
    public double MaxX { get; }
    Property Value
    Type Description
    double

    MaxY

    The maximum Y-coordinate of the bounds

    Declaration
    public double MaxY { get; }
    Property Value
    Type Description
    double

    Min

    The minimum X and Y-coordinate of the bounds

    Declaration
    public Point2D Min { get; }
    Property Value
    Type Description
    Point2D

    MinX

    The minimum X-coordinate of the bounds

    Declaration
    public double MinX { get; }
    Property Value
    Type Description
    double

    MinY

    The minimum Y-coordinate of the bounds

    Declaration
    public double MinY { get; }
    Property Value
    Type Description
    double

    Width

    The difference bewteen the maximum X and minimum X

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

    Methods

    DoesEnclose(Point2D)

    True iff the specified point is within bounds

    Declaration
    public bool DoesEnclose(Point2D point)
    Parameters
    Type Name Description
    Point2D point
    Returns
    Type Description
    bool

    DoesOverlap(BoundingBox2D)

    True iff the two bounds overlap

    Declaration
    public bool DoesOverlap(BoundingBox2D other)
    Parameters
    Type Name Description
    BoundingBox2D other
    Returns
    Type Description
    bool

    Equals(object)

    Checks to see if the Min and Max are equal using Double.Equals on each component. Note that this is an "exact" comparison method, and only appropriate in special circumstances.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The bounds to compare to

    Returns
    Type Description
    bool
    Overrides
    object.Equals(object)

    Expanded(double)

    A new bounding box expanded on all sides by the specified amount

    Declaration
    public BoundingBox2D Expanded(double amount)
    Parameters
    Type Name Description
    double amount
    Returns
    Type Description
    BoundingBox2D

    ~BoundingBox2D()

    The BoundingBox2D class represents the axis-aligned area enclosed by a two points in 2D space.

    Declaration
    protected ~BoundingBox2D()

    GetHashCode()

    Returns the hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    object.GetHashCode()

    ShortestVectorToPoint(Point2D)

    The shortest vector from the bounds to the specified point

    Declaration
    public Vector2D ShortestVectorToPoint(Point2D point)
    Parameters
    Type Name Description
    Point2D point
    Returns
    Type Description
    Vector2D

    ToString()

    Formats the point into a string. Note that because the values are rounded for display, parsing them to retrieve the Min and Max values will not necessarily yield the same bounds.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()

    Unioned(Point2D)

    A new bounding box that includes the current bounds and the specified point

    Declaration
    public BoundingBox2D Unioned(Point2D point)
    Parameters
    Type Name Description
    Point2D point
    Returns
    Type Description
    BoundingBox2D

    Operators

    operator ==(BoundingBox2D, BoundingBox2D)

    Checks on Min and Max. Note that this is an "exact" comparison method, and only appropriate in special circumstances.

    Declaration
    public static bool operator ==(BoundingBox2D a, BoundingBox2D b)
    Parameters
    Type Name Description
    BoundingBox2D a

    The bounds to compare

    BoundingBox2D b

    The bounds to compare to

    Returns
    Type Description
    bool

    operator !=(BoundingBox2D, BoundingBox2D)

    Checks inequality on Min and Max Note that this is an "exact" comparison method, and only appropriate in special circumstances.

    Declaration
    public static bool operator !=(BoundingBox2D a, BoundingBox2D b)
    Parameters
    Type Name Description
    BoundingBox2D a

    The bounds to compare

    BoundingBox2D b

    The bounds to compare to

    Returns
    Type Description
    bool
    Back to top