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
s1The first point of the first segment.
s2The second point of the first segment.
l1The first point of the second segment.
l2The second point of the second segment.
ptThe 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
s1The first point of the first line.
s2The second point of the first line.
l1The first point of the second line.
l2The 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
rcThe 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
pointsAn array of Point objects, which defines the Bézier curve.
startIdxThe index of the first point to be processed in points.
qualityThe 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
rc1The first rectangle.
rc2The 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
rcBoxThe rectangle.
pt1The first point of the line.
pt2The second point of the line.
ptThe intersection point.
Utilities Structure Reference