home *** CD-ROM | disk | FTP | other *** search
- POVMATH 0.4ß
- the PovRay's Mathematical
- pre-processor
- ( from the French Riviera :-) )
-
- Author: Daniel Munoz
- CIS 100256,773
- Zyllius BBS: 33-93320505
-
-
-
- Thanks for trying PovMath, the PovRay's Mathematical pre-processor.
- PovRay program is (C) POV-Ray team
-
- This program is far from all my whishes, but I think it is already usable
- for math and animation pre-processing. So, here it is (TAADAAAAA), I hope
- you'll enjoy it. It have for the moment some little Pov syntax restrictions.
- Here is a list, so you can see if they are big problems for you. These
- restrictions are due to the way PovMath try to evaluate and modify the Pov's
- original language. In fact, PovMath only try to recognize some parts of the
- language, line by line, not all the entire expressions. The good news is
- that will allow possibility to recognize future syntaxes and language
- enhancement from Pov.
-
- Any comment, suggestion, are greatly appreciates.
- ( wish-list too :-))) )
-
- Here's the restriction list:
-
- - only one #include sentence by line.
- PovMath can't understand:
-
- #include "one" #declare a=b #include "two"
-
- - #declare sentences must be on the same line.
- PovMath can't understand:
-
- #declare a=
- b
-
- - math strings to eval must be on the same line.
- PovMath can't understand:
-
- sphere { < 0,0,0 >, 45+
- sin(alpha)
- *2
-
- But the string sin(alpha) is evaluated fine. Pov will make the final
- parsing work.
-
- - vector expressions <a,b,c> or x,y,z cant be close to math expressions
- for the moment... I'll working on this and try to recognize vectors.
- So vector calculation will be available...
- PovMath can't understand for the moment:
-
- translate z*(3^4)
- rotate <a,b,c>*asin (0.5)
-
- but this is valid:
-
- translate z*
- (3^4)
- rotate <a,b,c>*
- asin (0.5)
-
- and this is valid too:
-
- #declare my_trans=3^4
- #declare my_rot=asin(0.5)
- translate z*my_trans
- rotate <a,b,c>*my_rot
-
- It's possible that sentences that I can not handle will be ok for Pov,
- because this restrictions exist only if a POVMATH's not handle part have
- language extensions. Sentence not handled are just keep as same. There's no
- others restrictions a priori. all float expression with understandable
- sentence (known math function and pre-declared variable name) are valid.
-
- A little explanations of "how this stuff work" for the most curious:
-
- PovMath get all parameters like Pov's ones (+ and - caracters), and some for
- it own work (with / caracter). You can use .DEF files too. Then, it try to
- evaluate line by line the Pov script, recognize math sentences, declaration
- variables, include files and it's own language extension. Full recognize
- math sentences are replaced with there float equivalent value and Pov's file
- result is written in a file named $.POV, with it's equivalent def file as
- $.DEF (pov parameters could be modify by PovMath script itself). there's
- also a batch file, $.BAT, what is called at the end of PovMath's job. $.BAT
- call Pov, and if there's errors, translate line numbers on the screen (from
- $.POV lines errors) are replace with the good name, and the good line
- numbers (an additive $.ERR file is create, for later useful corrections). If
- a loop is supplied, the batch file (if there's no errors) call again PovMath
- and do the loop. A $.VAR file is automatically create, to keep all variable
- values for one PovMath call to an other. name $.VAR can be replace by an
- other name with the /O option.
-
-
- And now, the Run-Time Library Reference (You know, I'm a poor developer <G>)
-
-
- Known constants ( R2D2 is (sqrt(2)/2) ;-) ):
-
- Pi, Ln10, R2D2
-
-
- known math operators (^ is power, ! is factorial):
-
- + - * / ^ !
-
-
- known Boolean operators (Boolean operations _MUST_ be parenthesized, result
- value is 0 or 1, to use it in a math expression):
-
- == != < <= > >=
-
-
- known math functions in alphabetic order (trig functions are in degree,
- names are C compliant):
-
- acos a arccosine
- asin a arcsine
- atan a arctangent
- atan2 a,b arctangent b/a
- beep . idem to: tone (400,15)
- ceil a integer ceiling
- cos a cosine
- cosh a hyperbolic cosine
- eval a 1 if it is possible to evaluate math expression, else 0
- exp a exponential function
- abs a absolute value
- fact a factorial function
- floor a largest integer less or equal
- fmod a,b floating point remainder of a/b
- getch a if a is an extended key, value is ascii code + 256
- hypot a,b hypothenuse of a right triangle
- ldexp a,b real number from the mantissa and exponent
- log a natural logarithm
- log10 a base-10 logarithm
- max a,b larger of 2 values
- min a,b smaller of 2 values
- pow a,b a raised to the power of b
- rand a pseudorandom [0 <= n <= a] (initialized by #srand )
- sign a sign of argument (1 or -1)
- sin a sine
- sinh a hyperbolic sine
- sqrt a square root
- tan a tangent
- tanh a hyperbolic tangent
- time . number of second elapsed since Midnight January,1,1970 UCT
- tone a,b a=frequency (in hertz), b=duration (in 100th of seconds)
- vect a,b,c hypothenuse of a right 3D vector
-
-
- Additional command line parameters (All Pov's 2.2 parameters are available
- with '+' and '-' caracters, PovMath parameters must be used with the '/'
- caracter.):
-
- /? Need help ?
- /N Precise Pov's location (path, name or path+name)
- Can be any program or batch name that can manage the $.DEF file.
- /V Variable declaration. Can be any valid math declaration.
- ex: /V"a=sin(45)"
- /P Print list of variables after parsing, and abort Pov's call.
- (idem as declare in script: #declare _print=1)
- /I Input file variable list and declare them (same format as output
- option). Can be any list of variable form as "name=value". Try a
- /O as a file example.
- /O Output file variable list with values after parsing (all know
- variables, from include file, line param or variable list)
- /L Loop call scene until param is TRUE (useful with input/output
- variables).
- ex: POVMATH -iTEST.POV /V a=0 /V _ext=a /La==5
- TEST.POV must have somewhere #declare _ext=a and #declare a=a+1
- this example call TEST.POV 5 time, and output TGA files from
- TEST.000 to TEST.004
- note: if there's '<' or '>' in param, it must be quoted to not
- confuse this silly Dos with pipe redirection.
-
-
- known parameters variables (useful to get, use and modify Pov's params
- command line. Boolean values : 0 = FALSE, other value = TRUE):
-
- With Pov's equivalence (with + or -):
- (it's possible to add others pov's parameters, but what for ??)
-
- _quality same as Q image quality
- _aliasing " A active aliasing
- _tolerance " aliasing value
- _rays " R aa-depth (use n X n rays/pixel)
- _jitter " J active jitter (0 or 1 for -+)
- _scale " jitter value
- clock " K set frame clocK to x.x
- _symbol " MS set max symbol table size to xxx
- _width " W set width of image in pixels
- _height " H set height of image in pixels
- _start_r " SR start at row xxx
- _end_r " ER end at row xxx
- _start_c " SC start at col xxx
- _end_c " EC end at col xxx
- _name " O add number after the output name
- _ext " I make output extension as number
-
-
- FTP (Faster than Pov) parameters
-
- _ftp_vista_buffer " UVB use the vista buffer
- _ftp_light_buffer " ULB use the light buffer
- _ftp_split_finite " USF split unclipped CSG unions if their
- children are finite.
- _ftp_split_all " USI split all unclipped CGS unions
- _ftp_bound_quadrics " UBQ use automatic bounding for quadrics
- _ftp_preview " UPV use 'previewing' (just draws
- object's bounding rectangles; CGS
- objects are blue, other objects are
- red).
-
-
- PovMath equivalence (with /):
-
- _print same as P print variables and dont shell to
- Pov. Set _print to 1 can be use to
- abort a loop calculation (the
- current parse file $.POV is _not_
- calculate).
- _break no equivalence Set to 1 to break the current loop
- (the current parse file $.POV is
- calculate)
- _loop no equivalence Value start from 0, automaticaly
- incremented from each loop. Could
- be modify by a #declare.
-
-
- Pov's language extension (must be one _and_only_one_ sentence by line):
-
- #include can have syntax like "name", "name,line" or
- "name,start,stop" where line, start and stop are line
- numbers to extract part of a file instead of the entire
- file.
-
- #srand n value to initialize the pseudo-random generator (default
- to #srand 1 for each PovMath cession.). if n dont exist
- (#srand with no parameters) initialise to a totally
- ramdom starting point.
-
- #if (c) test if c is not equal to 0.
- c can be any math or boolean expression.
- #else -> you know that
- #endif -> dont you ?? ;-)
-
- #repeat repeat loop
- #until (c) until (c) is true (not equal to 0)
-
- #break break from the current loop
-
- #message print a message on console during parsing
-
- #return return from current #include, or stop parsing and shell
- to pov immediately.
-
- #kill n undeclare the variable n. Do nothing if n doesn't exist.
- Can be used with system variables, but what for !? ;-)
-
- #time n print on console n=number of seconds in an ascci format
- with days, hours, minutes, seconds. Usefull to use with
- time().
- ex: start=time ()
- [...]
- stop=time ()
- #time stop-start
-
- #path s Same as /N option. Argument string "s" _MUST_ be
- quotted.
-
- #loop s Same as /L option. Argument string "s" _MUST_ be
- quotted. #loop "" is an infinite loop (must by break
- with #abort by ex.) #loop "1" is a TRUE condition that
- break the loop at the end of the parsing work.
-
- #abort Immediately abort parsing, and stop current loop (if any
- exist).
-
- #exec s DOS system call. Argument string "s" _MUST_ be quotted.
-
- #input_var s Read variable file description at current parse position
- (same format as /I and /O options). replace existing
- variables or define new ones. File name "s" must be
- quotted.
-
- #output_var s Write variable file description at current parse
- position (same format as /I and /O options). File name
- "s" must be quotted.
-
- #eval s eval s, but dont write the line in output file. Usefull
- to declare internal variables that dont appear in parsed
- script, or to use functions like tone, beep, getch...
-
-
- And now, the famous: What's new in this version ?
-
- 0.1ß [03/07/94]
- - First Beta version
-
- 0.2ß [09/07/94]
- - find and correct bug in indented #if, dont work well in 0.1ß
- - Add #repeat #until loop extension
- - Add #break (break the current loop, only repeat/until for the moment)
- - Add #message (just trace message to print on the console)
- - Add #return (return from current include file, or stop parsing at
- location, and shell to Pov)
- - Add _loop variable, incremented by the loop batch (0 for the first
- parsing work, add 1 for the nexts). Can be use to make work only
- on first loop (when _loop==0) or to use it in a #declare _ext=_loop
- for animation, by example.
- - Add #srand with no value start the random to a totally random
- starting point (different from one call to another).
- - new math function eval, useful to test existence of variable, or math
- errors.
- - Add #kill to "undeclare" the existence of a variable.
- - Add #time to print a time (number of seconds) in ascii string.
- - Add new math function:
- hypot, vect, atan2, fmod, ldexp, max, min, pow, time
-
- 0.3ß [10/07/94]
- - find and correct bug in indented functions with more than one
- parameter
- - find and correct bug in Pov's parameters -SR -ER -SC -EC .
- - Add compatibility with FTP 2.0 (Faster than Pov) options (+uvb, +ulb,
- +usf, +usi, +ubq, +upv) and add system variables to be able to change
- them in a Pov script ( _ftp_vista_buffer, _ftp_light_buffer,
- _ftp_split_finite, _ftp_split_all, _ftp_bound_quadrics,
- _ftp_preview).
- - Add #path, #loop, #abort, #exec, #input_var, #output_var, #eval.
- - Add new functions: getch, beep, tone
-
- 0.4ß [31/07/94]
- - first public release (still beta)
-
-
- That's all.
-
- My english is not very good, sorry for that. And I've made a very big effort
- to translate all my job in English, so dont blame me <G>.
- If there's something not clear, please contact me on Compuserve, on Zyllius
- BBS or on the shared BBS conference Raytrace, and I'll be happy to try to
- help you.
-
- Daniel Munoz, 31 July 1994.
-
-
-