Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprint1 circle #14

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9d41e15
Added circle and sphere coliision
EthanCavadia Feb 11, 2020
d81c84d
Added circle and sphere contact
EthanCavadia Feb 17, 2020
b3638b3
Test square circle contact
EthanCavadia Feb 18, 2020
a8c04c2
Circle square contact working, started plan sphere contact
EthanCavadia Feb 18, 2020
cc18ef3
Circle plan contact working
EthanCavadia Feb 18, 2020
832032e
Circle plan contact working
EthanCavadia Feb 18, 2020
2211d54
Changed TestContact
EthanCavadia Feb 19, 2020
66b7ac8
Merge branch 'develop' into sprint1_circle
EthanCavadia Mar 30, 2020
f8fdff8
added test circle and functions names modified in circle.h
AdamNaji Mar 31, 2020
dd39cae
Merge branch 'develop' into sprint1_circle
AdamNaji Mar 31, 2020
3f01758
test_circle fixed
AdamNaji Mar 31, 2020
65480a4
Added benchmark_circle.cpp and benchmark of the circle.h function
EthanCavadia Apr 1, 2020
9c3576d
Resolved conflict for branch 'sprint1_circle'.
EthanCavadia Apr 1, 2020
e5fa9e9
Added Sphere and Plan structure and modified the benchmark of the
EthanCavadia Apr 2, 2020
1aa1fc9
Modified IsPlanCircleIntersects to IsPlanSphereIntersects and correted
EthanCavadia Apr 2, 2020
04fdbbb
Added other way to the Intersects function
EthanCavadia Apr 2, 2020
295de07
Created circle_ncirle.h for the intersection optimization
EthanCavadia Apr 4, 2020
adcd51e
Merge branch 'develop' into sprint1_circle
EthanCavadia Apr 4, 2020
6c3ce86
Added Intersects instricts for four circle and created the benchamrks.
EthanCavadia Apr 6, 2020
b7d685c
Changed intrinsct of intersects function.
EthanCavadia Apr 6, 2020
b363a86
Intrinsics working
EthanCavadia Apr 16, 2020
45d15c9
Removed useless intrinsics function and created test for the intrinsics
EthanCavadia Apr 17, 2020
8d03abf
Changed the way of cheking the result in the intrinsics, changed the
EthanCavadia Apr 21, 2020
813cd8a
Upgrading test circle with cases not working
EliasFarhan Apr 27, 2020
42d6bf3
Update formatting
EliasFarhan Apr 27, 2020
788eb40
Changed the circle test to see every result possible and passed the
EthanCavadia Apr 27, 2020
78d38c1
Merge branch 'sprint1_circle' of https://github.com/EliasFarhan/NekoE…
EthanCavadia Apr 27, 2020
7a9fe07
Changed the benchmark to iterate the functions on each state, changed
EthanCavadia Apr 27, 2020
f0c60cc
Added test for intersection function with RSqrt.
EthanCavadia Apr 27, 2020
e853f7a
Changed the test for FourCircle and FourSphere.
EthanCavadia Apr 28, 2020
50ec2ca
Added test for c++ FourCircle/Sphere intersection function.
EthanCavadia Apr 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions benchmark/bench_circle.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
#include <benchmark/benchmark.h>
#include <mathematics/circle.h>
#include <random>
#include <iostream>
#include <mathematics/vector.h>

#ifdef EASY_PROFILE_USE
#include <easy/profiler.h>
#endif

const long fromRange = 8;
const long toRange = 1 << 18;
const float maxNmb = 50.0f;

float RandomFloat()
{
static std::random_device rd;
static std::mt19937 g(rd());
static std::uniform_real_distribution<float> dist{ -100.0f, 100.0f };

return dist(g);
}

static void BM_CircleIntersects(benchmark::State& state)
{
for (auto _ : state)
{
const size_t n = state.range(0);

neko::Circle circle(neko::Vec2f(RandomFloat(), RandomFloat()), RandomFloat());
neko::Circle circle2(neko::Vec2f(RandomFloat(), RandomFloat()), RandomFloat());

for (size_t i = 0; i < n; i++)
{
benchmark::DoNotOptimize(circle.Intersects(circle2));
}
}
}
BENCHMARK(BM_CircleIntersects)->Range(fromRange, toRange);

static void BM_CircleIntersectsRSqrt(benchmark::State& state)
{
for (auto _ : state)
{
const size_t n = state.range(0);

neko::Circle circle(neko::Vec2f(RandomFloat(), RandomFloat()), RandomFloat());
neko::Circle circle2(neko::Vec2f(RandomFloat(), RandomFloat()), RandomFloat());


for (size_t i = 0; i < n; i++)
{
benchmark::DoNotOptimize(circle.IntersectsOther(circle2));
}
}
}
BENCHMARK(BM_CircleIntersectsRSqrt)->Range(fromRange, toRange);

/*
static void BM_CircleIntersectsIntrinsics(benchmark::State& state)
{

for (auto _ : state)
{
const size_t n = state.range(0) / 4;

std::array<neko::Circle, 4> array;
std::array<neko::Circle, 4> array2;

for (size_t i = 0; i < 4; i++)
{
array[i] = neko::Circle(neko::Vec2f(RandomFloat(), RandomFloat()), RandomFloat());
array2[i] = neko::Circle(neko::Vec2f(RandomFloat(), RandomFloat()), RandomFloat());
}

neko::FourCircle n_circle(array);
neko::FourCircle n_circle2(array2);

for (size_t i = 0; i < n; i++)
{
benchmark::DoNotOptimize(neko::FourCircle::IntersectsIntrinsicsCircle(n_circle, n_circle2));
}


}
}
BENCHMARK(BM_CircleIntersectsIntrinsics)->Range(fromRange, toRange);
*/

static void BM_SphereIntersects(benchmark::State& state)
{
for (auto _ : state)
{
const size_t n = state.range(0);

neko::Sphere sphere(neko::Vec3f(RandomFloat(), RandomFloat(), RandomFloat()), RandomFloat());
neko::Sphere sphere2(neko::Vec3f(RandomFloat(), RandomFloat(), RandomFloat()), RandomFloat());

for (size_t i = 0; i < n; i++)
{
benchmark::DoNotOptimize(sphere.Intersects(sphere2));
}
}
}
BENCHMARK(BM_SphereIntersects)->Range(fromRange, toRange);

static void BM_SphereIntersectsRSqrt(benchmark::State& state)
{
for (auto _ : state)
{
const size_t n = state.range(0);

neko::Sphere sphere(neko::Vec3f(RandomFloat(), RandomFloat(), RandomFloat()), RandomFloat());
neko::Sphere sphere2(neko::Vec3f(RandomFloat(), RandomFloat(), RandomFloat()), RandomFloat());

for (size_t i = 0; i < n; i++)
{
benchmark::DoNotOptimize(sphere.IntersectsRSqrt(sphere2));
}
}
}
BENCHMARK(BM_SphereIntersectsRSqrt)->Range(fromRange, toRange);

/*
static void BM_SphereIntersectsIntrinsics(benchmark::State& state)
{
for (auto _ : state)
{
const size_t n = state.range(0) / 4;

std::array<neko::Sphere, 4> array;
std::array<neko::Sphere, 4> array2;

for (size_t i = 0; i < 4; i++)
{
array[i] = neko::Sphere(neko::Vec3f(RandomFloat(), RandomFloat(), RandomFloat()), RandomFloat());
array2[i] = neko::Sphere(neko::Vec3f(RandomFloat(), RandomFloat(), RandomFloat()), RandomFloat());
}

neko::FourSphere n_sphere(array);
neko::FourSphere n_sphere2(array2);

for (size_t i = 0; i < n; i++)
{
benchmark::DoNotOptimize(neko::FourSphere::IntersectIntrinsicsSphere(n_sphere, n_sphere2));
}
}
}
BENCHMARK(BM_SphereIntersectsIntrinsics)->Range(fromRange, toRange);
*/

1 change: 0 additions & 1 deletion benchmark/bench_data_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
const unsigned long fromRange = 8;
const unsigned long toRange = 1 << 20;


static void BM_Vector(benchmark::State& state)
{
const auto length = state.range(0);
Expand Down
Loading