Utilities
public struct Utilities
Contains common helper methods.
-
Checks whether the segments defined by the specified point pairs intersect and returns the intersection point.
Declaration
Parameters
s1
The first point of the first segment.
s2
The second point of the first segment.
l1
The first point of the second segment.
l2
The second point of the second segment.
pt
The intersection point if any.
Return Value
true if the segments intersect; otherwise false.
-
Finds the intersection point of the lines defined by the specified point pairs.
Declaration
Parameters
s1
The first point of the first line.
s2
The second point of the first line.
l1
The first point of the second line.
l2
The second point of the second line.
Return Value
The intersection point or nil if none is found.
-
Calculate the intersection point between the ellipse with the specified bounds and the line segment defined by the specified points.
Declaration
-
Normalizes the specified rectangle ensuring its height and width are non-negative numbers.
Parameters
rc
The rectangle to normalize.
Return Value
The normalized rectangle.
-
Approximates the specified Bézier curve with a polyline. The specified quality parameter varies in the interval [1, …) and is proportional to the number of points in the resulting polyline.
Declaration
Parameters
points
An array of Point objects, which defines the Bézier curve.
startIdx
The index of the first point to be processed in points.
quality
The quality of the produced approximation.
Return Value
A list with Point objects, which contain the calculated approximation.
-
Returns the smallest possible rectangle containing both of the specified rectangles if they are not empty.
Parameters
rc1
The first rectangle.
rc2
The second rectangle.
Return Value
A rectangle that represents the union of the specified arguments.
-
Gets the point where the specified rectangle is crossed by the specified line.
Declaration
Parameters
rcBox
The rectangle.
pt1
The first point of the line.
pt2
The second point of the line.
pt
The intersection point.