From c7567975e3d7c426afda11ae7439149db0a789e4 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 13 Dec 2015 01:30:40 +0000 Subject: [PATCH] =?UTF-8?q?math:=20add=20=CF=84=20(tau)=20to=20the=20list?= =?UTF-8?q?=20of=20maths=20constants.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lol/math/constants.h | 18 +++++++++++------- src/math/real.cpp | 15 +++++++++------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/lol/math/constants.h b/src/lol/math/constants.h index 56ac1945..49185987 100644 --- a/src/lol/math/constants.h +++ b/src/lol/math/constants.h @@ -1,18 +1,20 @@ // -// Lol Engine +// Lol Engine // -// Copyright: (c) 2010-2013 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://www.wtfpl.net/ for more details. +// Copyright © 2010—2015 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. // #pragma once // // Various maths constants -// ----------------------- +// ——————————————————————— // #include @@ -27,6 +29,8 @@ namespace lol /* These values are truncated, not rounded, because I don’t care. */ +LOL_MATH_CONSTANT(TAU, 6.28318530717958647692528676655900576839433879875L) + LOL_MATH_CONSTANT(PI, 3.14159265358979323846264338327950288419716939937L) LOL_MATH_CONSTANT(PI_2, 1.57079632679489661923132169163975144209858469968L) LOL_MATH_CONSTANT(PI_3, 1.04719755119659774615421446109316762806572313312L) diff --git a/src/math/real.cpp b/src/math/real.cpp index 76c3c33b..a4b2fe77 100644 --- a/src/math/real.cpp +++ b/src/math/real.cpp @@ -1,11 +1,13 @@ // -// Lol Engine +// Lol Engine // -// Copyright: (c) 2010-2013 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://www.wtfpl.net/ for more details. +// Copyright © 2010—2015 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. // #include @@ -55,6 +57,7 @@ LOL_CONSTANT_GETTER(R_PI, fast_pi()); LOL_CONSTANT_GETTER(R_PI_2, R_PI() / 2); LOL_CONSTANT_GETTER(R_PI_3, R_PI() / R_3()); LOL_CONSTANT_GETTER(R_PI_4, R_PI() / 4); +LOL_CONSTANT_GETTER(R_TAU, R_PI() + R_PI()); LOL_CONSTANT_GETTER(R_1_PI, inverse(R_PI())); LOL_CONSTANT_GETTER(R_2_PI, R_1_PI() * 2); LOL_CONSTANT_GETTER(R_2_SQRTPI, inverse(sqrt(R_PI())) * 2);