Header menu logo Euclid

BRect Type

 An immutable 2D bounding rectangle.
 Sometimes also called 2D a bounding box.
 This implementation guarantees the rectangle to be always valid.
 That means the Min X and Y values are always smaller or equal than the respective Max values.

   Y-Axis (Height2D)
   ^
   |
   |             2 max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |       local
   +------------+-----> X-Axis (Width)
  0-min X,Y      1

Record fields

Record Field Description

MaxX

Full Usage: MaxX

Field type: float
Field type: float

MaxY

Full Usage: MaxY

Field type: float
Field type: float

MinX

Full Usage: MinX

Field type: float
Field type: float

MinY

Full Usage: MinY

Field type: float
Field type: float

Instance members

Instance member Description

this.Area

Full Usage: this.Area

Returns: float
Modifiers: inline

Returns the area of this bounding rectangle.

Returns: float

this.AsString

Full Usage: this.AsString

Returns: string

Format bounding rectangle into string with nice floating point number formatting of size and position. But without full type name as in rect.ToString()

Returns: string

this.Center

Full Usage: this.Center

Returns: Pt
Modifiers: inline

The center of the bounding rect.

Returns: Pt

this.Contains

Full Usage: this.Contains

Parameters:
Returns: bool
Modifiers: inline

Returns true if the Rectangle is inside or exactly on the other bounding rectangle.

o : BRect
Returns: bool

this.Contains

Full Usage: this.Contains

Parameters:
Returns: bool
Modifiers: inline

Returns true if the point is inside or exactly on this bounding rectangle.

p : Pt
Returns: bool

this.Diagonal

Full Usage: this.Diagonal

Returns: Vc
Modifiers: inline

The diagonal 2D vector of the bounding rect. From MinPt to MaxPt.

Returns: Vc

this.Edge01

Full Usage: this.Edge01

Returns: Line2D
 The bottom Edge. The line from point 0 to 1

   Y-Axis (Height2D)
   ^
   |
   |             2  = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis (Width)
  0 = min X,Y    1
Returns: Line2D

this.Edge12

Full Usage: this.Edge12

Returns: Line2D
 The right Edge. The line from point 1 to 2

   Y-Axis (Height2D)
   ^
   |
   |             2  = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis (Width)
  0 = min X,Y    1
Returns: Line2D

this.Edge23

Full Usage: this.Edge23

Returns: Line2D
 The top Edge. The line from point 2 to 3

   Y-Axis (Height2D)
   ^
   |
   |             2  = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis (Width)
  0 = min X,Y    1
Returns: Line2D

this.Edge30

Full Usage: this.Edge30

Returns: Line2D
 The left Edge. The line from point 3 to 0

   Y-Axis (Height2D)
   ^
   |
   |             2  = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis (Width)
  0 = min X,Y    1
Returns: Line2D

this.EvaluateAt

Full Usage: this.EvaluateAt

Parameters:
    xParameter : float
    yParameter : float

Returns: Pt
Modifiers: inline
 Evaluate a X and Y parameter of this bounding rectangle.
  0.0, 0.0, 0.0 returns the MinPt.
  1.0, 1.0, 1.0 returns the MaxPt.
xParameter : float
yParameter : float
Returns: Pt

this.Expand

Full Usage: this.Expand

Parameters:
    xDist : float
    yDist : float

Returns: BRect
Modifiers: inline

Returns a bounding rectangle expanded by a distance for X and Y-axis each. Does check for underflow if distance is negative and raises EuclidException.

xDist : float
yDist : float
Returns: BRect

this.Expand

Full Usage: this.Expand

Parameters:
    dist : float

Returns: BRect
Modifiers: inline

Returns a bounding rectangle expanded by distance. Does check for underflow if distance is negative and raises EuclidException.

dist : float
Returns: BRect

this.ExpandSave

Full Usage: this.ExpandSave

Parameters:
    dist : float

Returns: BRect
Modifiers: inline

Returns a bounding rectangle expanded by a distance. If expansion is negative it shrinks the Rectangle. It also makes sure that there is no underflow. When the negative expansion is bigger than the size, Min and Max values will be both in the middle from where they were before.

dist : float
Returns: BRect

this.ExpandSave

Full Usage: this.ExpandSave

Parameters:
    xDist : float
    yDist : float

Returns: BRect
Modifiers: inline

Returns a bounding rectangle expanded by a distance for X and Y-axis each. If expansion is negative it shrinks the Rectangle. It also makes sure that there is no underflow. When the negative expansion is bigger than the size, Min and Max values will be both in the middle from where they were before.

xDist : float
yDist : float
Returns: BRect

this.ExpandXaxis

Full Usage: this.ExpandXaxis

Parameters:
    startDist : float
    endDist : float

Returns: BRect
Modifiers: inline

Returns a bounding rectangle expanded only in X direction by different distance for start(minX) and end (maxX). Does check for underflow if distance is negative and raises EuclidException.

startDist : float
endDist : float
Returns: BRect

this.ExpandYaxis

Full Usage: this.ExpandYaxis

Parameters:
    startDist : float
    endDist : float

Returns: BRect
Modifiers: inline

Returns a bounding rectangle expanded only in Y direction by different distance for start(minY) and end (maxY). Does check for underflow if distance is negative and raises EuclidException.

startDist : float
endDist : float
Returns: BRect

this.Height2D

Full Usage: this.Height2D

Returns: float
Modifiers: inline

The size in Y direction, same as member rect.SizeY.

Returns: float

this.Intersection

Full Usage: this.Intersection

Parameters:
Returns: BRect voption
Modifiers: inline

Returns the intersection of two bounding rectangles. The returned Rectangle is the volume inside both input Rectangle. Returns ValueNone if the two Rectangles do not overlap.

a : BRect
Returns: BRect voption

this.IsTouching

Full Usage: this.IsTouching

Parameters:
Returns: bool

Test if bounding rectangles are only touching each other from the Outside within a given tolerance.

a : BRect
tol : float
Returns: bool

this.MaxPt

Full Usage: this.MaxPt

Returns: Pt
Modifiers: inline

The point where X, Y and Z are the maximum values.

Returns: Pt

this.MinPt

Full Usage: this.MinPt

Returns: Pt
Modifiers: inline

The point where X, Y and Z are the minimum values.

Returns: Pt

this.OverlapsWith

Full Usage: this.OverlapsWith

Parameters:
Returns: bool
Modifiers: inline

Returns true if the two bounding rectangles do overlap more than a given tolerance distance. Use a negative tolerance to count touching if they are apart by abs(tolerance) Returns false if the two bounding rectangles are just touching or apart. Also returns true if one box is completely inside the other. Also returns true if one box is completely surrounding the other.

a : BRect
tol : float
Returns: bool

this.OverlapsWith

Full Usage: this.OverlapsWith

Parameters:
Returns: bool
Modifiers: inline

Returns true if the two bounding rectangles do overlap or touch. Also returns true if one box is completely inside the other. Also returns true if one box is completely surrounding the other.

a : BRect
Returns: bool

this.Points

Full Usage: this.Points

Returns: Pt[]
 Returns the corners of this bounding rectangle in Counter-Clockwise order, starting at MinPt.
 Returns an array of 4 Points.

   Y-Axis (Height2D)
   ^
   |
   |             2  = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis (Width)
  0 = min X,Y    1
Returns: Pt[]

this.PointsLooped

Full Usage: this.PointsLooped

Returns: Pt[]
 Returns a Counter-Clockwise array of 5 Points, starting at MinPt.
 Last and first point are the same.

   Y-Axis (Height2D)
   ^
   |
   |             2  = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis (Width)
  0 = min X,Y    1
Returns: Pt[]

this.Pt0

Full Usage: this.Pt0

Returns: Pt
 Returns the point (0) or minX, minY.

   Y-Axis (Height2D)
   ^
   |
   |             2 = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis (Width)
  0 = min X,Y      1
Returns: Pt

this.Pt1

Full Usage: this.Pt1

Returns: Pt
 Returns the point (1) or maxX, minY.

   Y-Axis (Height2D)
   ^
   |
   |             2 = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis (Width)
  0 = min X,Y      1
Returns: Pt

this.Pt2

Full Usage: this.Pt2

Returns: Pt
 Returns the point (2) or maxX, maxY.

   Y-Axis (Height2D)
   ^
   |
   |             2 = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis (Width)
  0 = min X,Y      1
Returns: Pt

this.Pt3

Full Usage: this.Pt3

Returns: Pt
 Returns the point (3) or minX, maxY.

   Y-Axis (Height2D)
   ^
   |
   |             2 = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis (Width)
  0 = min X,Y      1
Returns: Pt

this.SizeX

Full Usage: this.SizeX

Returns: float
Modifiers: inline

The size in X direction, same as member rect.Width.

Returns: float

this.SizeY

Full Usage: this.SizeY

Returns: float
Modifiers: inline

The size in Y direction, same as member rect.Height2D.

Returns: float

this.Union

Full Usage: this.Union

Parameters:
Returns: BRect
Modifiers: inline

Returns a bounding rectangle that contains the input Rectangles and the point.

p : Pt
Returns: BRect

this.Union

Full Usage: this.Union

Parameters:
Returns: BRect
Modifiers: inline

Returns a bounding rectangle that contains both input Rectangles.

b : BRect
Returns: BRect

this.Width

Full Usage: this.Width

Returns: float
Modifiers: inline

The size in X direction, same as member rect.SizeX.

Returns: float

Static members

Static member Description

BRect.area r

Full Usage: BRect.area r

Parameters:
Returns: float
Modifiers: inline

Returns the area of this bounding rectangle.

r : BRect
Returns: float

BRect.contains rectInside surroundingRect

Full Usage: BRect.contains rectInside surroundingRect

Parameters:
Returns: bool
Modifiers: inline

Returns true if this bounding rectangle is inside or exactly on the other bounding rectangle. Argument order matters!

rectInside : BRect
surroundingRect : BRect
Returns: bool

BRect.containsPt pt rect

Full Usage: BRect.containsPt pt rect

Parameters:
Returns: bool
Modifiers: inline

Returns true if the point is inside or on this bounding rectangle.

pt : Pt
rect : BRect
Returns: bool

BRect.create (a, b)

Full Usage: BRect.create (a, b)

Parameters:
Returns: BRect
Modifiers: inline

Finds min and max values for x and y.

a : Pt
b : Pt
Returns: BRect

BRect.createFromCenter (center, sizeX, sizeY)

Full Usage: BRect.createFromCenter (center, sizeX, sizeY)

Parameters:
    center : Pt
    sizeX : float
    sizeY : float

Returns: BRect
Modifiers: inline

Creates a bounding rectangle from a center point and the total X and Y size.

center : Pt
sizeX : float
sizeY : float
Returns: BRect

BRect.createFromIList ps

Full Usage: BRect.createFromIList ps

Parameters:
Returns: BRect
Modifiers: inline

Finds min and max values for x and y.

ps : IList<Pt>
Returns: BRect

BRect.createFromLine l

Full Usage: BRect.createFromLine l

Parameters:
Returns: BRect
l : Line2D
Returns: BRect

BRect.createFromSeq ps

Full Usage: BRect.createFromSeq ps

Parameters:
    ps : Pt seq

Returns: BRect
Modifiers: inline

Finds min and max values for x and y.

ps : Pt seq
Returns: BRect

BRect.createUnchecked (minX, minY, maxX, maxY)

Full Usage: BRect.createUnchecked (minX, minY, maxX, maxY)

Parameters:
    minX : float
    minY : float
    maxX : float
    maxY : float

Returns: BRect
Modifiers: inline

Does not verify the order of min and max values.

minX : float
minY : float
maxX : float
maxY : float
Returns: BRect

BRect.doOverlap a b

Full Usage: BRect.doOverlap a b

Parameters:
Returns: bool
Modifiers: inline

Returns true if the two bounding rectangles do overlap or touch exactly. Also returns true if one box is completely inside the other. Also returns true if one box is completely surrounding the other.

a : BRect
b : BRect
Returns: bool

BRect.doOverlapMoreThan tol a b

Full Usage: BRect.doOverlapMoreThan tol a b

Parameters:
Returns: bool
Modifiers: inline

Returns true if the two bounding rectangles do overlap more than a given tolerance distance. Use a negative tolerance to count touching if they are apart by abs(tolerance) Returns false if the two bounding rectangles are just touching or apart. Also returns true if one box is completely inside the other. Also returns true if one box is completely surrounding the other.

tol : float
a : BRect
b : BRect
Returns: bool

BRect.equals tol a b

Full Usage: BRect.equals tol a b

Parameters:
Returns: bool

Checks if two 2D bounding rectangles are equal within tolerance. Use a tolerance of 0.0 to check for an exact match.

tol : float
a : BRect
b : BRect
Returns: bool

BRect.expand dist r

Full Usage: BRect.expand dist r

Parameters:
Returns: BRect

Returns bounding rectangle expanded by distance. Does check for underflow if distance is negative and raises EuclidException.

dist : float
r : BRect
Returns: BRect

BRect.expandSave dist r

Full Usage: BRect.expandSave dist r

Parameters:
Returns: BRect

Returns bounding rectangle expanded by distance. Does check for underflow if distance is negative and raises EuclidException.

dist : float
r : BRect
Returns: BRect

BRect.expandXaxis startDist endDist r

Full Usage: BRect.expandXaxis startDist endDist r

Parameters:
    startDist : float
    endDist : float
    r : BRect

Returns: BRect

Returns bounding rectangle expanded only in X direction by different distance for start(minX) and end (maxX). Does check for underflow if distance is negative and raises EuclidException.

startDist : float
endDist : float
r : BRect
Returns: BRect

BRect.expandYaxis startDist endDist r

Full Usage: BRect.expandYaxis startDist endDist r

Parameters:
    startDist : float
    endDist : float
    r : BRect

Returns: BRect

Returns bounding rectangle expanded only in Y direction by different distance for start(minY) and end (maxY). Does check for underflow if distance is negative and raises EuclidException.

startDist : float
endDist : float
r : BRect
Returns: BRect

BRect.intersection a b

Full Usage: BRect.intersection a b

Parameters:
Returns: BRect voption
Modifiers: inline

Returns the intersection of two bounding rectangles. The returned Rectangle is the volume inside both input Rectangle. Returns ValueNone if the two Rectangles do not overlap.

a : BRect
b : BRect
Returns: BRect voption

BRect.move v r

Full Usage: BRect.move v r

Parameters:
Returns: BRect

Move this bounding rectangle by a vector.

v : Vc
r : BRect
Returns: BRect

BRect.notEquals tol a b

Full Usage: BRect.notEquals tol a b

Parameters:
Returns: bool

Check if two 2D bounding rectangles are not equal within a given tolerance. Use a tolerance of 0.0 to check if the two 2D bounding rectangles are not exactly equal.

tol : float
a : BRect
b : BRect
Returns: bool

BRect.union a b

Full Usage: BRect.union a b

Parameters:
Returns: BRect
Modifiers: inline

Returns a bounding rectangle that contains both input Rectangles.

a : BRect
b : BRect
Returns: BRect

BRect.unionPt p r

Full Usage: BRect.unionPt p r

Parameters:
Returns: BRect
Modifiers: inline

Returns a bounding rectangle that contains the input Rectangles and the point.

p : Pt
r : BRect
Returns: BRect

Type something to start searching.