Example #1
0
def moonExample():
    # a high-resolution, softly flickering moon,
    # constructed by the difference of two stars ...
    moon = Star(radius=3, center=(1.0, 2.0), beams=140, iradius=2.90) \
           - Star(radius=3, center=(-0.3, 2.0), beams=140, iradius=2.90)
    # plot the moon and its convex hull
    writeSVG('MoonAndHull.svg', (moon, convexHull(moon)), height=400, fill_opacity=(1.0, 0.3))
    # test point containment
    d = ['outside', 'inside']
    c = moon.center()
    print 'Did you know that the center of gravitation of my moon is %s?' % d[moon.isInside(c[0], c[1])]
Example #2
0
def moonExample():
    # a high-resolution, softly flickering moon,
    # constructed by the difference of two stars ...
    moon = Star(radius=3, center=(1.0, 2.0), beams=140, iradius=2.90) \
           - Star(radius=3, center=(-0.3, 2.0), beams=140, iradius=2.90)
    # plot the moon and its convex hull
    writeSVG('MoonAndHull.svg', (moon, convexHull(moon)), height=400, fill_opacity=(1.0, 0.3))
    # test point containment
    d = ['outside', 'inside']
    c = moon.center()
    print 'Did you know that the center of gravitation of my moon is %s?' % d[moon.isInside(c[0], c[1])]
Example #3
0
 def chull(self):
     """ Return convex hull of points."""
     if self._chull is None:
         self._chull = convexHull(self.points).contour(0)
     return self._chull
Example #4
0
 def chull(self):
     """ Return convex hull of points."""
     if self._chull is None:
         self._chull = convexHull(self.points).contour(0)
     return self._chull