Skip to content

Instantly share code, notes, and snippets.

@dwilliamson
dwilliamson / ModifiedMarchingCubes.js
Created February 8, 2022 16:20
Transvoxel's Modified Marching Cubes Lookup Tables
//
// Lookup Tables for Transvoxel's Modified Marching Cubes
//
// Unlike the original paper (Marching Cubes: A High Resolution 3D Surface Construction Algorithm), these tables guarantee
// a closed mesh "whose connected components are continuous and free of holes."
//
// Rotations are prioritised over inversions so that 3 of the 6 cases containing ambiguous faces are never added. 3 extra
// cases are added as a post-process, overriding inverses through custom-build rotations to eliminate the rest.
//
// Uses the exact same co-ordinate system as https://gist.github.com/dwilliamson/c041e3454a713e58baf6e4f8e5fffecd
@raysan5
raysan5 / custom_game_engines_small_study.md
Last active September 25, 2024 12:23
A small state-of-the-art study on custom engines

CUSTOM GAME ENGINES: A Small Study

a_plague_tale

A couple of weeks ago I played (and finished) A Plague Tale, a game by Asobo Studio. I was really captivated by the game, not only by the beautiful graphics but also by the story and the locations in the game. I decided to investigate a bit about the game tech and I was surprised to see it was developed with a custom engine by a relatively small studio. I know there are some companies using custom engines but it's very difficult to find a detailed market study with that kind of information curated and updated. So this article.

Nowadays lots of companies choose engines like Unreal or Unity for their games (or that's what lot of people think) because d

@tatianamac
tatianamac / tatiana-mac-speaker-rider.md
Last active September 19, 2024 17:22
Tatiana Mac's Speaker Rider

Speaker Rider

by Tatiana Mac

Last updated 14 April 2021

What is a speaker rider?

As speaking comes with immense privilege, I have crafted a speaker rider to set expectations and boundaries around my engagement. I am grateful to all the conference organisers who have brilliantly hosted me. I would love to continue to exercise this privilege to speak at conferences, and use this privilege to make the landscape more accessible and beneficial to tech's most historically excluded and marginalised communities.

Considerations

😫 I provide a lot of explanations for those of you who never had to consider these things. Most thoughtful conferences I've attended check most of these boxes intrinsically, particularly when conference runners are experienced speakers. They get it.

@rygorous
rygorous / random_bracket_seq.py
Created March 8, 2019 01:55
Generate a random, sequence of correctly nested parentheses
import random
def random_bracket_sequence(n):
"""Generates a balanced sequence of n +1s and n -1s corresponding to correctly nested brackets."""
# "Generating binary trees at random", Atkinson & Sack, 1992
# Generate a randomly shuffled sequence of n +1s and n -1s
# These are steps 1 and 2 of the algorithm in the paper
seq = [-1, 1]*n
random.shuffle(seq)
from math import *
# a performant solution would store a prefix sum of line lengths to
# a sidechannel and then use that to do a bsearch; on the GPU,
# you'd do a sum tree / histopyramid as a preprocessing step
def find_point(points, d):
d = d
for i in range(1, len(points)):
x0,y0 = points[i-1]
x1,y1 = points[i]
@briandominick
briandominick / asciidoc-static.adoc
Last active August 27, 2024 16:17
Static Site Generators with AsciiDoc Support

There are 28 static site generators that support AsciiDoc sourcing.

data Graph = Graph
{ pointsLeft :: Set.Set (V2 Double)
-- ^ All the points in the whole graph left to be connected
, branches :: Set.Set LineSegment
-- ^ All branches we have found, connecting two points
, currentPoints :: [V2 Double]
-- ^ Points that are currently being processed
, maxDist :: Double
-- ^ Maximum distance a thing can be away from a thing
}
@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active September 20, 2024 14:24
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@thibaudruelle
thibaudruelle / Add_reg_keys-Anaconda_Prompt_Here.bat
Created November 30, 2017 08:46
Run as admin to add "Anaconda Prompt Here" to context menu. See https://stackoverflow.com/a/46803585/1291711.
REG ADD HKCR\Directory\Background\shell\Anaconda\ /ve /f /d "Anaconda Prompt Here"
REG ADD HKCR\Directory\Background\shell\Anaconda\ /v Icon /f /t REG_EXPAND_SZ /d %%USERPROFILE%%\\Anaconda3\\Menu\\Iconleak-Atrous-Console.ico
REG ADD HKCR\Directory\Background\shell\Anaconda\command /f /ve /t REG_EXPAND_SZ /d "%%USERPROFILE%%\\Anaconda3\\pythonw.exe %%USERPROFILE%%\\Anaconda3\\cwp2.py %%USERPROFILE%%\\Anaconda3 %%V cmd.exe /K %%USERPROFILE%%\\Anaconda3\\Scripts\\activate.bat %%USERPROFILE%%\\Anaconda3"
REG ADD HKCR\Directory\shell\Anaconda\ /ve /f /d "Anaconda Prompt Here"
REG ADD HKCR\Directory\shell\Anaconda\ /v Icon /f /t REG_EXPAND_SZ /d %%USERPROFILE%%\\Anaconda3\\Menu\\Iconleak-Atrous-Console.ico
REG ADD HKCR\Directory\shell\Anaconda\command /f /ve /t REG_EXPAND_SZ /d "%%USERPROFILE%%\\Anaconda3\\pythonw.exe %%USERPROFILE%%\\Anaconda3\\cwp2.py %%USERPROFILE%%\\Anaconda3 %%V cmd.exe /K %%USERPROFILE%%\\Anaconda3\\Scripts\\activate.bat %%USERPROFILE%%\\Anaconda3"