-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #373 - nical:extra-methods, r=kvark
Add a few methods to Vector2D and Vector3D Here are some methods that have been requested to me through another project that uses euclid (godot bindings) and are universal and simple enough to have their place in euclid in my opinion: - `angle_to` between two vectors is cheaper and nicer than calling `angle_from_x_axis` twice. It's also implemented in 3D. - `cap_length` to ensure the length of a vector isn't bigger than some provided quantity, typically used a lot of in gameplay code to put limits on things. I originally named it `clamp_length` but since we alread have `clamp` to enforce both a min and a max value I suspected the inconsistency might be controversial. - `bounce` is also arguably more useful to games than browsers. You'd use it to prototype a slow ray tracer or code some physical behavior. - `project_onto` projects a vector onto another vector. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/euclid/373) <!-- Reviewable:end -->
- Loading branch information
Showing
2 changed files
with
298 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters