41 Vec2D(
float _x = 0,
float _y = 0,
float _w = 0) {
50 float &operator[](
int i) {
58 const float &operator[](
int i)
const {
73 Vec2D &operator*=(
float s) {
82 Vec2D &operator/=(
float s) {
110inline float Dot(
const Vec2D &a,
const Vec2D &b) {
112 return a.x * b.x + a.y * b.y + a.w * b.w;
133inline Vec2D operator*(
const Vec2D &v,
float s) {
144inline Vec2D operator*(
float s,
const Vec2D &v) {
156inline Vec2D operator/(
const Vec2D &v,
float s) {
181inline float Magnitude(
const Vec2D &v) {
183 return sqrt(v.x * v.x + v.y * v.y);
217 return b * (float) (Dot(a, b) / (float) pow(Magnitude(b), 2));
226 float mag = Magnitude(v);
238inline float CrossProduct(
const Vec2D &a,
const Vec2D &b) {
242 result = a.x * b.y - b.x * a.y;
250inline void PrettyPrint(std::ostream &os,
const Vec2D &a) {
251 os <<
"x : " << a.x << std::endl;
252 os <<
"y : " << a.y << std::endl;
253 os <<
"(w): " << a.w << std::endl;
277 Matrix3D(
float n00,
float n01,
float n02,
278 float n10,
float n11,
float n12,
279 float n20,
float n21,
float n22) {
307 float &operator()(
int i,
int j) {
313 const float &operator()(
int i,
int j)
const {
318 Vec2D &operator[](
int j) {
319 return (*
reinterpret_cast<Vec2D *
>(n[j]));
323 const Vec2D &operator[](
int j)
const {
324 return (*
reinterpret_cast<const Vec2D *
>(n[j]));
Definition: TinyMath.hpp:257
Definition: TinyMath.hpp:14