Skip to content

Instantly share code, notes, and snippets.

Avatar

Bruno Vandekerkhove BrunoVandekerkhove

View GitHub Profile
@BrunoVandekerkhove
BrunoVandekerkhove / print_bits.c
Created Jul 6, 2018
Print bits of an unsigned integer (reversed order)
View print_bits.c
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");
}
@BrunoVandekerkhove
BrunoVandekerkhove / intersection_circle_circle.c
Last active Apr 29, 2018
Intersection of circle with circle (fixed radius)
View intersection_circle_circle.c
#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_line.c
Created Apr 28, 2018
Intersection of circle with line (fixed radius)
View intersection_circle_line.c
#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_line_line.c
Created Apr 28, 2018
Intersection of 2 line segments
View intersection_line_line.c
typedef struct point2df_struct {
float x;
float y;
} point_2Df;
typedef struct segment_struct {
float x1;
float y1;
float x2;
float y2;