Skip to content

Instantly share code, notes, and snippets.

Ounan Ding thebusytypist

Block or report user

Report or block thebusytypist

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@thebusytypist
thebusytypist / convect-central.py
Last active Oct 1, 2016
Dissipation and dispersion
View convect-central.py
import numpy as np
import matplotlib.pyplot as plt
ngrid = 100
nstep = 40
dt = 0.1
c = 0.1
x = np.linspace(-1, 1, ngrid)
dx = x[1] - x[0]
@thebusytypist
thebusytypist / ast.h
Last active Aug 2, 2016
Pattern Matching in C++
View ast.h
#ifndef AST_H
#define AST_H
#include <string>
#include <memory>
#include <vector>
#include <ostream>
class Expr {
public:
View clip_at_zero_level.py
import numpy as np
import matplotlib.pyplot as plt
class Rectangle:
def __init__(self, c, w, h, m):
self.c = c
self.w = w
self.h = h
self.m = m
self.invm = np.linalg.inv(m)
@thebusytypist
thebusytypist / HJEqn2D.py
Created Feb 25, 2016
2D Hamilton-Jacobi Equation
View HJEqn2D.py
import numpy as np
import matplotlib.pyplot as plt
import math
import numba
def buildSphere(cx, cy, r):
return lambda x, y: math.sqrt((x - cx)**2 + (y - cy)**2) - r
@numba.jit
def Convect(X, Y, Z, dt, speed):
@thebusytypist
thebusytypist / halfvector.py
Last active Jan 23, 2016
Python scripts demonstrating half vector isocontour
View halfvector.py
import numpy as np
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
def reflect(v, n):
return 2 * np.dot(v, n) * n - v
def transform(beta, theta):
l = np.array([-np.cos(beta), np.sin(beta), 0.0])
@thebusytypist
thebusytypist / InverseUVMapping.py
Created Aug 31, 2015
Transform UV coordinates to world space
View InverseUVMapping.py
bl_info = {
"name": "InverseUVMapping",
"description": "Inverse UV coordinate",
"author": "TheBusyTypist",
"category": "Object"
}
import bpy
import bmesh
import mathutils
View simulation-context-v2.75a.patch
From d47c6c046b6272b46b3a292f861bbcf2d9173b14 Mon Sep 17 00:00:00 2001
From: thebusytypist <ounanding@gmail.com>
Date: Fri, 14 Aug 2015 23:19:59 +0800
Subject: [PATCH 1/2] Render new context button.
---
source/blender/editors/space_buttons/buttons_context.c | 3 +++
source/blender/makesdna/DNA_space_types.h | 1 +
source/blender/makesrna/intern/rna_space.c | 5 +++++
3 files changed, 9 insertions(+)
View tetrahedron-modifier-v2.75a.patch
From 011dec2b84f5c9b61a4b5ef8bddf1ed0b6e891f2 Mon Sep 17 00:00:00 2001
From: thebusytypist <ounanding@gmail.com>
Date: Mon, 3 Aug 2015 12:00:05 +0800
Subject: [PATCH 1/6] Add skeleton code for modifier tetrahedron; add
definition of TetrahedronModifierData; include tetrahedron modifier in build
system.
---
source/blender/makesdna/DNA_modifier_types.h | 5 ++
source/blender/modifiers/CMakeLists.txt | 1 +
View DiscreteGaussBonnet.py
bl_info = {
"name": "Genus",
"description": "Compute genus",
"author": "TheBusyTypist",
"category": "Object"
}
import bpy
import bmesh
import math
View DualContouring3D.py
bl_info = {
"name": "3D Implicit Function Contouring",
"description": "Contour 3D implicit function",
"author": "TheBusyTypist",
"location": "View3D > Add > Mesh",
"category": "Add Mesh"
}
import bpy
import bmesh
You can’t perform that action at this time.