Skip to content

Instantly share code, notes, and snippets.

@FlexMonkey
Created March 18, 2016 11:23
Show Gist options
  • Save FlexMonkey/0d938db6e42ca97911a5 to your computer and use it in GitHub Desktop.
Save FlexMonkey/0d938db6e42ca97911a5 to your computer and use it in GitHub Desktop.
CIVector extension to multiply each component by a single CIFloat
extension CIVector
{
func multiply(value: CGFloat) -> CIVector
{
let n = self.count
var targetArray = [CGFloat]()
for i in 0 ..< n
{
targetArray.append(self.valueAtIndex(i) * value)
}
return CIVector(values: targetArray, count: n)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment