Struct BoundingRect
BoundingRect is an axis oriented rectangle or a 2-dimensional bounding box. It is implemented as a "struct" (value type) so assignements always make a copy.
Inherited Members
Namespace: CADability
Assembly: CADability.dll
Syntax
[Serializable]
public struct BoundingRect : IQuadTreeInsertable, IComparable<BoundingRect>, ISerializable
Constructors
| Improve this Doc View SourceBoundingRect(BoundingRect)
Copy constructor
Declaration
public BoundingRect(BoundingRect r)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | r |
BoundingRect(GeoPoint2D, Double, Double)
Creates a new BoundingRect with the provided center, half width and half height
Declaration
public BoundingRect(GeoPoint2D Center, double HalfWidth, double HalfHeight)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | Center | Center of the BoundingRect |
| System.Double | HalfWidth | Half width |
| System.Double | HalfHeight | Half height |
BoundingRect(GeoPoint2D[])
Creates a new BoundingRect which contains the provided points
Declaration
public BoundingRect(params GeoPoint2D[] p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D[] | p | List of points to define the rectangle |
BoundingRect(Double, Double, Double, Double)
Creates a new BoundingRect with the provided limits.
Declaration
public BoundingRect(double Left, double Bottom, double Right, double Top)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | Left | Left limit |
| System.Double | Bottom | Bottom limit |
| System.Double | Right | |
| System.Double | Top |
BoundingRect(Rectangle)
Creates a new BoundingRect from the provided System.Drawing.rectangle
Declaration
public BoundingRect(Rectangle r)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Rectangle | r | das gegebene Rechteck |
Fields
| Improve this Doc View SourceBottom
Declaration
public double Bottom
Field Value
| Type | Description |
|---|---|
| System.Double |
EmptyBoundingRect
Returns an empty BoundingRect which is convenient as a start for the MinMax(GeoPoint2D) method.
Declaration
public static BoundingRect EmptyBoundingRect
Field Value
| Type | Description |
|---|---|
| BoundingRect |
HalfInfinitBoundingRect
Declaration
public static BoundingRect HalfInfinitBoundingRect
Field Value
| Type | Description |
|---|---|
| BoundingRect |
InfinitBoundingRect
Declaration
public static BoundingRect InfinitBoundingRect
Field Value
| Type | Description |
|---|---|
| BoundingRect |
Left
Declaration
public double Left
Field Value
| Type | Description |
|---|---|
| System.Double |
Right
Declaration
public double Right
Field Value
| Type | Description |
|---|---|
| System.Double |
Top
Declaration
public double Top
Field Value
| Type | Description |
|---|---|
| System.Double |
Properties
| Improve this Doc View SourceHeight
Declaration
public double Height { get; }
Property Value
| Type | Description |
|---|---|
| System.Double | The height of the rectangle |
IsInfinite
Returns true if the BoundingRect is infinite. I.e. left and bottom equal Double.MinValue and right and top equal Double.MaxValue
Declaration
public bool IsInfinite { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Size
Declaration
public double Size { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
UnitBoundingRect
Returns an BoundingRect form 0 to 1 in both directions
Declaration
public static BoundingRect UnitBoundingRect { get; }
Property Value
| Type | Description |
|---|---|
| BoundingRect |
Width
Declaration
public double Width { get; }
Property Value
| Type | Description |
|---|---|
| System.Double | The width of the rectangle |
Methods
| Improve this Doc View SourceContainsLb(GeoPoint2D)
Declaration
public bool ContainsLb(GeoPoint2D p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | p |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Disjoint(BoundingRect, BoundingRect)
Returns true if the two rectangles are disjoint (do not overlap)
Declaration
public static bool Disjoint(BoundingRect b1, BoundingRect b2)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | b1 | First rectangle |
| BoundingRect | b2 | Second rectangle |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if disjoint |
GetCenter()
Returns the center of the rectangle
Declaration
public GeoPoint2D GetCenter()
Returns
| Type | Description |
|---|---|
| GeoPoint2D |
GetLowerLeft()
Returns the lower left point of the rectangle
Declaration
public GeoPoint2D GetLowerLeft()
Returns
| Type | Description |
|---|---|
| GeoPoint2D |
GetLowerMiddle()
Returns the center of the bottom line of the rectangle
Declaration
public GeoPoint2D GetLowerMiddle()
Returns
| Type | Description |
|---|---|
| GeoPoint2D |
GetLowerRight()
Returns the lower right point of the rectangle
Declaration
public GeoPoint2D GetLowerRight()
Returns
| Type | Description |
|---|---|
| GeoPoint2D |
GetMiddleLeft()
Returns the center of the left line of the rectangle
Declaration
public GeoPoint2D GetMiddleLeft()
Returns
| Type | Description |
|---|---|
| GeoPoint2D |
GetMiddleRight()
Returns the center of the right line of the rectangle
Declaration
public GeoPoint2D GetMiddleRight()
Returns
| Type | Description |
|---|---|
| GeoPoint2D |
GetObjectData(SerializationInfo, StreamingContext)
Implements System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
Declaration
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Runtime.Serialization.SerializationInfo | info | The System.Runtime.Serialization.SerializationInfo to populate with data. |
| System.Runtime.Serialization.StreamingContext | context | The destination (System.Runtime.Serialization.StreamingContext) for this serialization. |
GetPosition(GeoPoint2D, Double)
Returns the position of the provided point with a given precision
Declaration
public BoundingRect.Position GetPosition(GeoPoint2D p, double frameWidth)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | p | The point to test |
| System.Double | frameWidth | The precision: if the distance to a bounding line is smaller than this value, the point is considered as onframe |
Returns
| Type | Description |
|---|---|
| BoundingRect.Position | The position of the point |
GetUpperLeft()
Returns the upper left point of the rectangle
Declaration
public GeoPoint2D GetUpperLeft()
Returns
| Type | Description |
|---|---|
| GeoPoint2D |
GetUpperMiddle()
Returns the center of the upper line of the rectangle
Declaration
public GeoPoint2D GetUpperMiddle()
Returns
| Type | Description |
|---|---|
| GeoPoint2D |
GetUpperRight()
Returns the upper right point of the rectangle
Declaration
public GeoPoint2D GetUpperRight()
Returns
| Type | Description |
|---|---|
| GeoPoint2D |
Inflate(Double)
Inflates the rectangle by the provided value which may also be negative (for shrinking)
Declaration
public void Inflate(double d)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | d | Value for infaltion |
Inflate(Double, Double)
Inflates the rectangle with different values in width an height
Declaration
public void Inflate(double width, double height)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | width | Inflation of the width |
| System.Double | height | Inflation of the height |
InflateRelative(Double)
Inflates the rectangle by a factor relative to its Size.
Declaration
public void InflateRelative(double factor)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | factor |
Interferes(ref BoundingRect)
Returns true, when this rectangle and the provided rect overlap
Declaration
public bool Interferes(ref BoundingRect rect)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | rect |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsEmpty()
Returns true, if this BoundingRect is empty.
Declaration
public bool IsEmpty()
Returns
| Type | Description |
|---|---|
| System.Boolean | true, if empty. |
MakeEmpty()
Makes this BoundingRect an empty BoundingRect
Declaration
public void MakeEmpty()
MinMax(BoundingRect)
Adapts the size of this bounding rectangle to include the provided rectangle.
Declaration
public void MinMax(BoundingRect r)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | r | Rectangle to be included |
MinMax(GeoPoint2D)
Adapts the size of this bounding rectangle to include the provided point.
Declaration
public void MinMax(GeoPoint2D p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | p | Point to be included |
MinMax(GeoPoint2D[])
Adapts the size of this bounding rectangle to include the provided points.
Declaration
public void MinMax(params GeoPoint2D[] p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D[] | p | Points to be included |
Modify(ModOp2D)
Modifies the rectangle by the provided ModOp2D. The resulting rectangle contains the modified vertices of this rectangle
Declaration
public void Modify(ModOp2D m)
Parameters
| Type | Name | Description |
|---|---|---|
| ModOp2D | m | Modification to use |
Move(GeoVector2D)
Moves the rectangle by the provided offset
Declaration
public void Move(GeoVector2D offset)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector2D | offset | Offset to move |
ToBorder()
Returns a Border that consists of the four lines of this ractangle.
Declaration
public Border ToBorder()
Returns
| Type | Description |
|---|---|
| Border | The border |
ToRectangleF()
Declaration
public RectangleF ToRectangleF()
Returns
| Type | Description |
|---|---|
| System.Drawing.RectangleF |
Operators
| Improve this Doc View SourceAddition(BoundingRect, BoundingRect)
Declaration
public static BoundingRect operator +(BoundingRect r1, BoundingRect r2)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | r1 | |
| BoundingRect | r2 |
Returns
| Type | Description |
|---|---|
| BoundingRect |
Addition(BoundingRect, Double)
Returns an inflated or deflated rectangle
Declaration
public static BoundingRect operator +(BoundingRect rect, double offset)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | rect | The initial rectangle |
| System.Double | offset | The offset for the inflation (may be negaitve) |
Returns
| Type | Description |
|---|---|
| BoundingRect | The inflated rectangle |
Equality(BoundingRect, BoundingRect)
Declaration
public static bool operator ==(BoundingRect r1, BoundingRect r2)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | r1 | |
| BoundingRect | r2 |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Explicit(BoundingRect to Rectangle)
Typecast to a System.Drawing.Rectangle
Declaration
public static explicit operator Rectangle(BoundingRect r)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | r | The initial rectangle |
Returns
| Type | Description |
|---|---|
| System.Drawing.Rectangle | The casted rectangle |
GreaterThan(BoundingRect, BoundingRect)
Determins whether r2 is contained in r1.
Declaration
public static bool operator>(BoundingRect r1, BoundingRect r2)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | r1 | Left operand |
| BoundingRect | r2 | Right operand |
Returns
| Type | Description |
|---|---|
| System.Boolean | true, if r2 is contained in r1. |
GreaterThan(GeoPoint2D, BoundingRect)
Determins whether the provided point is outside of the provided ractangle
Declaration
public static bool operator>(GeoPoint2D p, BoundingRect r)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | p | The point to test |
| BoundingRect | r | The rectangle to test with |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if outside |
GreaterThanOrEqual(BoundingRect, BoundingRect)
Determins whether r2 is contained in r1. It may also contact one ore multiple sides of the rectangle.
Declaration
public static bool operator >=(BoundingRect r1, BoundingRect r2)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | r1 | Left operand |
| BoundingRect | r2 | Right operand |
Returns
| Type | Description |
|---|---|
| System.Boolean | true, if r2 is contained in r1. |
GreaterThanOrEqual(GeoPoint2D, BoundingRect)
Determins whether the provided point is outside of the provided ractangle. It may also reside on one of the bounding lines.
Declaration
public static bool operator >=(GeoPoint2D p, BoundingRect r)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | p | The point to test |
| BoundingRect | r | The rectangle to test with |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if outside |
Inequality(BoundingRect, BoundingRect)
Declaration
public static bool operator !=(BoundingRect r1, BoundingRect r2)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | r1 | |
| BoundingRect | r2 |
Returns
| Type | Description |
|---|---|
| System.Boolean |
LessThan(BoundingRect, BoundingRect)
Determins whether r1 is contained in r2.
Declaration
public static bool operator <(BoundingRect r1, BoundingRect r2)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | r1 | Left operand |
| BoundingRect | r2 | Right operand |
Returns
| Type | Description |
|---|---|
| System.Boolean | true, if r1 is contained in r2. |
LessThan(GeoPoint2D, BoundingRect)
Determins whether the provided point is contained in the provided rectangle
Declaration
public static bool operator <(GeoPoint2D p, BoundingRect r)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | p | The point to test |
| BoundingRect | r | The rectangle to test with |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if contained |
LessThanOrEqual(BoundingRect, BoundingRect)
Determins whether r1 is contained in r2. It may also contact one ore multiple sides of the rectangle.
Declaration
public static bool operator <=(BoundingRect r1, BoundingRect r2)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | r1 | Left operand |
| BoundingRect | r2 | Right operand |
Returns
| Type | Description |
|---|---|
| System.Boolean | true, if r1 is contained in r2. |
LessThanOrEqual(GeoPoint2D, BoundingRect)
Determins whether the provided point is contained in the provided rectangle. It may also reside on one of the bounding lines.
Declaration
public static bool operator <=(GeoPoint2D p, BoundingRect r)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | p | The point to test |
| BoundingRect | r | The rectangle to test with |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if contained |
Multiply(BoundingRect, Double)
Returns a rectangle which is scaled by the provided factor. The center remaines fixed.
Declaration
public static BoundingRect operator *(BoundingRect rect, double Factor)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | rect | The initial rectangle |
| System.Double | Factor | The scalingfactor |
Returns
| Type | Description |
|---|---|
| BoundingRect | the scaled rectangle |
Multiply(ModOp2D, BoundingRect)
Declaration
public static BoundingRect operator *(ModOp2D m, BoundingRect rect)
Parameters
| Type | Name | Description |
|---|---|---|
| ModOp2D | m | |
| BoundingRect | rect |
Returns
| Type | Description |
|---|---|
| BoundingRect |
Explicit Interface Implementations
| Improve this Doc View SourceIQuadTreeInsertable.GetExtent()
Declaration
BoundingRect IQuadTreeInsertable.GetExtent()
Returns
| Type | Description |
|---|---|
| BoundingRect |
IQuadTreeInsertable.HitTest(ref BoundingRect, Boolean)
Declaration
bool IQuadTreeInsertable.HitTest(ref BoundingRect rect, bool includeControlPoints)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | rect | |
| System.Boolean | includeControlPoints |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IQuadTreeInsertable.ReferencedObject
Declaration
object IQuadTreeInsertable.ReferencedObject { get; }
Returns
| Type | Description |
|---|---|
| System.Object |
IComparable<BoundingRect>.CompareTo(BoundingRect)
Declaration
int IComparable<BoundingRect>.CompareTo(BoundingRect other)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingRect | other |
Returns
| Type | Description |
|---|---|
| System.Int32 |