Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

r""" 

POV-Ray, The Persistence of Vision Ray Tracer 

""" 

from six import iteritems 

 

from sage.misc.pager import pager 

import os 

 

 

class POVRay: 

""" 

POV-Ray The Persistence of Vision Ray Tracer 

 

INPUT: 

 

- ``pov_file`` -- complete path to the .pov file you want to be rendered 

- ``outfile`` -- the filename you want to save your result to 

- ``**kwargs`` -- additionally keyword arguments you want to pass to POVRay 

 

OUTPUT: 

 

Image is written to the file you specified in outfile 

 

EXAMPLES: 

 

AUTHOR: 

 

Sage interface written by Yi Qiang (yqiang _atNOSPAM_ gmail.com) 

 

POVRay: http://www.povray.org 

""" 

def __repr__(self): 

return 'POV-Ray The Persistence of Vision Ray Tracer' 

 

def __call__(self, pov_file, outfile='sage.ppm', block=True, **kwargs): 

if not os.path.isfile(pov_file): 

return "%s not found" % (pov_file) 

 

outfile = os.path.abspath(os.path.expanduser(outfile)) 

 

if not('W' in kwargs and 'H' in kwargs): 

return "You must specify a width and height." 

 

cmd = "povray -D +FP +I%s +O%s " % (pov_file, outfile) 

for k, v in iteritems(kwargs): 

cmd += "+%s%s " % (k, v) 

 

if not block: 

cmd += ' &' 

os.system(cmd) 

 

def usage(self): 

r = os.popen('povray').read() 

pager()(r) 

 

povray = POVRay()