Skip to content

Instantly share code, notes, and snippets.

@sungyongchoi
sungyongchoi / rotate.py
Last active February 11, 2016 08:38
rotate points
import math
def rotate_vector(v, angle, anchor):
"""Rotate a vector `v` by the given angle, relative to the anchor point."""
x, y = v
x = x - anchor[0]
y = y - anchor[1]
# Here is a compiler optimization; inplace operators are slower than
# non-inplace operators like above. This function gets used a lot, so
@sungyongchoi
sungyongchoi / draw.py
Last active February 5, 2016 04:27
Draw X,Z coordinates value throu MatPlotLib
import matplotlib.pyplot as plt
import csv
x=[]
z=[]
f= open("data.csv")
#append values to list
for row in csv.reader(f):
x.append(row[0])
z.append(row[1])