Skip to content

Commit 7e9a34b

Browse files
committed
Remove generic
The generic prevents accessing the Self members, like .up in Direction2. It is also reasonable to expect a value to be interpolated only between the same types.
1 parent 4f452bf commit 7e9a34b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/GameMath/2D Types/Vector2.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ extension Vector2 {
173173

174174
extension Vector2 {
175175
@inlinable
176-
public func interpolated<V: Vector2>(to: V, _ method: InterpolationMethod, options: InterpolationOptions = .shortest) -> Self {
176+
public func interpolated(to: Self, _ method: InterpolationMethod, options: InterpolationOptions = .shortest) -> Self {
177177
var copy = self
178178
copy.x.interpolate(to: to.x, method, options: options)
179179
copy.y.interpolate(to: to.y, method, options: options)
180180
return copy
181181
}
182182
@inlinable
183-
public mutating func interpolate<V: Vector2>(to: V, _ method: InterpolationMethod, options: InterpolationOptions = .shortest) {
183+
public mutating func interpolate(to: Self, _ method: InterpolationMethod, options: InterpolationOptions = .shortest) {
184184
self.x.interpolate(to: to.x, method, options: options)
185185
self.y.interpolate(to: to.y, method, options: options)
186186
}

Sources/GameMath/3D Types/Vector3.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,15 @@ extension Vector3 {
285285

286286
extension Vector3 {
287287
@inlinable
288-
public func interpolated<V: Vector3>(to: V, _ method: InterpolationMethod, options: InterpolationOptions = .shortest) -> Self {
288+
public func interpolated(to: Self, _ method: InterpolationMethod, options: InterpolationOptions = .shortest) -> Self {
289289
var copy = self
290290
copy.x.interpolate(to: to.x, method, options: options)
291291
copy.y.interpolate(to: to.y, method, options: options)
292292
copy.z.interpolate(to: to.z, method, options: options)
293293
return copy
294294
}
295295
@inlinable
296-
public mutating func interpolate<V: Vector3>(to: V, _ method: InterpolationMethod, options: InterpolationOptions = .shortest) {
296+
public mutating func interpolate(to: Self, _ method: InterpolationMethod, options: InterpolationOptions = .shortest) {
297297
self.x.interpolate(to: to.x, method, options: options)
298298
self.y.interpolate(to: to.y, method, options: options)
299299
self.z.interpolate(to: to.z, method, options: options)

0 commit comments

Comments
 (0)