Skip to content

Commit b86f5cd

Browse files
markuswntrstephentyrone
authored andcommitted
Add links to documentation and fix typo in comment
1 parent 0ff14df commit b86f5cd

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Sources/QuaternionModule/Transformation.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Transformation
22

3-
`Transformation.swift` encapsulates an API for working with other representations of transformations, such as *Angle-Axis*, *Polar* and *Rotation Vector*. The API provides operations to convert from these representations to `Quaternion` and vice versa.
3+
`Transformation.swift` encapsulates an API for working with other representations of transformations, such as [*Angle-Axis*][angle_axis_wiki], [*Polar*][polar_wiki] and [*Rotation Vector*][rotation_vector_wiki]. The API provides operations to convert from these representations to `Quaternion` and vice versa.
44
Additionally, the API provides a method to directly rotate an arbitrary vector by a quaternion and thus avoids the calculation of an intermediate representation to any other form in the process.
55

66
## Policies
@@ -16,3 +16,8 @@ Additionally, the API provides a method to directly rotate an arbitrary vector b
1616
- the `axis` property of `angle == .zero` is `RealType.nan` in all lanes.
1717
- the `rotationVector` property of `angle == .zero` is `RealType.nan` in all lanes.
1818

19+
20+
[angle_axis_wiki]: https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Recovering_the_axis-angle_representation
21+
[polar_wiki]: https://en.wikipedia.org/wiki/Polar_decomposition#Quaternion_polar_decomposition
22+
[rotation_vector_wiki]: https://en.wikipedia.org/wiki/Axis–angle_representation#Rotation_vector
23+

Tests/QuaternionTests/TransformationTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,15 @@ final class TransformationTests: XCTestCase {
237237
let vrot = (q // q
238238
* Quaternion(imaginary: vector) // v (pure quaternion)
239239
* q.conjugate // q⁻¹ (as q is of unit length, q⁻¹ == q*)
240-
).imaginary // the result is pure quaternion with v' == imaginary
240+
).imaginary // the result is a pure quaternion with v' == imaginary
241241

242242
XCTAssertTrue(q.act(on: vector).x.isFinite)
243243
XCTAssertTrue(q.act(on: vector).y.isFinite)
244244
XCTAssertTrue(q.act(on: vector).z.isFinite)
245245
// Test for sign equality on the components to see if the vector rotated
246-
// to the correct quadrant and if the vector is of equal in length,
247-
// instead of testing component equality – as they are hard to compare
248-
// with proper tolerance
246+
// to the correct quadrant and if the vector is of equal length, instead
247+
// of testing component equality – as they are hard to compare with
248+
// proper tolerance
249249
XCTAssertEqual(q.act(on: vector).x.sign, vrot.x.sign)
250250
XCTAssertEqual(q.act(on: vector).y.sign, vrot.y.sign)
251251
XCTAssertEqual(q.act(on: vector).z.sign, vrot.z.sign)
@@ -274,7 +274,7 @@ final class TransformationTests: XCTestCase {
274274

275275
// An axis perpendicular to the vector, so all lanes are changing equally
276276
let axis = SIMD3<T>(1/2,0,-1/2)
277-
// Create a value close (somewhat) close to .greatestFiniteMagnitude
277+
// Create a value (somewhat) close to .greatestFiniteMagnitude
278278
let scalar = T(
279279
sign: .plus, exponent: T.greatestFiniteMagnitude.exponent,
280280
significand: 1.999999

0 commit comments

Comments
 (0)