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.ContainsXY
Parameters:
float
y : float
Returns: bool
Modifiers: inline |
Returns TRUE if the point is inside or exactly on this 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 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.
|
|
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.
|
|
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).
|
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.
|
|
Returns TRUE if the two 2D 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.
|
Full Usage:
this.IsOverlappingOrClose
Parameters:
BRect
tolerance : float
Returns: bool
Modifiers: inline |
Returns TRUE if the two 2D bounding rectangles do overlap or are apart less than the specified tolerance. Also returns TRUE if one box is completely inside the other. Also returns TRUE if one box is completely surrounding the other. A negative tolerance shrinks the effective boundaries instead of expanding them. The math works out symmetrically:
|
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
?tolerance : float
Returns: bool
Modifiers: inline |
Returns TRUE if the two 2D bounding rectangles are just touching within the tolerance. The default tolerance is 1e-6.But can also be specified as a parameter. Returns FALSE if one box is completely inside the other. Returns FALSE if one box is completely surrounding the other.
|
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.
|
|
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.
|
Full Usage:
this.TouchingSide
Parameters:
BRect
?tolerance : float
Returns: int
Modifiers: inline |
Returns a value from -1 to 6 indicating the side on which the two 2D
are just touching within the tolerance.
The default tolerance is 1e-6.But can also be specified as a parameter.
-1 : not touching but overlapping / one inside the other
0 : not touching, apart on at least one axis by more than tolerance
1 : other is in front of this (this.MinX touches other.MaxX)
2 : other is behind this (this.MaxX touches other.MinX)
3 : other is to the left of this (this.MinY touches other.MaxY)
4 : other is to the right of this (this.MaxY touches other.MinY)
5 : this.MinZ touches other.MaxZ
6 : this.MaxZ touches other.MinZ
|
|
|
|
Static members
| Static member |
Description
|
|
|
|
Format bounding rectangle into an F# code string that can be used to recreate the rectangle.
|
|
Format bounding rectangle into string with nice floating point number formatting of size and position. But without full type name as in rect.ToString()
|
|
|
|
|
|
|
Full Usage:
BRect.containsXY x y rect
Parameters:
float
y : float
rect : BRect
Returns: bool
Modifiers: inline |
Returns TRUE if the point is inside or on this bounding rectangle.
|
|
Counts the amount of sides that are smaller than the zeroLength tolerance. This is 0, 1, or 2.
|
|
|
|
|
|
|
|
|
|
|
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.
|
Full Usage:
BRect.createXY (ptAx, ptAy, ptBx, ptBy)
Parameters:
float
-
X value of point A
ptAy : float
-
Y value of point A
ptBx : float
-
X value of point B
ptBy : float
-
Y value of point B
Returns: BRect
A bounding rectangle that contains both points A and B.
Modifiers: inline |
Finds min and max values points A and B given as separate X and Y values.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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. 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 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.
|
|
|
|
|
|
|
|
Tests if none of the X and Y axis is smaller than the zeroLength tolerance. Same as .IsValid.
|
|
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.
|
|
|
|
|
|
Returns TRUE if the two 2D bounding rectangles do overlap or are apart less than the specified tolerance. Also returns TRUE if one box is completely inside the other. Also returns TRUE if one box is completely surrounding the other. A negative tolerance shrinks the effective boundaries instead of expanding them. The math works out symmetrically:
|
|
Tests if all sides are smaller than the zeroLength tolerance. This is the same as IsZero.
|
|
|
|
Tests if no sides of the X and Y axis is smaller than the zeroLength tolerance. Same as .HasArea.
|
|
Tests if all sides are smaller than the zeroLength tolerance. This is the same as IsPoint.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
Nicely formatted string representation of the bounding rectangle, including its size.
|
|
Returns a value from -1 to 6 indicating the side on which the two 2D
are just touching within a given specified tolerance.
-1 : not touching but overlapping / one inside the other
0 : not touching, apart on at least one axis by more than tolerance
1 : other is in front of this (this.MinX touches other.MaxX)
2 : other is behind this (this.MaxX touches other.MinX)
3 : other is to the left of this (this.MinY touches other.MaxY)
4 : other is to the right of this (this.MaxY touches other.MinY)
5 : this.MinZ touches other.MaxZ
6 : this.MaxZ touches other.MinZ
|
|
|
|
|
|
Euclid