Polygon Class

This commit is contained in:
Grant Sanderson
2015-10-08 11:50:49 -07:00
parent 5b986b9a9e
commit b8fba1f3ec
2 changed files with 25 additions and 6 deletions

View File

@ -353,6 +353,14 @@ class Mobject1D(Mobject):
self.epsilon = 1.0 / self.density
Mobject.__init__(self, **kwargs)
def add_line(self, start, end, min_density = 0.1):
length = np.linalg.norm(end - start)
epsilon = self.epsilon / max(length, min_density)
self.add_points([
interpolate(start, end, t)
for t in np.arange(0, 1, epsilon)
])
class Mobject2D(Mobject):
DEFAULT_CONFIG = {
"density" : DEFAULT_POINT_DENSITY_2D,