kh_generator(gert) Gert kh_generator(gert)
NAME
kh_generator
DESCRIPTION
Kh_hierarchy is a used to build k_hierarchy tree. Even for
small scenes containing few dozens of geometry primitives
k_hierarchy tree can contain hundreds and even thousands
of instances.
Thus kh_generator immensely simplifies the task of ray
tracing complex scenes. The instances kh_generator creates
can be written to the file to be used lately.
If camera position and orientation is changed there is no
need to recreate k_hierarchy, but one would do so if some
geometries are changed (repositioned, reoriented, or
rescaled).
SUPERCLASS
generator
INSTANCE VARIABLES
geometries
is the list of geometry objects for which
k_hierarchy is built.
hierarchy_prefix
is the prefix that is used by kh_generator to generate names in k_hierarchy.
multislab_prefix
is the prefix that is used by kh_generator to generate names in for multislabs associated with
k_hierarchy instances.
script
is the indicator for script output into file.
Forces output to the file if set to true (1).
threshold
is a minimum ratio of primitive bounding box volume
to hierarchy bounding box volume granting inclusion
of primitive as a child in hierarchy.
MESSAGES
generate!
generates script for k_hierarchy and associated
multislab objects.
geometries=(+,-)argument
sets (adds, deletes) members of geometries.
geometries?
returns members of geometries.
hierarchy_prefix=argument
sets the value of hierarchy_prefix.
hierarchy_prefix?
returns the value of hierarchy prefix.
multislab_prefix=argument
sets the value of multislab_prefix.
multislab_prefix?
returns the value of multislab_prefix.
script=argument
sets the value of script, default is false (0).
script?
returns the value of script instance variable.
script_off!
sets script instance variable to 0.
script_on!
sets script instance variable to 1.
threshold=argument
sets the value of threshold instance variable.
threshold?
returns the value of threshold instance variable.
EXAMPLE
/*
Define some geometry primitives then create an instance of
kh_generator.
*/
sphere new: s1 position=(11,37,66) scale= (11,20,36);
cone new: c1 position=(15,4,10) scale= (2, 1, 8);
block new: b1 position=(5,7,21) scale= (1,1,1);
g1 :=kh_generator{
geometries= [geometry instances?]
hierarchy_prefix= h_
multislab_prefix= m_
file= example.scr
script=1
threshold= 0.03
};
g1 generate!;
SEE ALSO
multislab, ray, geometry, block, cone, cone, sphere, properties
Please send comments and suggestions toconsult@rpi.edu