User:Jr/tmc demo

From POV-Wiki
< User:Jr
Revision as of 14:46, 28 August 2026 by Jr (talk | contribs) (a copy & paste demo scene for 'tmc'.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
/* 'tmc.inc' demo */

#version 3.8;

global_settings {assumed_gamma 1}

/* dummy to suppress no objects in scene warning */
box {0,1}

//#declare View_POV_Include_Stack = 1;

/* up to six digits is "safe" to provide on the command line,
 * more will get rounded or cause an error.
 */
#ifndef (Seed)
  #declare seed_ = 12345;
#elseif (int(Seed) != Seed)
  #error "oops, expect 'Seed' to be an integer value."
#else
  #declare seed_ = Seed;
#end

#macro GT (n_)
  tmcAdd(counts_,"GT")
  #debug concat("'n' (",str(n_,0,6),") is half or more.\n")
#end

#macro LT (n_)
  tmcAdd(counts_,"LT")
  #debug concat("'n' (",str(n_,0,6),") is less than half.\n")
#end

#include "tmc.inc"

#declare counts_ = tmcNew();

#declare iters_ = 100;

#declare rng_ = seed(seed_);

#for (i_, 0, iters_-1)
  #local n_ = rand(rng_);
  #if (.5 <= n_)
    GT(n_)
  #else
    LT(n_)
  #end
#end

tmcReport(counts_)