Skip to content

Instantly share code, notes, and snippets.

View guozhou's full-sized avatar
🎯
Focusing

Guo Zhou guozhou

🎯
Focusing
View GitHub Profile
@guozhou
guozhou / Tree.cpp
Last active November 11, 2016 01:14
八叉树剖分和按可见性遍历
#include "stdafx.h"
#include "Tree.h"
#include <libmorton/morton.h>
Tree::Tree() // sharing face, edge, vertex
:order{ { 0, 1, 2, 4, 3, 5, 6, 7 },{ 1, 0, 3, 5, 2, 4, 7, 6 },
{ 2, 0, 3, 6, 1, 4, 7, 5 },{ 3, 1, 2, 7, 0, 5, 6, 4 },
{ 4, 0, 5, 6, 1, 2, 7, 3 },{ 5, 1, 4, 7, 0, 3, 6, 2 },
{ 6, 2, 4, 7, 0, 3, 5, 1 },{ 7, 3, 5, 6, 1, 2, 4, 0 } }
{
@guozhou
guozhou / distance.cpp
Created December 24, 2015 08:43
An iterative point to cubic Bézier curve distance solver.
#include <iostream>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <wstp.h>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
#define DEQUE_SIZE 7
@guozhou
guozhou / persistent.cpp
Last active June 13, 2023 12:37
A minimum CUDA persistent thread example.
#include <iostream>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
// GTS450 sm_21
#define NUM_SM 4 // no. of streaming multiprocessors
#define NUM_WARP_PER_SM 48 // maximum no. of resident warps per SM
#define NUM_BLOCK_PER_SM 8 // maximum no. of resident blocks per SM
#define NUM_BLOCK NUM_SM * NUM_BLOCK_PER_SM
#define NUM_WARP_PER_BLOCK NUM_WARP_PER_SM / NUM_BLOCK_PER_SM