Skip to content

Instantly share code, notes, and snippets.

@LemonSpike
Created April 30, 2021 19:21
Show Gist options
  • Save LemonSpike/be16d9c15c911b9656afd22232859d38 to your computer and use it in GitHub Desktop.
Save LemonSpike/be16d9c15c911b9656afd22232859d38 to your computer and use it in GitHub Desktop.
Manipulating SIMD Vectors to create CGPoint (example reflection)
import UIKit
import simd
var p = SIMD2<Float>(Float(1), Float(1))
var v = SIMD2<Float>(Float(2), Float(1))
var y = simd_reflect(v, p)
var x = CGPoint(x: CGFloat(v[0]), y: CGFloat(v[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment