commit 76920c4859d9277cfb84398de7c730644e9302dc parent 78c8e7311abfdd53c8517eb9d4106618e9bf1ca0 Author: Michael Savage <mikejsavage@gmail.com> Date: Sun Nov 1 19:32:09 +0000 Don't allow horizons to be below horizontal Diffstat:
gpubtt.cc | | | 3 | ++- |
intrinsics.h | | | 4 | ++++ |
diff --git a/gpubtt.cc b/gpubtt.cc @@ -74,7 +74,8 @@ void compute_horizons( hull_size--; } - horizons[ start.y * hm->width + start.x ] = angle( p, hull[ hull_size - 1 ] ); + const float horizon = max_f( 0.0, angle( p, hull[ hull_size - 1 ] ) ); + horizons[ start.y * hm->width + start.x ] = horizon; hull[ hull_size ] = p; hull_size++; diff --git a/intrinsics.h b/intrinsics.h @@ -43,6 +43,10 @@ inline constexpr size_t gigabytes( const size_t gb ) { return megabytes( gb ) * 1024; } +inline float max_f( float a, float b ) { + return a > b ? a : b; +} + inline u32 min_u32( u32 a, u32 b ) { return a < b ? a : b; }