Randolph and Mortimer

This commit is contained in:
Grant Sanderson
2015-06-13 19:00:23 -07:00
parent e47f240840
commit 344290068c
18 changed files with 414 additions and 279 deletions

View File

@ -83,7 +83,7 @@ class Line(Mobject1D):
def __init__(self, start, end, density = DEFAULT_POINT_DENSITY_1D, *args, **kwargs):
self.start = np.array(start)
self.end = np.array(end)
density *= np.linalg.norm(self.start - self.end)
density *= self.get_length()
Mobject1D.__init__(self, density = density, *args, **kwargs)
def generate_points(self):
@ -92,6 +92,16 @@ class Line(Mobject1D):
for t in np.arange(0, 1, self.epsilon)
])
def get_length(self):
return np.linalg.norm(self.start - self.end)
def get_slope(self):
rise, run = [
float(self.end[i] - self.start[i])
for i in [1, 0]
]
return rise/run
class CurvedLine(Line):
def generate_points(self):
equidistant_point = rotate_vector(