diff options
Diffstat (limited to 'src/rmath.c')
| -rw-r--r-- | src/rmath.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/rmath.c b/src/rmath.c index 26054e4..0b4623d 100644 --- a/src/rmath.c +++ b/src/rmath.c @@ -412,6 +412,31 @@ int lmathVector2Angle( lua_State *L ) { } /* +> result = RL.Vector2LineAngle( Vector2 start, Vector2 end ) + +Calculate angle defined by a two vectors line. +NOTE: Parameters need to be normalized. +Current implementation should be aligned with glm::angle. + +- Failure return false +- Success return float +*/ +int lmathVector2LineAngle( lua_State *L ) { + if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.Vector2LineAngle( Vector2 start, Vector2 end )" ); + lua_pushboolean( L, false ); + return 1; + } + Vector2 end = uluaGetVector2( L ); + lua_pop( L, 1 ); + Vector2 start = uluaGetVector2( L ); + + lua_pushnumber( L, Vector2LineAngle( start, end ) ); + + return 1; +} + +/* > result = RL.Vector2Scale( Vector2 v, float scale ) Scale vector ( multiply by value ) |
