如何在Pygame或Matplotlib中绘制天文正确的新月

如何在Pygame或Matplotlib中绘制天文正确的新月,matplotlib,geometry,astronomy,Matplotlib,Geometry,Astronomy,Pyephem在[0.0,1.0]中以数字的形式给了我月朔,其中>0表示新月和几何体之后: 球形物体(最著名的是月亮)发光面的形状观察者看到的不到一半的太阳光以不同于平面几何中通常称为新月的形状出现:假设终结者位于一个大圆上,新月实际上将以一个半椭圆和一个半圆为边界,以椭圆的长轴出现e与半圆的直径重合。” () 我不明白为什么是面片。Arc没有使用θ1和θ2,所以我切换到面片。矩形: light_patch2 = mpl.patches.Rectangle ( # right

Pyephem在[0.0,1.0]中以数字的形式给了我月朔,其中>0表示新月和几何体之后:

球形物体(最著名的是月亮)发光面的形状观察者看到的不到一半的太阳光以不同于平面几何中通常称为新月的形状出现:假设终结者位于一个大圆上,新月实际上将以一个半椭圆和一个半圆为边界,以椭圆的长轴出现e与半圆的直径重合。”

()

我不明白为什么是面片。Arc没有使用θ1和θ2,所以我切换到面片。矩形:

light_patch2 = mpl.patches.Rectangle (  # right
            *rrect, visible=False)
        dark_patch = mpl.patches.Rectangle (  # left
            *lrect, visible=False)
        light_patch = mpl.patches.Ellipse (  # middle
            ORIGIN, rx, ry, visible=False)
        colormap.append ('white')
        colormap.append ('black')
        colormap.append ('white')
        clips.append (light_patch2)
        clips.append ( dark_patch)
        clips.append (light_patch)
if lunacity < .25:       # 0   ,  .25 => new moon, first quarter moon
        print ("q0-q1")
        
        lun = lunacity * 4   # 0   , 1.
        lun = 1 - lun        # 1   , 0.
        
        rx, ry = xrng * lun, yrng
        
        # dark left, dark middle, light right
        light_patch = mpl.patches.Ellipse ( # right half
            ORIGIN, xrng, yrng, visible=False) # theta1=-90, theta2=+90
        dark_patch = mpl.patches.Ellipse ( # center
            ORIGIN, rx, ry,
            visible=False)
        dark_patch2 = mpl.patches.Arc ( # left half
            ORIGIN, xrng, yrng, theta1=+90, theta2=+270,
            visible=False)
        colormap.append ('black')
        colormap.append ('white')
        colormap.append ('black')
        clips.append ( dark_patch2)
        clips.append (light_patch)
        clips.append ( dark_patch)
        
    elif lunacity < .5:       #  .25,  .5  => first quarter moon, full moon
        print ("q1-q2")
        
        assert .25 <= lunacity
        lun = lunacity - .25 # 0.  ,  .25
        assert lun >= 0
        assert lun < .25
        lun = lun * 4        # 0.  , 1.
        assert lun >= 0
        assert lun < 1
        
        rx, ry = xrng * lun, yrng
        
        # dark left, light middle, light right
        light_patch2 = mpl.patches.Ellipse (  # right
            ORIGIN, xrng, yrng, visible=False) # theta1=-90, theta2=+90
        dark_patch = mpl.patches.Arc (  # left
            ORIGIN, xrng, yrng, theta1=+90, theta2=+270,
            visible=False)
        light_patch = mpl.patches.Ellipse (  # middle
            ORIGIN, rx, ry,
            visible=False)
        colormap.append ('white')
        colormap.append ('black')
        colormap.append ('white')
        clips.append (light_patch2)
        clips.append ( dark_patch)
        clips.append (light_patch)
    elif lunacity < .75:     #  .5 ,  .75 => full moon, third quarter moon
        print ("q2-q3")
        
        assert .5 <= lunacity
        lun = lunacity - .5  # 0.  ,  .25
        assert lun >= 0
        assert lun < .25
        lun = lun * 4        # 0.  , 1.
        assert lun >= 0
        assert lun < 1
        lun = 1 - lun        # 1.  , 0.
        assert lun > 0
        assert lun <= 1
        rx, ry = xrng * lun, yrng
    
        # light left, light middle, dark right
        light_patch2 = mpl.patches.Ellipse (  # left
            ORIGIN, xrng, yrng, visible=False) # theta1=+90, theta2=+270,
        dark_patch = mpl.patches.Arc (  # right
            ORIGIN, xrng, yrng, theta1=-90, theta2=+90,
            visible=False)
        light_patch = mpl.patches.Ellipse (  # middle
            ORIGIN, rx, ry,
            visible=False)
        colormap.append ('white')
        colormap.append ('black')
        colormap.append ('white')
        clips.append (light_patch2)
        clips.append ( dark_patch)
        clips.append (light_patch)
    elif lunacity < 1.0:     #  .75, 1.   => third quarter moon, full moon
        print ("q3-q4")

        assert .75 <= lunacity
        lun = lunacity - .75 # 0.  ,  .25
        assert lun >= 0
        assert lun < .25
        lun = lun * 4        # 0.  , 1.
        assert lun >= 0
        assert lun < 1
        
        rx, ry = xrng * lun , yrng
        
        # light left, dark middle, dark right
        dark_patch2 = mpl.patches.Ellipse (  # right
            ORIGIN, xrng, yrng, visible=False) # theta1=-90, theta2=+90
        light_patch = mpl.patches.Arc (  # left
            ORIGIN, xrng, yrng, theta1=+90, theta2=+270,
            visible=False)
        dark_patch = mpl.patches.Ellipse (  # middle
            ORIGIN, rx, ry,
            visible=False)
        colormap.append ('black')
        colormap.append ('white')
        colormap.append ('black')
        clips.append ( dark_patch2)
        clips.append (light_patch)
        clips.append ( dark_patch)
light_patch2 = mpl.patches.Rectangle (  # right
            *rrect, visible=False)
        dark_patch = mpl.patches.Rectangle (  # left
            *lrect, visible=False)
        light_patch = mpl.patches.Ellipse (  # middle
            ORIGIN, rx, ry, visible=False)
        colormap.append ('white')
        colormap.append ('black')
        colormap.append ('white')
        clips.append (light_patch2)
        clips.append ( dark_patch)
        clips.append (light_patch)