27 struct xrt_vec2 ret = {l.x * r.x, l.y * r.y};
32m_vec2_mul_scalar(struct
xrt_vec2 l, float r)
34 struct xrt_vec2 ret = {l.x * r, l.y * r};
41 struct xrt_vec2 ret = {l.x + r.x, l.y + r.y};
46m_vec2_add_scalar(struct
xrt_vec2 l, float r)
48 struct xrt_vec2 ret = {l.x + r, l.y + r};
55 struct xrt_vec2 ret = {l.x - r.x, l.y - r.y};
60m_vec2_sub_scalar(struct
xrt_vec2 l, float r)
62 struct xrt_vec2 ret = {l.x - r, l.y - r};
69 struct xrt_vec2 ret = {l.x / r.x, l.y / r.y};
74m_vec2_div_scalar(struct
xrt_vec2 l, float r)
76 struct xrt_vec2 ret = {l.x / r, l.y / r};
83 return l.x * l.x + l.y * l.y;
90 return sqrtf(m_vec2_len_sqrd(l));
94m_vec2_normalize(
struct xrt_vec2 *inout)
96 *inout = m_vec2_div_scalar(*inout, m_vec2_len(*inout));
102 return l.x * r.x + l.y * r.y;
109 return m_vec2_add(m_vec2_mul_scalar(from, 1.0f - amount), m_vec2_mul_scalar(to, amount));
112typedef float m_vec2_float_arr[2];
114static inline m_vec2_float_arr *
115m_vec2_ptr_to_float_arr_ptr(
struct xrt_vec2 *ptr)
117 return (m_vec2_float_arr *)ptr;
128 return m_vec2_add(a, b);
134 return m_vec2_sub(a, b);
140 return m_vec2_mul(a, b);
146 return m_vec2_div(a, b);
Wrapper header for <math.h> to ensure pi-related math constants are defined.
A 2 element vector with single floats.
Definition: xrt_defines.h:250
Common defines and enums for XRT.