![]() ![]() inline constexpr T length2 ( ) const noexcept ¶ ![]() Query and Manipulation inline T length ( ) const noexcept ¶ inline constexpr Vec2 operator / ( T a ) const noexcept ¶ inline constexpr Vec2 operator / ( const Vec2 & v ) const noexcept ¶Ĭomponent-wise division. inline constexpr const Vec2 & operator /= ( T a ) noexcept ¶Ĭomponent-wise division. inline constexpr const Vec2 & operator /= ( const Vec2 & v ) noexcept ¶Ĭomponent-wise division. inline constexpr Vec2 operator * ( T a ) const noexcept ¶Ĭomponent-wise multiplication. inline constexpr Vec2 operator * ( const Vec2 & v ) const noexcept ¶Ĭomponent-wise multiplication. inline constexpr const Vec2 & operator *= ( T a ) noexcept ¶Ĭomponent-wise multiplication. inline constexpr const Vec2 & operator *= ( const Vec2 & v ) noexcept ¶Ĭomponent-wise multiplication. inline constexpr const Vec2 & negate ( ) noexcept ¶Ĭomponent-wise multiplication by -1. inline constexpr Vec2 operator - ( ) const noexcept ¶Ĭomponent-wise multiplication by -1. inline constexpr Vec2 operator - ( const Vec2 & v ) const noexcept ¶Ĭomponent-wise subtraction. inline constexpr const Vec2 & operator -= ( const Vec2 & v ) noexcept ¶Ĭomponent-wise subtraction. inline constexpr Vec2 operator + ( const Vec2 & v ) const noexcept ¶Ĭomponent-wise addition. Z component of Vec3 (this->x, this->y, 0) % Vec3 (v.x, v.y, 0) inline constexpr const Vec2 & operator += ( const Vec2 & v ) noexcept ¶Ĭomponent-wise addition. Pointer casting of operator can confuse the compiler just enough toĪbs ( this - v ) x, this->y, 0) % Vec3 (v.x, v.y, 0) inline constexpr T operator % ( const Vec2 & v ) const noexcept ¶ You hope to parallelize (either through compiler auto-vectorization orĮxplicit hints such as #pragma omp simd), the function call and Same machine operations for ordinary scalar code), when used inside loops that While both appear to do the same thing (and indeed do generate the More efficient to directly address the components, such as V.y rather than However, when the coordinate is known, it can be Suited to looping over components, or in cases where a variable determines Individual components of a vector V may be referenced as either V There are also various utility functions that operate on vectorsĭefined in ImathVecAlgo.h and described in Vector Functions. Length() and normalize() methods that are present in theįloat and double versions, because the results don’t fit into Note that the integer specializations of Vec2 lack the Typedefs for vectors of type short, int, int64_t, float, and Expand that to the number of bits you have and then break it into parts.The Vec2 class template represents a 2D vector, with predefined If you know the max range of values you want to store, say +5 to -5, than the easiest way is just to pick some convert that range to a value from 0 to 1. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |