Skip to content

Instantly share code, notes, and snippets.

View NemuiSen's full-sized avatar
:shipit:
Básicamente, nada

Neloj NemuiSen

:shipit:
Básicamente, nada
  • Ecuador
  • 20:27 (UTC -05:00)
View GitHub Profile
@NemuiSen
NemuiSen / sep.rs
Last active June 9, 2022 14:28
collision detection algorithm based on shadow edge projection
/*
this code take as reference the algorithm SAT (Separated Axis Theorem) and tries to solve the problem of concave collisions.
This algorithm i call it SEP (Shadow Edge Projection) as the name says, it uses the edges and compares them with other
edges by casting a shadow defined by the normal and if the edge is inside the shadow it means that it is probably
inside the shape.
*/
mod math {
pub type Vec2 = [f32; 2];
@NemuiSen
NemuiSen / trait.c
Last active June 6, 2022 17:56
a simple example of how to use polymorphism within C with a comparison of something similar written in Rust.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
C does not support OOP by default but it can be emulated obtaining
similar results to other programming languages such as C++ or Rust.
In this example I will emulate the Traits of Rust and the concepts
used in this code are "vtable" and "virtual function"
*/