Skip to content

Instantly share code, notes, and snippets.

View BrunoVandekerkhove's full-sized avatar

Bruno Vandekerkhove BrunoVandekerkhove

View GitHub Profile
@BrunoVandekerkhove
BrunoVandekerkhove / intersection_line_line.c
Created April 28, 2018 08:48
Intersection of 2 line segments
typedef struct point2df_struct {
float x;
float y;
} point_2Df;
typedef struct segment_struct {
float x1;
float y1;
float x2;
float y2;
@BrunoVandekerkhove
BrunoVandekerkhove / intersection_circle_line.c
Created April 28, 2018 08:49
Intersection of circle with line (fixed radius)
#define RHO 400.0 // Circle radius
typedef struct point2df_struct {
float x;
float y;
} point_2Df;
typedef struct segment_struct {
float x1;
float y1;
@BrunoVandekerkhove
BrunoVandekerkhove / intersection_circle_circle.c
Last active April 29, 2018 17:22
Intersection of circle with circle (fixed radius)
#define RHO 400.0 // Circle radius
typedef struct point2df_struct {
float x;
float y;
} point_2Df;
typedef struct segment_struct {
float x1;
float y1;
@BrunoVandekerkhove
BrunoVandekerkhove / print_bits.c
Created July 6, 2018 11:46
Print bits of an unsigned integer (reversed order)
void print_bits(unsigned int num) {
for (int bit=0 ; bit<(sizeof(unsigned int) * 8) ; bit++, num = num >> 1)
printf("%i ", num & 0x01);
printf("\n");
}