templated FibonacciPt function on ScalarType
This commit is contained in:
parent
67cfacf2c6
commit
303be4bbd0
|
@ -62,7 +62,7 @@ static Point3x FibonacciPt(int i, int n)
|
||||||
const ScalarType Phi = ScalarType(sqrt(5)*0.5 + 0.5);
|
const ScalarType Phi = ScalarType(sqrt(5)*0.5 + 0.5);
|
||||||
const ScalarType phi = 2.0*M_PI* (i/Phi - floor(i/Phi));
|
const ScalarType phi = 2.0*M_PI* (i/Phi - floor(i/Phi));
|
||||||
ScalarType cosTheta = 1.0 - (2*i + 1.0)/ScalarType(n);
|
ScalarType cosTheta = 1.0 - (2*i + 1.0)/ScalarType(n);
|
||||||
float sinTheta = 1 - cosTheta*cosTheta;
|
ScalarType sinTheta = 1 - cosTheta*cosTheta;
|
||||||
sinTheta = sqrt(std::min(ScalarType(1),std::max(ScalarType(0),sinTheta)));
|
sinTheta = sqrt(std::min(ScalarType(1),std::max(ScalarType(0),sinTheta)));
|
||||||
return Point3x(
|
return Point3x(
|
||||||
cos(phi)*sinTheta,
|
cos(phi)*sinTheta,
|
||||||
|
|
Loading…
Reference in New Issue