def Earth(pos=(0, 0, 0), r=1, lw=1):
    """Build a textured actor representing the Earth.

    .. hint:: |geodesic| |geodesic.py|_
    """
    import os

    tss = vtk.vtkTexturedSphereSource()
    tss.SetRadius(r)
    tss.SetThetaResolution(72)
    tss.SetPhiResolution(36)
    earthMapper = vtk.vtkPolyDataMapper()
    earthMapper.SetInputConnection(tss.GetOutputPort())
    earthActor = Actor(c="w")
    earthActor.SetMapper(earthMapper)
    atext = vtk.vtkTexture()
    pnmReader = vtk.vtkPNMReader()
    cdir = os.path.dirname(__file__)
    if cdir == "":
        cdir = "."
    fn = settings.textures_path + "earth.ppm"
    pnmReader.SetFileName(fn)
    atext.SetInputConnection(pnmReader.GetOutputPort())
    atext.InterpolateOn()
    earthActor.SetTexture(atext)
    if not lw:
        earthActor.SetPosition(pos)
        return earthActor
    es = vtk.vtkEarthSource()
    es.SetRadius(r / 0.995)
    earth2Mapper = vtk.vtkPolyDataMapper()
    earth2Mapper.SetInputConnection(es.GetOutputPort())
    earth2Actor = Actor()  # vtk.vtkActor()
    earth2Actor.SetMapper(earth2Mapper)
    earth2Mapper.ScalarVisibilityOff()
    earth2Actor.GetProperty().SetLineWidth(lw)
    ass = Assembly([earthActor, earth2Actor])
    ass.SetPosition(pos)
    settings.collectable_actors.append(ass)
    return ass
def Earth ( pos = ( 0 , 0 , 0 ) , r = 1 , lw = 1 ) : import os tss = vtk . vtkTexturedSphereSource ( ) tss . SetRadius ( r ) tss . SetThetaResolution ( 72 ) tss . SetPhiResolution ( 36 ) earthMapper = vtk . vtkPolyDataMapper ( ) earthMapper . SetInputConnection ( tss . GetOutputPort ( ) ) earthActor = Actor ( c = "w" ) earthActor . SetMapper ( earthMapper ) atext = vtk . vtkTexture ( ) pnmReader = vtk . vtkPNMReader ( ) cdir = os . path . dirname ( __file__ ) if cdir == "" : cdir = "." fn = settings . textures_path + "earth.ppm" pnmReader . SetFileName ( fn ) atext . SetInputConnection ( pnmReader . GetOutputPort ( ) ) atext . InterpolateOn ( ) earthActor . SetTexture ( atext ) if not lw : earthActor . SetPosition ( pos ) return earthActor es = vtk . vtkEarthSource ( ) es . SetRadius ( r / 0.995 ) earth2Mapper = vtk . vtkPolyDataMapper ( ) earth2Mapper . SetInputConnection ( es . GetOutputPort ( ) ) earth2Actor = Actor ( ) earth2Actor . SetMapper ( earth2Mapper ) earth2Mapper . ScalarVisibilityOff ( ) earth2Actor . GetProperty ( ) . SetLineWidth ( lw ) ass = Assembly ( [ earthActor , earth2Actor ] ) ass . SetPosition ( pos ) settings . collectable_actors . append ( ass ) return ass
Build a textured actor representing the Earth.

    .. hint:: |geodesic| |geodesic.py|_