This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python3 | |
from mpl_toolkits import mplot3d | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import math | |
def vnorm(v): | |
return v / np.linalg.norm(v) | |
def draw_unit_sphere(ax): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
static bool is_prime(size_t i) { | |
if (i <= 1) | |
return false; | |
if (i <= 3) | |
return true; | |
if (i % 3 == 0 || i % 2 == 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cmath> | |
#include <iostream> | |
template <typename T> | |
struct dFloat { | |
T x, dx; | |
dFloat(T x, T dx = 0) : x(x), dx(dx) {} | |
}; | |
template <typename T> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 440 | |
#define STACK_SIZE 32 | |
#define INVALID_HIT_ID uint(-1) | |
// The primitive data be changed to the desired primitive type | |
// (including using BVHs as primitives for top-level BVH traversal). | |
#define PrimitiveData Triangle | |
#define HitData vec2 // Barycentric coordinates of a hit on a triangle (can be changed to anything) | |
#define intersect_ray_primitive(ray, prim, hit, tnear, tfar) \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <tgmath.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <assert.h> | |
#include <string.h> | |
#define PI 3.141592653589793f | |
#define SEARCH_RADIUS 1.e-5f // Initial search radius for the local search procedure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <inttypes.h> | |
#include <assert.h> | |
enum dim : uint8_t { | |
X, Y, Z, DIM_COUNT | |
}; |
OlderNewer