Skip to content

Instantly share code, notes, and snippets.

@JevinJ
JevinJ / PoissonSampling3D.cs
Last active September 4, 2020 19:36
Parallel Variable Radii Poisson Sampler in 3D
//TODO, parallel sort of points, refactoring.
/// <summary>
/// Variable radii poisson disk sampling in 3D.
/// Based on: graphics.cs.umass.edu/pubs/sa_2010.pdf
/// </summary>
public static class PoissonSampling3D {
struct PointDataComparer : IComparer<float4> {
public AABB GridBounds;
public int3 CellsPerAxis;
@JevinJ
JevinJ / ProcessPool.py
Created October 12, 2018 00:00
Interruptible Python multiprocessing pool.
import sys
import multiprocessing
import os
import time
class Pool():
def __init__(self):
self.cpu_count = os.cpu_count()
self.pool = []
self.pool_lock = multiprocessing.Lock()
@JevinJ
JevinJ / ThreadPool.py
Last active March 27, 2022 07:56
An Interruptible/Pausable thread pool in python, KeyboardInterrupt will stop the pool, KeyboardInterrupt can be caught to start the pool where it left off.
import queue
import threading
import os
import time
import signal
class Worker(threading.Thread):
def __init__(self, tasks, results):
super().__init__()
self.tasks = tasks