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

.fromAngle[Rad|Deg]( angle ) ? #26

Open
DrLightman opened this issue Mar 14, 2016 · 1 comment
Open

.fromAngle[Rad|Deg]( angle ) ? #26

DrLightman opened this issue Mar 14, 2016 · 1 comment

Comments

@DrLightman
Copy link

Maybe add a .fromAngleRad( angle ) such as:

Victor.fromAngleRad = function ( angle ) {
    return new Victor(Math.cos( angle ), Math.sin( angle ));
}
@DrLightman DrLightman changed the title .fromAngle[Rad|Deg( angle ) ? .fromAngle[Rad|Deg]( angle ) ? Mar 14, 2016
@rmkane
Copy link

rmkane commented Oct 4, 2022

@DrLightman wouldn't radians be the default:

Victor.fromAngle = function(radians) {
  return new Victor(Math.cos(radians), Math.sin(radians));
}

And then maybe:

Victor.fromAngleDeg = function(degrees) {
  return Victor.fromAngle(degrees * (Math.PI / 180));
}

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