8000 4D vector design `(x, y, z, w)` · Issue #144 · PistonDevelopers/dyon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000
4D vector design (x, y, z, w) #144
Closed
@bvssvni

Description

@bvssvni

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0