Commit 1a1b52cb authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Set constant parameter to const.

parent cea8a674
......@@ -34,7 +34,7 @@ init(void)
{
constexpr double pi_5 = M_PI * 0.2;
// first define the vertices of the icosahedron
double z_w = 2.0 * acos(1.0 / (2.0 * sin(pi_5)));
const double z_w = 2.0 * acos(1.0 / (2.0 * sin(pi_5)));
// set poles first - it is simple
vertices[0] = vec3{ {0.0, 0.0, 1.0} };
......@@ -52,9 +52,9 @@ init(void)
for (int j = 1; j < 11; ++j)
{
// toggle the hemisphere
double i_msgn = (j >= 6) ? -1 : 1;
const double i_msgn = (j >= 6) ? -1 : 1;
// compute the meridian angle for the base vertex.
double z_rlon = (1.0 + i_mdist[j - 1]) * pi_5;
const double z_rlon = (1.0 + i_mdist[j - 1]) * pi_5;
// now initialize the coordinates
vertices[j] = vec3{ {sin(z_w) * cos(z_rlon), sin(z_w) * sin(z_rlon), cos(z_w) * i_msgn} };
}
......@@ -87,7 +87,7 @@ static inline vec3
normalizeVector(const vec3 &a)
{
vec3 c;
double magnitude = sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]);
const double magnitude = sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]);
for (unsigned i = 0; i < 3; ++i) c[i] = a[i] / magnitude;
return c;
}
......@@ -163,11 +163,11 @@ dotProduct(const vec3 &a, const vec3 &b)
static inline void
d_normalize(vec3 &v)
{
double dnorm = sqrt(dotProduct(v, v));
const double dnorm = sqrt(dotProduct(v, v));
for (unsigned i = 0; i < 3; ++i) v[i] /= dnorm;
}
vec3
static vec3
circumCenterMean(const vec3 &v0, const vec3 &v1, const vec3 &v2)
{
/*
......@@ -214,7 +214,7 @@ genIcosphereCoords(int subdivisions, bool lbounds, std::vector<double> &xvals, s
VertexList &vertices = mesh.first;
TriangleList &triangles = mesh.second;
size_t ncells = triangles.size();
const size_t ncells = triangles.size();
xvals.resize(ncells);
yvals.resize(ncells);
if (lbounds)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment