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
Record fields
| Record Field |
Description
|
Full Usage:
MaxX
Field type: float
|
The fields holding the maximum X value of this bounding rectangle.
|
Full Usage:
MaxY
Field type: float
|
The fields holding the maximum Y value of this bounding rectangle.
|
Full Usage:
MinX
Field type: float
|
The fields holding the minimum X value of this bounding rectangle.
|
Full Usage:
MinY
Field type: float
|
The fields holding the minimum Y value of this bounding rectangle.
|
Instance members
| Instance member |
Description
|
Full Usage:
this.Area
Returns: float
Modifiers: inline |
Returns the area of this bounding rectangle.
|
Full Usage:
this.AsFSharpCode
Returns: string
|
Format bounding rectangle into an F# code string that can be used to recreate the rectangle.
|
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()
|
|
The center of the bounding rect.
|
|
Returns TRUE if the Rectangle is inside or exactly on the other bounding rectangle.
|
|
|
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.
|
|
The diagonal 2D vector of the bounding rect. From MinPt to MaxPt.
|
|
The bottom edge. The line from point 0 to 1.
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)
|
|
The right edge. The line from point 1 to 2.
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)
|
|
The top edge. The line from point 2 to 3.
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)
|
|
The left edge. The line from point 3 to 0.
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)
|
Full Usage:
this.EvaluateAt
Parameters:
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.
|
|
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).
|
|
Returns a bounding rectangle expanded by distance. Does check for underflow if distance is negative and raises EuclidException.
|
|
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.
|
Full Usage:
this.ExpandSafe
Parameters:
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.
|
Full Usage:
this.ExpandXaxis
Parameters:
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.
|
Full Usage:
this.ExpandYaxis
Parameters:
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.
|
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
|
|
|
Full Usage:
this.IsLine
Returns: bool
Modifiers: inline |
Tests if one of the X or Y axis is smaller than the zeroLength tolerance.
|
Full Usage:
this.IsPoint
Returns: bool
Modifiers: inline |
Tests if all sides are smaller than the zeroLength tolerance. This is the same as IsZero.
|
Full Usage:
this.IsTouching
Parameters:
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.
|
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
|
Full Usage:
this.IsZero
Returns: bool
Modifiers: inline |
Tests if all sides are smaller than the zeroLength tolerance. This is the same as IsPoint.
|
Full Usage:
this.LongestEdge
Returns: float
Modifiers: inline |
Returns the longest edge of the Box.
|
|
The point where X and Y are the maximum values.
|
|
The point where X and Y are the minimum values.
|
Full Usage:
this.OverlapsWith
Parameters:
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.
|
|
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.
|
|
Returns the corners of this bounding rectangle in Counter-Clockwise order, starting at MinPt. Returns an array of 4 Points.
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)
|
|
Returns a Counter-Clockwise array of 5 Points, starting at MinPt. Last and first point are the same.
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)
|
Returns the point (0) or minX, minY.
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)
|
|
Returns the point (1) or maxX, minY.
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)
|
|
Returns the point (2) or maxX, maxY.
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)
|
|
Returns the point (3) or minX, maxY.
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)
|
|
Full Usage:
this.ShortestEdge
Returns: float
Modifiers: inline |
Returns the shortest edge of the Box.
|
Full Usage:
this.SizeX
Returns: float
Modifiers: inline |
The size in X direction.
|
Full Usage:
this.SizeY
Returns: float
Modifiers: inline |
The size in Y direction.
|
|
|
|
Static members
| Static member |
Description
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
BRect.createUnchecked (minX, minY, maxX, maxY)
Parameters:
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.
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
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.
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
Euclid