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

4D vector design (x, y, z, w) #144

Closed
bvssvni opened this issue May 10, 2016 · 0 comments
Closed

4D vector design (x, y, z, w) #144

bvssvni opened this issue May 10, 2016 · 0 comments

Comments

@bvssvni
Copy link
Member

bvssvni commented May 10, 2016

Dyon uses vectors in 4D to describe points in 2D, 3D and 4D.

(1, 2, 3, 4)
(1, 2, 3) // `w` is 0
(1, 2) // `z` is 0, `w` is 0

At least two arguments must be specified. Arguments must be numbers.

Operators for vec4:

  • Addition (+) and multiplication (*) is per-component for two vectors
  • Scalar product (*) and scalar division (/) allowed on both sides and is per-component
  • Dot product (·/*.)
  • Cross product (/x) ignores w component
  • Norm/length of vector |v|

The precision is f32. Thumb rule: Whenever you do calculations with vectors, expect f32 precision unless the algorithms are carefully analyzed.

This is designed for:

  • Easier 2D and 3D programming
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant