Skip to content

Commit

Permalink
make length a var
Browse files Browse the repository at this point in the history
  • Loading branch information
ConfusedVorlon committed Sep 30, 2021
1 parent 35ddc67 commit dd028fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/HSHelpers/Types/Vectors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public protocol Vector {
init(_ vector:Vector)

func floor <T: Vector>() -> T
func length() -> CGFloat
var length:CGFloat {get}
}

//As long as each type has x & y, we can generate the others
Expand Down Expand Up @@ -79,7 +79,7 @@ public extension Vector {
return T(x: self.x.rounded(.down), y:self.y.rounded(.down))
}

func length() -> CGFloat
var length:CGFloat
{
return sqrt(self.x * self.x + self.y * self.y)
}
Expand Down Expand Up @@ -197,6 +197,7 @@ public extension Vector {
}

extension CGSize: Vector {

public init(_ vector:Vector){
self.init(x: vector.x, y: vector.y)
}
Expand Down

0 comments on commit dd028fa

Please sign in to comment.