Skip to content

Instantly share code, notes, and snippets.

View alexmerou's full-sized avatar

Alexandros E. Merousis alexmerou

  • 127.0.0.1:22
View GitHub Profile
@alexmerou
alexmerou / vector2.rs
Last active January 18, 2023 12:42
An implementation of a mathematical 2D vector type with tests.
use std::ops::{Add, Div, Mul, Neg, Sub};
#[derive(Debug, Default, Clone, Copy, PartialEq, PartialOrd)]
pub struct Vector2 {
pub x: f32,
pub y: f32,
}
impl Vector2 {
pub const UNIT_X: Self = Self { x: 1.0, y: 0.0 };