我正在研究iPhone的PD测量POC应用程序。我尝试使用其他方法进行Pd测量,但仍然无法获得准确的结果。
我正在从func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor)
获取faceAnchor,这是ARSCNView委托方法。
然后从faceAnchor我得到
faceAnchor.leftEyeTransform:simd_float4x4([[0.99813265,-0.0015954619,0.061063215,0.0],[0.0,0.9996588,0.026119122,0.0],[-0.061084054,-0.026070349,0.9977921,0.0],[0.03364487,0.027366925,0.025988795, 1.0]])
和
faceAnchor.rightEyeTransform:simd_float4x4([[0.99992144,0.00032705365,-0.01253119,0.0],[0.0,0.9996596,0.026090285,0.0],[0.0125354575,-0.026088236,0.99958104,0.0],[-0.03348996,0.027303606,0.025771776 1.0]])
矩阵
然后我通过使用创建了左眼矢量和右眼矢量SCNVector3
func createVector(simdFloat: simd_float4x4) -> SCNVector3 {
return SCNVector3(simdFloat.columns.3.x, simdFloat.columns.3.y, simdFloat.columns.3.z)
}
然后使用
let distanceInMeter = distance(float3(leftEyeVector), float3(rightEyeVector))
let distanceInmm = Float(distanceInMeter * 1000)
我也尝试过
let distanceX = self.x - toVector.x
let distanceY = self.y - toVector.y
let distanceZ = self.z - toVector.z
return fabsf(sqrtf((distanceX * distanceX) + (distanceY * distanceY) + (distanceZ * distanceZ)))
,还尝试使用
创建的glkvector3 func glkVector3FromARFaceAnchorTransform(_ transform: simd_float4) -> GLKVector4 {
return GLKVector4Make(transform.x, transform.y, transform.z, transform.w)
}
,然后
let distanceInMeter = GLKVector3Distance(leftEyePosition, righEyePosition)
我也尝试过
let distanceInMeter = simd_distance(rightEyeTransform.columns.3, leftEyeTransform.columns.3)
我也尝试过blendShapes,但仍然无法获得准确的结果。
你能帮我吗?
您以前从事过这种PD措施吗?
请分享您的想法或一些代码以供参考。
谢谢。