Header menu logo Euclid

BRect Type

A struct of 4 floats representing 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
   ^
   |
   |             2 max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |       local
   +------------+-----> X-Axis
  0-min X,Y      1
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)

Record fields

Record Field Description

MaxX

Full Usage: MaxX

Field type: float

The fields holding the maximum X value of this bounding rectangle.

Field type: float

MaxY

Full Usage: MaxY

Field type: float

The fields holding the maximum Y value of this bounding rectangle.

Field type: float

MinX

Full Usage: MinX

Field type: float

The fields holding the minimum X value of this bounding rectangle.

Field type: float

MinY

Full Usage: MinY

Field type: float

The fields holding the minimum Y value of this bounding rectangle.

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.AsFSharpCode

Full Usage: this.AsFSharpCode

Returns: string

Format bounding rectangle into an F# code string that can be used to recreate the rectangle.

Returns: string

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.CountZeroSides

Full Usage: this.CountZeroSides

Returns: int
Modifiers: inline

Counts the amount of sides that are smaller than the zeroLength tolerance. This is 0, 1, or 2.

Returns: int

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
   ^
   |
   |             2  = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis
  0 = min X,Y    1
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)

Returns: Line2D

this.Edge12

Full Usage: this.Edge12

Returns: Line2D

The right edge. The line from point 1 to 2.

   Y-Axis
   ^
   |
   |             2  = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis
  0 = min X,Y    1
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)

Returns: Line2D

this.Edge23

Full Usage: this.Edge23

Returns: Line2D

The top edge. The line from point 2 to 3.

   Y-Axis
   ^
   |
   |             2  = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis
  0 = min X,Y    1
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)

Returns: Line2D

this.Edge30

Full Usage: this.Edge30

Returns: Line2D

The left edge. The line from point 3 to 0.

   Y-Axis
   ^
   |
   |             2  = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis
  0 = min X,Y    1
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)

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 returns the MinPt.
  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. Raises EuclidException if the resulting rectangle would be invalid (Min > Max).

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.ExpandSafe

Full Usage: this.ExpandSafe

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 prevents the rectangle from collapsing past its center. When the negative expansion is bigger than the size, Min and Max values will be both at the center point.

dist : float
Returns: BRect

this.ExpandSafe

Full Usage: this.ExpandSafe

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 prevents the rectangle from collapsing past its center. When the negative expansion is bigger than the size, Min and Max values will be both at the center point.

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 distances 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 distances for start(minY) and end (maxY). Does check for underflow if distance is negative and raises EuclidException.

startDist : float
endDist : float
Returns: BRect

this.HasArea

Full Usage: this.HasArea

Returns: bool
Modifiers: inline

Tests if none of the X and Y axis is smaller than the zeroLength tolerance. Same as .IsValid

Returns: bool

this.Intersection

Full Usage: this.Intersection

Parameters:
Returns: BRect voption
Modifiers: inline

Returns the intersection of two bounding rectangles. The returned Rectangle is the area that is inside both input Rectangles. Returns ValueNone if the two Rectangles do not overlap. Just touching Rectangles will return ValueSome with zero area collapsed BRect.

a : BRect
Returns: BRect voption

this.IsLine

Full Usage: this.IsLine

Returns: bool
Modifiers: inline

Tests if one of the X or Y axis is smaller than the zeroLength tolerance.

Returns: bool

this.IsPoint

Full Usage: this.IsPoint

Returns: bool
Modifiers: inline

Tests if all sides are smaller than the zeroLength tolerance. This is the same as IsZero.

Returns: bool

this.IsTouching

Full Usage: this.IsTouching

Parameters:
    a : BRect - Other 2D bounding rectangle to test against.
    ?tol : float - Optional. A tolerance for touching test. Default is 1e-6.

Returns: bool TRUE if the two 2D bounding rectangles are touching each other within the given tolerance. FALSE if the two 2D bounding rectangles are overlapping or intersecting.

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

a : BRect

Other 2D bounding rectangle to test against.

?tol : float

Optional. A tolerance for touching test. Default is 1e-6.

Returns: bool

TRUE if the two 2D bounding rectangles are touching each other within the given tolerance. FALSE if the two 2D bounding rectangles are overlapping or intersecting.

this.IsValid

Full Usage: this.IsValid

Returns: bool
Modifiers: inline

Tests if no sides of the X and Y axis is smaller than the zeroLength tolerance. Same as .HasArea

Returns: bool

this.IsZero

Full Usage: this.IsZero

Returns: bool
Modifiers: inline

Tests if all sides are smaller than the zeroLength tolerance. This is the same as IsPoint.

Returns: bool

this.LongestEdge

Full Usage: this.LongestEdge

Returns: float
Modifiers: inline

Returns the longest edge of the Box.

Returns: float

this.MaxPt

Full Usage: this.MaxPt

Returns: Pt
Modifiers: inline

The point where X and Y are the maximum values.

Returns: Pt

this.MinPt

Full Usage: this.MinPt

Returns: Pt
Modifiers: inline

The point where X and Y are the minimum values.

Returns: Pt

this.OverlapsWith

Full Usage: this.OverlapsWith

Parameters:
    a : BRect - The bounding rectangle to test for overlap with.
    ?tol : float - The tolerance distance. Use a negative tolerance to count touching if they are apart by abs(tolerance). Default is 1e-6.

Returns: bool Returns TRUE if: - The rectangles overlap by more than the tolerance distance - One rectangle is completely inside the other - One rectangle completely surrounds the other Returns FALSE if: - The rectangles are just touching (within tolerance) - The rectangles are separated
Modifiers: inline

Determines whether two bounding rectangles overlap more than a given tolerance distance.

a : BRect

The bounding rectangle to test for overlap with.

?tol : float

The tolerance distance. Use a negative tolerance to count touching if they are apart by abs(tolerance). Default is 1e-6.

Returns: bool

Returns TRUE if: - The rectangles overlap by more than the tolerance distance - One rectangle is completely inside the other - One rectangle completely surrounds the other Returns FALSE if: - The rectangles are just touching (within tolerance) - The rectangles are separated

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 bounding rect is completely inside the other. Also returns TRUE if one bounding rect 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
   ^
   |
   |             2  = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis
  0 = min X,Y    1
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)

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
   ^
   |
   |             2  = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis
  0 = min X,Y    1
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)

Returns: Pt[]

this.Pt0

Full Usage: this.Pt0

Returns: Pt

Returns the point (0) or minX, minY.

   Y-Axis
   ^
   |
   |             2 = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis
  0 = min X,Y      1
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)

Returns: Pt

this.Pt1

Full Usage: this.Pt1

Returns: Pt

Returns the point (1) or maxX, minY.

   Y-Axis
   ^
   |
   |             2 = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis
  0 = min X,Y      1
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)

Returns: Pt

this.Pt2

Full Usage: this.Pt2

Returns: Pt

Returns the point (2) or maxX, maxY.

   Y-Axis
   ^
   |
   |             2 = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis
  0 = min X,Y      1
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)

Returns: Pt

this.Pt3

Full Usage: this.Pt3

Returns: Pt

Returns the point (3) or minX, maxY.

   Y-Axis
   ^
   |
   |             2 = max X,Y
 3 +------------+
   |            |
   |            |
   |            |
   |            |
   |            |
   +------------+-----> X-Axis
  0 = min X,Y      1
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)

Returns: Pt

this.ShortestEdge

Full Usage: this.ShortestEdge

Returns: float
Modifiers: inline

Returns the shortest edge of the Box.

Returns: float

this.SizeX

Full Usage: this.SizeX

Returns: float
Modifiers: inline

The size in X direction.

Returns: float

this.SizeY

Full Usage: this.SizeY

Returns: float
Modifiers: inline

The size in Y direction.

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

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. Fails if sizeX or sizeY is negative.

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. Fails if the IList is null or empty.

ps : IList<Pt>
Returns: BRect

BRect.createFromLine l

Full Usage: BRect.createFromLine l

Parameters:
Returns: BRect
Modifiers: inline

Creates a bounding rectangle of a line.

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. Fails if the sequence is null or empty.

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. Creates a new bounding rectangle.

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 bounding rect is completely inside the other. Also returns TRUE if one bounding rect 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 bounding rect is completely inside the other. Also returns TRUE if one bounding rect 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
Modifiers: inline

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
Modifiers: inline

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

dist : float
r : BRect
Returns: BRect

BRect.expandRel factor r

Full Usage: BRect.expandRel factor r

Parameters:
    factor : float
    r : BRect

Returns: BRect

Returns the 2D bounding rectangle expanded by a relative factor on all four sides. Values between 0.0 and 1.0 shrink the rectangle. Values larger than 1.0 expand the rectangle. Does check for underflow if factor is negative and raises EuclidException.

factor : float
r : BRect
Returns: BRect

BRect.expandRelXY factorX factorY r

Full Usage: BRect.expandRelXY factorX factorY r

Parameters:
    factorX : float
    factorY : float
    r : BRect

Returns: BRect

Returns the 2D bounding rectangle expanded by a relative factor on all four sides, separately for X and Y. Values between 0.0 and 1.0 shrink the rectangle. Values larger than 1.0 expand the rectangle. Does check for underflow if any factor is negative and raises EuclidException.

factorX : float
factorY : float
r : BRect
Returns: BRect

BRect.expandSafe dist r

Full Usage: BRect.expandSafe dist r

Parameters:
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.

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
Modifiers: inline

Returns bounding rectangle expanded only in X direction by different distances 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
Modifiers: inline

Returns bounding rectangle expanded only in Y direction by different distances 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 area that is inside both input Rectangles. Returns ValueNone if the two Rectangles do not overlap. Just touching Rectangles will return ValueSome with zero area collapsed BRect.

a : BRect
b : BRect
Returns: BRect voption

BRect.move v r

Full Usage: BRect.move v r

Parameters:
Returns: BRect
Modifiers: inline

Returns a new 2D-bounding-rectangle moved by a vector. This is the same as translate.

v : Vc
r : BRect
Returns: BRect

BRect.moveX translation r

Full Usage: BRect.moveX translation r

Parameters:
    translation : float
    r : BRect

Returns: BRect
Modifiers: inline

Returns a new 2D-bounding-rectangle moved in X-axis direction.

translation : float
r : BRect
Returns: BRect

BRect.moveY translation r

Full Usage: BRect.moveY translation r

Parameters:
    translation : float
    r : BRect

Returns: BRect
Modifiers: inline

Returns a new 2D-bounding-rectangle moved in Y-axis direction.

translation : float
r : BRect
Returns: BRect

BRect.notEquals tol a b

Full Usage: BRect.notEquals tol a b

Parameters:
Returns: bool
Modifiers: inline

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.scale factor r

Full Usage: BRect.scale factor r

Parameters:
    factor : float
    r : BRect

Returns: BRect
Modifiers: inline

Scales the 2D bounding rectangle by a given factor. Scale center is World Origin 0,0. A factor of 0.0 will collapse the rectangle to a point at the origin. Negative factors would flip the rectangle, breaking the Min/Max invariant, so this is raising an EuclidException.

factor : float
r : BRect
Returns: BRect

BRect.translate v r

Full Usage: BRect.translate v r

Parameters:
Returns: BRect
Modifiers: inline

Returns a new 2D-bounding-rectangle moved by a vector. This is the same as move.

v : Vc
r : BRect
Returns: BRect

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.