【发布时间】:2017-08-30 17:23:44
【问题描述】:
这可能更像是一个线性代数问题,但假设我有一个 SCNVector,我想要一个新的 SCNVector,它与围绕 y 轴(或任何轴)的原始 SCNVector 成一定角度。所以理想情况下:
extension SCNVector3 {
// assume dot, cross, length, +, - functions are available.
enum Axis {
case x, y, z
}
func rotatedVector(aroundAxis: Axis, angle: Float) -> SCNVector3 {
// code from smart person goes here
}
}
例如(0,0,-1).rotatedVector(aroundAxis: y, angle: pi/2) = (1,0,0)
谢谢!
【问题讨论】:
标签: ios linear-algebra scenekit trigonometry