Skip to content

Commit d25cd2e

Browse files
committed
Point: add some documentation comments (NFC)
Add some missing documentation comments and section markers for `Point`.
1 parent d9c77c1 commit d25cd2e

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

Sources/SwiftWin32/CG/Point.swift

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,46 @@
11
// Copyright © 2019 Saleem Abdulrasool <[email protected]>
22
// SPDX-License-Identifier: BSD-3-Clause
33

4+
/// A structure that contains a point in a two-dimensional coordinate system.
45
public struct Point {
5-
public static let zero: Point = Point(x: 0, y: 0)
6-
7-
public var x: Double
8-
public var y: Double
9-
10-
public init(x: Float, y: Float) {
11-
self.init(x: Double(x), y: Double(y))
12-
}
6+
// MARK - Creating Point Values
137

8+
/// Creates a point with coordinates specified as floating-point values.
149
public init(x: Double, y: Double) {
1510
self.x = x
1611
self.y = y
1712
}
1813

14+
/// Creates a point with coordinates specified as integer values.
1915
public init(x: Int, y: Int) {
2016
self.init(x: Double(x), y: Double(y))
2117
}
2218

19+
// MARK - Special Values
20+
21+
/// The point with location (0,0).
22+
public static var zero: Point {
23+
Point(x: 0, y: 0)
24+
}
25+
26+
/// Creates a point with location (0,0).
27+
public init() {
28+
self.x = 0.0
29+
self.y = 0.0
30+
}
31+
32+
// MARK - Geometric Properties
33+
34+
/// The x-coordinate of the point.
35+
public var x: Double
36+
37+
/// The y-coordinate of the point.
38+
public var y: Double
39+
40+
// MARK - Transforming Points
41+
42+
/// Returns the point resulting from an affine transformation of an existing
43+
/// point.
2344
public func applying(_ transform: AffineTransform) -> Point {
2445
return Point(x: transform.a * self.x + transform.c * self.y + transform.tx,
2546
y: transform.b * self.x + transform.d * self.y + transform.ty)

0 commit comments

Comments
 (0)