home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Raytrace & Morphing / SOS-RAYTRACE.ISO / programm / utility / dos / povmath / english.doc next >
Encoding:
Text File  |  1994-07-31  |  14.8 KB  |  350 lines

  1.                                   POVMATH 0.4ß
  2.                             the PovRay's Mathematical
  3.                                   pre-processor
  4.                          ( from the French Riviera :-) )
  5.                                         
  6.                               Author: Daniel Munoz
  7.                                  CIS 100256,773
  8.                             Zyllius BBS: 33-93320505
  9.                                         
  10.  
  11.  
  12.        Thanks for trying PovMath, the PovRay's Mathematical pre-processor.
  13.                        PovRay program is (C) POV-Ray team
  14.                                         
  15. This  program  is far from all my whishes, but I think it is already  usable
  16. for  math and animation pre-processing. So, here it is (TAADAAAAA),  I  hope
  17. you'll enjoy it. It have for the moment some little Pov syntax restrictions.
  18. Here  is  a  list, so you can see if they are big problems  for  you.  These
  19. restrictions are due to the way PovMath try to evaluate and modify the Pov's
  20. original language. In fact, PovMath only try to recognize some parts of  the
  21. language,  line by line, not all the entire expressions. The  good  news  is
  22. that  will  allow  possibility  to recognize future  syntaxes  and  language
  23. enhancement from Pov.
  24.  
  25.                 Any comment, suggestion, are greatly appreciates.
  26.                              ( wish-list too :-))) )
  27.                                         
  28. Here's the restriction list:
  29.  
  30.  -  only one #include sentence by line.
  31.     PovMath can't understand:
  32.  
  33.     #include "one" #declare a=b #include "two"
  34.  
  35.  -  #declare sentences must be on the same line.
  36.     PovMath can't understand:
  37.  
  38.     #declare a=
  39.     b
  40.  
  41.  -  math strings to eval must be on the same line.
  42.     PovMath can't understand:
  43.  
  44.     sphere { < 0,0,0 >, 45+
  45.     sin(alpha)
  46.     *2
  47.  
  48.     But the string sin(alpha) is evaluated fine. Pov will make the final
  49.     parsing work.
  50.      
  51.  -  vector expressions <a,b,c> or x,y,z cant be close to math expressions
  52.     for the moment... I'll working on this and try to recognize vectors.
  53.     So vector calculation will be available...
  54.     PovMath can't understand for the moment:
  55.  
  56.     translate z*(3^4)
  57.     rotate <a,b,c>*asin (0.5)
  58.  
  59.     but this is valid:
  60.  
  61.     translate z*
  62.     (3^4)
  63.     rotate <a,b,c>*
  64.     asin (0.5)
  65.  
  66.     and this is valid too:
  67.  
  68.     #declare my_trans=3^4
  69.     #declare my_rot=asin(0.5)
  70.     translate z*my_trans
  71.     rotate <a,b,c>*my_rot
  72.  
  73. It's  possible  that sentences that I can not handle will  be  ok  for  Pov,
  74. because  this  restrictions exist only if a POVMATH's not handle  part  have
  75. language extensions. Sentence not handled are just keep as same. There's  no
  76. others  restrictions  a  priori.  all float expression  with  understandable
  77. sentence (known math function and pre-declared variable name) are valid.
  78.  
  79. A little explanations of "how this stuff work" for the most curious:
  80.  
  81. PovMath get all parameters like Pov's ones (+ and - caracters), and some for
  82. it  own work (with / caracter). You can use .DEF files too. Then, it try  to
  83. evaluate  line by line the Pov script, recognize math sentences, declaration
  84. variables,  include  files and it's own language extension.  Full  recognize
  85. math sentences are replaced with there float equivalent value and Pov's file
  86. result  is written in a file named $.POV, with it's equivalent def  file  as
  87. $.DEF  (pov  parameters could be modify by PovMath script  itself).  there's
  88. also  a batch file, $.BAT, what is called at the end of PovMath's job. $.BAT
  89. call  Pov, and if there's errors, translate line numbers on the screen (from
  90. $.POV  lines  errors)  are replace with the good name,  and  the  good  line
  91. numbers (an additive $.ERR file is create, for later useful corrections). If
  92. a loop is supplied, the batch file (if there's no errors) call again PovMath
  93. and  do the loop. A $.VAR file is automatically create, to keep all variable
  94. values  for  one PovMath call to an other. name $.VAR can be replace  by  an
  95. other name with the /O option.
  96.  
  97.  
  98. And now, the Run-Time Library Reference (You know, I'm a poor developer <G>)
  99.  
  100.  
  101. Known constants ( R2D2 is (sqrt(2)/2) ;-) ):
  102.  
  103.    Pi, Ln10, R2D2
  104.  
  105.  
  106. known math operators (^ is power, ! is factorial):
  107.  
  108.    + - * / ^ !
  109.  
  110.  
  111. known  Boolean operators (Boolean operations _MUST_ be parenthesized, result
  112. value is 0 or 1, to use it in a math expression):
  113.  
  114.    ==  !=  <  <=  >  >=
  115.  
  116.  
  117. known  math  functions in alphabetic order (trig functions  are  in  degree,
  118. names are C compliant):
  119.  
  120.    acos   a      arccosine
  121.    asin   a      arcsine
  122.    atan   a      arctangent
  123.    atan2  a,b    arctangent b/a
  124.    beep   .      idem to: tone (400,15)
  125.    ceil   a      integer ceiling
  126.    cos    a      cosine
  127.    cosh   a      hyperbolic cosine
  128.    eval   a      1 if it is possible to evaluate math expression, else 0
  129.    exp    a      exponential function
  130.    abs    a      absolute value
  131.    fact   a      factorial function
  132.    floor  a      largest integer less or equal
  133.    fmod   a,b    floating point remainder of a/b
  134.    getch  a      if a is an extended key, value is ascii code + 256
  135.    hypot  a,b    hypothenuse of a right triangle
  136.    ldexp  a,b    real number from the mantissa and exponent
  137.    log    a      natural logarithm
  138.    log10  a      base-10 logarithm
  139.    max    a,b    larger of 2 values
  140.    min    a,b    smaller of 2 values
  141.    pow    a,b    a raised to the power of b
  142.    rand   a      pseudorandom [0 <= n <= a] (initialized by #srand )
  143.    sign   a      sign of argument (1 or -1)
  144.    sin    a      sine
  145.    sinh   a      hyperbolic sine
  146.    sqrt       a      square root
  147.    tan    a      tangent
  148.    tanh   a      hyperbolic tangent
  149.    time   .      number of second elapsed since Midnight January,1,1970 UCT
  150.    tone   a,b    a=frequency (in hertz), b=duration (in 100th of seconds)
  151.    vect   a,b,c  hypothenuse of a right 3D vector
  152.  
  153.  
  154. Additional  command line parameters (All Pov's 2.2 parameters are  available
  155. with  '+'  and '-' caracters, PovMath parameters must be used with  the  '/'
  156. caracter.):
  157.  
  158.    /?     Need help ?
  159.    /N     Precise Pov's location (path, name or path+name)
  160.           Can be any program or batch name that can manage the $.DEF file.
  161.    /V     Variable declaration. Can be any valid math declaration.
  162.           ex: /V"a=sin(45)"
  163.    /P     Print list of variables after parsing, and abort Pov's call.
  164.           (idem as declare in script: #declare _print=1)
  165.    /I     Input file variable list and declare them (same format as output
  166.           option). Can be any list of variable form as "name=value". Try a
  167.           /O as a file example.
  168.    /O     Output file variable list with values after parsing (all know
  169.           variables, from include file, line param or variable list)
  170.    /L     Loop call scene until param is TRUE (useful with input/output
  171.           variables).
  172.           ex: POVMATH -iTEST.POV /V a=0 /V _ext=a /La==5
  173.           TEST.POV must have somewhere #declare _ext=a and #declare a=a+1
  174.           this example call TEST.POV 5 time, and output TGA files from
  175.           TEST.000 to TEST.004
  176.           note: if there's '<' or '>' in param, it must be quoted to not
  177.           confuse this silly Dos with pipe redirection.
  178.  
  179.  
  180. known  parameters  variables (useful to get, use  and  modify  Pov's  params
  181. command line. Boolean values : 0 = FALSE, other value = TRUE):
  182.  
  183. With Pov's equivalence (with + or -):
  184. (it's possible to add others pov's parameters, but what for ??)
  185.  
  186.    _quality           same as     Q   image quality
  187.    _aliasing             "        A   active aliasing
  188.    _tolerance            "            aliasing value
  189.    _rays                 "        R   aa-depth (use n X n rays/pixel)
  190.    _jitter               "        J   active jitter (0 or 1 for -+)
  191.    _scale                "            jitter value
  192.    clock                 "        K   set frame clocK to x.x
  193.    _symbol               "        MS  set max symbol table size to xxx
  194.    _width                "        W   set width of image in pixels
  195.    _height               "        H   set height of image in pixels
  196.    _start_r              "        SR  start at row xxx
  197.    _end_r                "        ER  end at row xxx
  198.    _start_c              "        SC  start at col xxx
  199.    _end_c                "        EC  end at col xxx
  200.    _name                 "        O   add number after the output name
  201.    _ext                  "        I   make output extension as number
  202.  
  203.  
  204. FTP (Faster than Pov) parameters
  205.  
  206.    _ftp_vista_buffer     "        UVB   use the vista buffer
  207.    _ftp_light_buffer     "        ULB   use the light buffer
  208.    _ftp_split_finite     "        USF   split unclipped CSG unions if their
  209.                                         children are finite.
  210.    _ftp_split_all        "        USI   split all unclipped CGS unions
  211.    _ftp_bound_quadrics   "        UBQ   use automatic bounding for quadrics
  212.    _ftp_preview          "        UPV   use 'previewing' (just draws
  213.                                         object's bounding rectangles; CGS
  214.                                         objects are blue, other objects are
  215.                                         red).
  216.  
  217.  
  218. PovMath equivalence (with /):
  219.  
  220.    _print             same as     P     print variables and dont shell to
  221.                                         Pov. Set _print to 1 can be use to
  222.                                         abort a loop calculation (the
  223.                                         current parse file $.POV is _not_
  224.                                         calculate).
  225.    _break           no equivalence      Set to 1 to break the current loop
  226.                                         (the current parse file $.POV is
  227.                                         calculate)
  228.    _loop            no equivalence      Value start from 0, automaticaly
  229.                                         incremented from each loop. Could
  230.                                         be modify by a #declare.
  231.  
  232.  
  233. Pov's language extension (must be one _and_only_one_ sentence by line):
  234.  
  235.    #include       can have syntax like "name", "name,line" or
  236.                   "name,start,stop" where line, start and stop are line
  237.                   numbers to extract part of a file instead of the entire
  238.                   file.
  239.    
  240.    #srand n       value to initialize the pseudo-random generator (default
  241.                   to #srand 1 for each PovMath cession.). if n dont exist
  242.                   (#srand with no parameters) initialise to a totally
  243.                   ramdom starting point.
  244.    
  245.    #if (c)        test if c is not equal to 0.
  246.                   c can be any math or boolean expression.
  247.    #else          -> you know that
  248.    #endif         -> dont you ?? ;-)
  249.    
  250.    #repeat        repeat loop
  251.    #until (c)     until (c) is true (not equal to 0)
  252.    
  253.    #break         break from the current loop
  254.    
  255.    #message       print a message on console during parsing
  256.    
  257.    #return        return from current #include, or stop parsing and shell
  258.                   to pov immediately.
  259.    
  260.    #kill n        undeclare the variable n. Do nothing if n doesn't exist.
  261.                   Can be used with system variables, but what for !? ;-)
  262.    
  263.    #time n        print on console n=number of seconds in an ascci format
  264.                   with days, hours, minutes, seconds. Usefull to use with
  265.                   time().
  266.                   ex: start=time ()
  267.                       [...]
  268.                       stop=time ()
  269.                       #time stop-start
  270.    
  271.    #path s        Same as /N option. Argument string "s" _MUST_ be
  272.                   quotted.
  273.    
  274.    #loop s        Same as /L option. Argument string "s" _MUST_ be
  275.                   quotted. #loop "" is an infinite loop (must by break
  276.                   with #abort by ex.) #loop "1" is a TRUE condition that
  277.                   break the loop at the end of the parsing work.
  278.    
  279.    #abort         Immediately abort parsing, and stop current loop (if any
  280.                   exist).
  281.    
  282.    #exec s        DOS system call. Argument string "s" _MUST_ be quotted.
  283.    
  284.    #input_var s   Read variable file description at current parse position
  285.                   (same format as /I and /O options). replace existing
  286.                   variables or define new ones. File name "s" must be
  287.                   quotted.
  288.    
  289.    #output_var s  Write variable file description at current parse
  290.                   position (same format as /I and /O options). File name
  291.                   "s" must be quotted.
  292.    
  293.    #eval s        eval s, but dont write the line in output file. Usefull
  294.                   to declare internal variables that dont appear in parsed
  295.                   script, or to use functions like tone, beep, getch...
  296.    
  297.  
  298. And now, the famous: What's new in this version ?
  299.  
  300. 0.1ß [03/07/94]
  301.     - First Beta version
  302.  
  303. 0.2ß [09/07/94]
  304.     - find and correct bug in indented #if, dont work well in 0.1ß
  305.     - Add #repeat #until loop extension
  306.     - Add #break (break the current loop, only repeat/until for the moment)
  307.     - Add #message (just trace message to print on the console)
  308.     - Add #return (return from current include file, or stop parsing at
  309.       location, and shell to Pov)
  310.     - Add _loop variable, incremented by the loop batch (0 for the first
  311.       parsing work, add 1 for the nexts). Can be use to make work only
  312.       on first loop (when _loop==0) or to use it in a #declare _ext=_loop
  313.       for animation, by example.
  314.     - Add #srand with no value start the random to a totally random
  315.       starting point (different from one call to another).
  316.     - new math function eval, useful to test existence of variable, or math
  317.       errors.
  318.     - Add #kill to "undeclare" the existence of a variable.
  319.     - Add #time to print a time (number of seconds) in ascii string.
  320.     - Add new math function:
  321.       hypot, vect, atan2, fmod, ldexp, max, min, pow, time
  322.  
  323. 0.3ß [10/07/94]
  324.     - find and correct bug in indented functions with more than one
  325.       parameter
  326.     - find and correct bug in Pov's parameters -SR -ER -SC -EC .
  327.     - Add compatibility with FTP 2.0 (Faster than Pov) options (+uvb, +ulb,
  328.       +usf, +usi, +ubq, +upv) and add system variables to be able to change
  329.       them in a Pov script ( _ftp_vista_buffer, _ftp_light_buffer,
  330.       _ftp_split_finite, _ftp_split_all, _ftp_bound_quadrics,
  331.       _ftp_preview).
  332.     - Add #path, #loop, #abort, #exec, #input_var, #output_var, #eval.
  333.     - Add new functions: getch, beep, tone
  334.  
  335. 0.4ß [31/07/94]
  336.     - first public release (still beta)
  337.  
  338.  
  339. That's all.
  340.  
  341. My english is not very good, sorry for that. And I've made a very big effort
  342. to translate all my job in English, so dont blame me <G>.
  343. If  there's something not clear, please contact me on Compuserve, on Zyllius
  344. BBS  or  on the shared BBS conference Raytrace, and I'll be happy to try  to
  345. help you.
  346.  
  347.                                                  Daniel Munoz, 31 July 1994.
  348.  
  349.  
  350.