|
numerics 0.1.0
|
Non-owning view of a flat Vector as an array of 2D points. More...
#include <vector.hpp>
Public Member Functions | |
| idx | size () const noexcept |
| Number of 2D points (= v.size() / 2). | |
| real & | x (idx i) noexcept |
| real | x (idx i) const noexcept |
| real & | y (idx i) noexcept |
| real | y (idx i) const noexcept |
Public Attributes | |
| Vector & | v |
Non-owning view of a flat Vector as an array of 2D points.
Many physics simulations pack 2D positions or velocities into a flat Vector with stride 2: element i has x = v[2i], y = v[2i+1]. Vec2View provides named accessors that eliminate the raw index arithmetic without copying or reshaping the data.
Example:
Definition at line 170 of file vector.hpp.
|
inlinenoexcept |
Number of 2D points (= v.size() / 2).
Definition at line 174 of file vector.hpp.
References num::BasicVector< T >::size(), and v.
Definition at line 177 of file vector.hpp.
References v.
Definition at line 176 of file vector.hpp.
References v.
Definition at line 179 of file vector.hpp.
References v.
Definition at line 178 of file vector.hpp.
References v.
| Vector& num::Vec2View::v |