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

Add a Angle to Vector function #3

Closed
mkosler opened this issue Jan 18, 2012 · 1 comment
Closed

Add a Angle to Vector function #3

mkosler opened this issue Jan 18, 2012 · 1 comment

Comments

@mkosler
Copy link

mkosler commented Jan 18, 2012

Something as simple as:

function angleToVector(radians)
return {x = math.sin(radians), y = math.cos(radians)}
end

@vrld
Copy link
Owner

vrld commented Jan 18, 2012

I wont add this, since it's really easy to do yourself. Besides calculating the coordinates directly, i.e.

vector(math.cos(phi), math.sin(phi))

you can create a vector and rotate it:

vector(0,1):rotate_inplace(phi)

This way, you can define the phase (starting quadrant) as well as the radius.

@vrld vrld closed this as completed Jan 18, 2012
NickFlexer pushed a commit to NickFlexer/hump that referenced this issue Oct 5, 2020
Update timer.lua to be compatible with lua 5.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants