Geometry
public struct Geometry
Represents a geometry object.
-
Converts the specified angle from degrees to radians.
Declaration
Swift
public static func radians(_ angle: Double) -> Double
Parameters
angle
A double value, which specifies the angle in degrees.
Return Value
A double value, which specifies the angle in radians.
-
Converts the specified angle from radians to degrees.
Declaration
Swift
public static func degrees(_ angle: Double) -> Double
Parameters
angle
A double value, which specifies the angle in radians.
Return Value
A double value, which specifies the angle in degrees.
-
Converts the cartesian coordinate of the specified point to polar coordinates.
Declaration
-
Converts the polar coordinate of the specifiedpoint to cartesian coordinates.
Declaration
-
Finds the intersection point of two lines.
Declaration
Parameters
m1
The first point of the first line segment.
m2
The second point of the first segment.
n1
The first point of the second line segment.
n2
The second point of the second segment.
Return Value
The point where the two lines intersect. It can be with nan-coordinates if the two lines do not intersect.
-
Calulates the square of the shortest distance between a point and another point defined by its coordinates.
Declaration
Swift
public static func distanceSquared(_ p: Point, x: Double, y: Double) -> Double
Parameters
p
The point.
x
The x-coordinate of the second point.
y
The y-coordinate of the second point.
Return Value
The square of the shortest distance between the points.
-
Normalizes the specified rectangle.
Parameters
rect
The rectangle to normalize.
Return Value
The normalized rectangle.