w/ simd_quatf(from:, to:) … Have been playing with Vectrex style line drawing on the Vision Pro … using thin cylinders though prob better to use a box or perpendicular planes.
let mid = SIMD3(
x: (from.x + to.x) / 2,
y: (from.y + to.y) / 2,
z: (from.z + to.z) / 2 )
let len = simd_distance(from, to)
let v1 = simd_float3(0.0, 1.0, 0.0)
let v2 = simd_normalize( simd_float3(
(to.x - from.x),
(to.y - from.y),
(to.z - from.z) ))
let line = ModelEntity(mesh: .generateCylinder(height: len, radius: 0.001), materials: [mat])
line.orientation = simd_quatf(from: v1, to: v2)
line.position = mid