123456789101112131415161718192021222324252627282930313233343536373839(* Copyright (C) 2023, Francois Berenger
* Tsuda laboratory, The University of Tokyo,
* 5-1-5 Kashiwa-no-ha, Kashiwa-shi, Chiba-ken, 277-8561, Japan.
*
* Implementation of Super-Fibonacci Spirals:
* Fast, Low-Discrepancy Sampling of SO(3)
* Marc Alexa; Proceedings of CVPR, 2022, pp. 8291-8300
* https://openaccess.thecvf.com/content/CVPR2022/html/\
* Alexa_Super-Fibonacci_Spirals_Fast_Low-\
* Discrepancy_Sampling_of_SO3_CVPR_2022_paper.html *)(* both constants are from p4 of the paper *)letphi=sqrt2.0letpsi=1.533751168755204288118041(* core function from Algorithm 1 on p4 of
doc/Alexa_CVPR_2022_SO3sampling.pdf *)letsuper_fibonaccini=lets=(floati)+.0.5inlett=s/.ninletd=Math.two_pi*.sinletc_r=sqrttinletc_R=sqrt(1.0-.t)inletalpha=d/.phiinletbeta=d/.psiinQuat.create(c_r*.sinalpha)(c_r*.cosalpha)(c_R*.sinbeta)(c_R*.cosbeta)letsamplen=Array.initn(super_fibonacci(floatn))letrotations(n:int):Rot.tarray=Array.map(funquat->letaxis,angle=Quat.to_axis_anglequatinRot.of_axis_angleaxisangle)(samplen)