85#if defined(__cplusplus)
89 return a_vector2_set_dir(
this, x_, y_);
93 a_vector2_val(
this, &x_, &y_);
97 a_vector2_set_val(
this, x_, y_);
101 a_vector2_pol(
this, &rho, &theta);
105 a_vector2_set_pol(
this, rho, theta);
109 a_vector2_add(
this, &rhs, &res);
113 a_vector2_sub(
this, &rhs, &res);
117 a_vector2_mul(
this, rhs, &res);
121 a_vector2_div(
this, rhs, &res);
125 a_vector2_neg(
this, &res);
127 A_INLINE
a_real unit() {
return a_vector2_unit(
this); }
128 A_INLINE
a_real norm()
const {
return a_vector2_norm(
this); }
129 A_INLINE
a_real norm1()
const {
return a_vector2_norm1(
this); }
130 A_INLINE
a_real norm2()
const {
return a_vector2_norm2(
this); }
131 A_INLINE
a_real dot(
a_vector2 const &rhs)
const {
return a_vector2_dot(
this, &rhs); }
132 A_INLINE
a_real dist(
a_vector2 const &rhs)
const {
return a_vector2_dist(
this, &rhs); }
133 A_INLINE
a_real dist1(
a_vector2 const &rhs)
const {
return a_vector2_dist1(
this, &rhs); }
134 A_INLINE
a_real dist2(
a_vector2 const &rhs)
const {
return a_vector2_dist2(
this, &rhs); }
135 A_INLINE
a_real angle(
a_vector2 const &rhs)
const {
return a_vector2_angle(
this, &rhs); }
136 A_INLINE
a_bool isver(
a_vector2 const &rhs)
const {
return a_vector2_isver(
this, &rhs); }
137 A_INLINE
a_bool ispar(
a_vector2 const &rhs)
const {
return a_vector2_ispar(
this, &rhs); }
138 A_INLINE
a_real cross(
a_vector2 const &rhs)
const {
return a_vector2_cross(
this, &rhs); }
139 A_INLINE
void outer(
a_vector2 const &rhs,
a_real res[4])
const { a_vector2_outer(
this, &rhs, res); }
140 A_INLINE
void rot(
a_real angle,
a_vector2 &res)
const { a_vector2_rot(
this, angle, &res); }
143 return a_vector2_cross(&lhs, &rhs);
145 friend A_INLINE
void operator+=(
a_vector2 &lhs,
a_vector2 const &rhs) { a_vector2_add(&lhs, &rhs, &lhs); }
149 a_vector2_add(&lhs, &rhs, &res);
152 friend A_INLINE
void operator-=(
a_vector2 &lhs,
a_vector2 const &rhs) { a_vector2_sub(&lhs, &rhs, &lhs); }
156 a_vector2_sub(&lhs, &rhs, &res);
159 friend A_INLINE
void operator*=(
a_vector2 &lhs,
a_real rhs) { a_vector2_mul(&lhs, rhs, &lhs); }
162 return a_vector2_dot(&lhs, &rhs);
167 a_vector2_mul(&rhs, lhs, &res);
173 a_vector2_mul(&lhs, rhs, &res);
176 friend A_INLINE
void operator/=(
a_vector2 &lhs,
a_real rhs) { a_vector2_div(&lhs, rhs, &lhs); }
180 a_vector2_div(&lhs, rhs, &res);
187 a_vector2_neg(&rhs, &res);
217 a_real_cart2pol(ctx->x, ctx->y, rho, theta);
221 a_real_pol2cart(rho, theta, &ctx->x, &ctx->y);