Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Mintfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
realm/SwiftLint@0.63.2
nicklockwood/SwiftFormat@0.59.1
realm/SwiftLint@0.65.0
nicklockwood/SwiftFormat@0.62.1
6 changes: 4 additions & 2 deletions Sources/FirebladeMath/Functions/remap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ extension FloatingPoint {
/// - Returns: The remapped value.
@inlinable
public func remaped(clampingIn rangeClamp: ClosedRange<Self>,
to rangeOut: ClosedRange<Self>) -> Self {
to rangeOut: ClosedRange<Self>) -> Self
{
var v = clamped(to: rangeClamp)
v = v.lerped(from: rangeClamp, to: rangeOut)
return v
Expand All @@ -19,7 +20,8 @@ extension FloatingPoint {
/// - rangeOut: The output range to map to.
@inlinable
public mutating func remap(clampingIn rangeClamp: ClosedRange<Self>,
to rangeOut: ClosedRange<Self>) {
to rangeOut: ClosedRange<Self>)
{
clamp(to: rangeClamp)
lerp(from: rangeClamp, to: rangeOut)
}
Expand Down
18 changes: 12 additions & 6 deletions Sources/FirebladeMath/Matrix/MatrixStorage+SIMD.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import struct simd.matrix.simd_float4x4
/// Conformance to matrix storage protocols.
extension simd_float2x2: Storage2x2Protocol, @retroactive @unchecked Sendable, @retroactive RandomAccessCollection, @retroactive MutableCollection, @retroactive RangeReplaceableCollection,
@retroactive BidirectionalCollection, @retroactive Collection,
@retroactive Sequence {
@retroactive Sequence
{
/// The element type of the matrix storage.
public typealias Element = Float
/// The column vector type of the matrix.
Expand Down Expand Up @@ -58,7 +59,8 @@ extension simd_float2x2: Storage2x2Protocol, @retroactive @unchecked Sendable, @
/// Conformance to matrix storage protocols.
extension simd_double2x2: Storage2x2Protocol, @retroactive @unchecked Sendable, @retroactive RandomAccessCollection, @retroactive MutableCollection, @retroactive RangeReplaceableCollection,
@retroactive BidirectionalCollection, @retroactive Collection,
@retroactive Sequence {
@retroactive Sequence
{
/// The element type of the matrix storage.
public typealias Element = Double
/// The column vector type of the matrix.
Expand Down Expand Up @@ -107,7 +109,8 @@ extension simd_double2x2: Storage2x2Protocol, @retroactive @unchecked Sendable,
/// Conformance to matrix storage protocols.
extension simd_float3x3: Storage3x3Protocol, @retroactive @unchecked Sendable, @retroactive RandomAccessCollection, @retroactive MutableCollection, @retroactive RangeReplaceableCollection,
@retroactive BidirectionalCollection, @retroactive Collection,
@retroactive Sequence {
@retroactive Sequence
{
/// The element type of the matrix storage.
public typealias Element = Float
/// The column vector type of the matrix.
Expand Down Expand Up @@ -160,7 +163,8 @@ extension simd_float3x3: Storage3x3Protocol, @retroactive @unchecked Sendable, @
/// Conformance to matrix storage protocols.
extension simd_double3x3: Storage3x3Protocol, @retroactive @unchecked Sendable, @retroactive RandomAccessCollection, @retroactive MutableCollection, @retroactive RangeReplaceableCollection,
@retroactive BidirectionalCollection, @retroactive Collection,
@retroactive Sequence {
@retroactive Sequence
{
/// The element type of the matrix storage.
public typealias Element = Double
/// The column vector type of the matrix.
Expand Down Expand Up @@ -215,7 +219,8 @@ extension simd_double3x3: Storage3x3Protocol, @retroactive @unchecked Sendable,
/// Conformance to matrix storage protocols.
extension simd_float4x4: Storage4x4Protocol, @retroactive @unchecked Sendable, @retroactive RandomAccessCollection, @retroactive MutableCollection, @retroactive RangeReplaceableCollection,
@retroactive BidirectionalCollection, @retroactive Collection,
@retroactive Sequence {
@retroactive Sequence
{
/// The element type of the matrix storage.
public typealias Element = Float
/// The column vector type of the matrix.
Expand Down Expand Up @@ -274,7 +279,8 @@ extension simd_float4x4: Storage4x4Protocol, @retroactive @unchecked Sendable, @
/// Conformance to matrix storage protocols.
extension simd_double4x4: Storage4x4Protocol, @retroactive @unchecked Sendable, @retroactive RandomAccessCollection, @retroactive MutableCollection, @retroactive RangeReplaceableCollection,
@retroactive BidirectionalCollection, @retroactive Collection,
@retroactive Sequence {
@retroactive Sequence
{
/// The element type of the matrix storage.
public typealias Element = Double
/// The column vector type of the matrix.
Expand Down
17 changes: 0 additions & 17 deletions Sources/FirebladeMath/Quat/Quat4f+Euler.swift
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
// https://www.geometrictools.com/Documentation/EulerAngles.pdf
// https://ntrs.nasa.gov/api/citations/19770024290/downloads/19770024290.pdf
// https://marc-b-reynolds.github.io/math/2017/04/18/TaitEuler.html
// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/
// https://github.com/godotengine/godot/blob/master/core/math/basis.cpp
// https://github.com/LinuxCNC/linuxcnc/blob/master/src/libnml/posemath/_posemath.c
// https://github.com/OGRECave/ogre/blob/84ae9396322a39f766b7acaeb9a1b15f4c51d261/OgreMain/src/OgreMatrix3.cpp#L858
// https://github.com/g-truc/glm/blob/master/glm/gtx/euler_angles.inl
// https://github.com/bulletphysics/bullet3/blob/abea1a848411cf53385fb8288c89db05e5751ef7/src/Bullet3Common/b3Quaternion.h#L162
// https://github.com/demianmnave/CML/blob/9ebc0ed72637959fe7323d2a6a12664236509031/cml/mathlib/quaternion/rotation.h#L101
// http://de.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm--euler-angles--quaternions--and-euler-vectors
// https://scholar.google.de/scholar?cluster=3204262265835591787
// http://de.mathworks.com/help/robotics/ref/quat2eul.html
// https://math.stackexchange.com/a/1803746
// https://hanspeterschaub.info/AVS-Code.html
// https://marc-b-reynolds.github.io/math/2017/04/18/TaitEuler.html

extension Quat4f {
// public static func fromEulerAngles_121(_ e: Vec3f) -> Quat4f {
// let e1 = e.x / 2
Expand Down
Loading