Commit 6fe0fa84 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

define _USE_MATH_DEFINES

parent dbfdfb26
// modified code from:
// https://schneide.wordpress.com/2016/07/15/generating-an-icosphere-in-c
#include "vector3d.h"
#include <stdio.h>
#include <cmath>
#include <iostream>
#include <vector>
#include <array>
#include <map>
#include "vector3d.h"
using Index = size_t;
using Vertex = Vector3d;
using Triangle = std::array<Index, 3>;
......@@ -84,7 +83,7 @@ subdivide(VertexList &vertices, TriangleList triangles)
Lookup lookup;
Triangle mid;
size_t n = triangles.size();
const size_t n = triangles.size();
TriangleList result(4*n);
for (size_t i = 0; i < n; ++i)
{
......
......@@ -18,6 +18,10 @@
#ifndef VECTOR3D_H
#define VECTOR3D_H
#define _USE_MATH_DEFINES
#include <cmath>
class Vector3d
{
private:
......@@ -80,12 +84,12 @@ public:
// Calculate the dot/inner/scalar product
double operator* (const Vector3d &other) const
{
return (X * other.X) + (Y* other.Y) + (Z * other.Z);
return (X * other.X) + (Y * other.Y) + (Z * other.Z);
}
double magnitude() const
{
return sqrt((X * X) + (Y * Y) + (Z * Z));
return std::sqrt((X * X) + (Y * Y) + (Z * Z));
}
Vector3d normalised() const
......@@ -101,12 +105,12 @@ public:
*/
double longitude() const
{
return atan2(Y, X);
return std::atan2(Y, X);
}
double latitude() const
{
return M_PI_2 - acos(Z);
return M_PI_2 - std::acos(Z);
}
};
......
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