Skip to content

Instantly share code, notes, and snippets.

@adusak
Created June 2, 2015 10:44
Show Gist options
  • Save adusak/c7aa945457e34d1bc214 to your computer and use it in GitHub Desktop.
Save adusak/c7aa945457e34d1bc214 to your computer and use it in GitHub Desktop.
Point class
import numpy as np
__author__ = 'Adam'
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def apply_transformation(self, transformations):
p_mat = np.matrix([[self.x], [self.y], [1]])
res = np.dot(transformations, p_mat)
self.x = res[0, 0]
self.y = res[1, 0]
return self
def draw_to_svg(self, svg):
svg.add_circle((self.x, self.y), 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment