Class BoundingBox2D
The BoundingBox2D class represents the axis-aligned area
enclosed by a two points in 2D space.
Inheritance
System.Object
BoundingBox2D
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
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
BoundingBox2D(Point2D, Point2D)
Instantiates a bounding box that contains both points
Declaration
public BoundingBox2D(Point2D p, Point2D q)
Parameters
Properties
Area
Declaration
public double Area { get; }
Property Value
Type |
Description |
System.Double |
|
Height
The difference bewteen the maximum Y and minimum Y
Declaration
public double Height { get; }
Property Value
Type |
Description |
System.Double |
|
Max
The maximum X and Y-coordinate of the bounds
Declaration
public Point2D Max { get; }
Property Value
MaxX
The maximum X-coordinate of the bounds
Declaration
public double MaxX { get; }
Property Value
Type |
Description |
System.Double |
|
MaxY
The maximum Y-coordinate of the bounds
Declaration
public double MaxY { get; }
Property Value
Type |
Description |
System.Double |
|
Min
The minimum X and Y-coordinate of the bounds
Declaration
public Point2D Min { get; }
Property Value
MinX
The minimum X-coordinate of the bounds
Declaration
public double MinX { get; }
Property Value
Type |
Description |
System.Double |
|
MinY
The minimum Y-coordinate of the bounds
Declaration
public double MinY { get; }
Property Value
Type |
Description |
System.Double |
|
Width
The difference bewteen the maximum X and minimum X
Declaration
public double Width { get; }
Property Value
Type |
Description |
System.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 |
System.Boolean |
|
DoesOverlap(BoundingBox2D)
True iff the two bounds overlap
Declaration
public bool DoesOverlap(BoundingBox2D other)
Parameters
Returns
Type |
Description |
System.Boolean |
|
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 |
System.Object |
obj |
The bounds to compare to
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
System.Object.Equals(System.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 |
System.Double |
amount |
|
Returns
Finalize()
Declaration
protected void Finalize()
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.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
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 |
System.String |
|
Overrides
System.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
Operators
Equality(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
Returns
Type |
Description |
System.Boolean |
|
Inequality(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
Returns
Type |
Description |
System.Boolean |
|