Name

nirt_formatting — DRAFT!!! Document supported output formatting specifications for Natalie's Interactive RayTracer (NIRT)

Overview

One of the most powerful features of Natalie's Interactive RayTracer (NIRT) is the ability to support user-defined output formatting for its outputs. The fmt command allows on-the-fly alteration of what and how various values generated by shotline intersections, using a subset of the C/C++ printf format specifier syntax for flexibile template specification and a series of pre-defined keys to specify individual elements of generated results. The general form of a fmt command is:

fmt 'char' "format string" [keys...]

where the "char" argument is replaced by a single character identifying the category of output the format string applies. The "format string" is the printf style formatting string, and the keys will line up with format specifiers in the string the same way variables in C/C++ line up with specifiers in a printf format string.

Output Categories

NIRT offers seven categories of output reporting:

Category NameCharDescription
RayrReport of ray information. The formatting associated with r will print once per ray, regardless of whether a region is encountered.
HeaderhFirst output after a ray hits anything, typically used to identify columns in subsequent output. Printed once per ray.
PartitionpOutput for each region encountered by the ray. Typically this will be where most of the information about a model is reported.
FootnotefLast output statement after a ray hits anything; a "footnote" line after the ray has completed its evaluations. Printed once per ray.
GapgOutput written once for each gap the ray may encounter.
MissmIf triggered, prints a message that nothing was hit; maximum once per ray.
OverlapoOutput written once for each overlap along the ray.

Format Strings

NIRT's format specifications are a subset of those found in printf implementations. Specifically, the d, i, and f types are supported, as well as width and precision specifiers.

Reporting Keys - Connecting Data to Format Strings

Unlike the full C/C++ printf, NIRT accepts only pre-defined string keys that identify elements of specific information related to each cateogry of output. Ray information is consistent over an entire shot event, and therefore Ray keys may be used in all categories:

Table 1. Ray Variables

x_origx coordinate of ray origination point.
y_origy coordinate of ray origination point.
z_origz coordinate of ray origination point.
d_origd coordinate of ray origination point.
hh coordinate for the entire ray.
vv coordinate for the entire ray.
x_dirx component of direction vector.
y_diry component of direction vector.
z_dirz component of direction vector.
aazimuth of view (i.e., of ray direction).
eelevation of view (i.e., of ray direction).



Footnote and Miss categories have no particular keys unique to them, although they (like all categories) can use the Ray keys if desired. Partition, Overlap, and Gap, on the other hand, have keys that are unique to their contexts and valid only within those contexts:

Table 2. Partition Variables

attributesA string variable consisting of the names and values of the attributes requested by the attr interactive command or the -A command line option.
x_inx coordinate of entry into current region.
y_iny coordinate of entry into current region.
z_inz coordinate of entry into current region.
d_ind coordinate of entry into current region.
x_outx coordinate of exit from current region.
y_outy coordinate of exit from current region.
z_outz coordinate of exit from current region.
d_outd coordinate of exit from current region.
losline-of-sight distance through current region.
scaled_losscaled line of sight: product of line-of-sight distance through current region and region solidity (sometimes called ``percent LOS''). Note that "region solidity" refers to a thickness equivalence factor often used to simulate material properties like density.
path_namefull path name of current region.
reg_namename of current region
reg_idregion ID of current region.
claimant_countnumber of regions claiming this partition (that is, participating in a retained overlap).
claimant_listspace-separated list of names of regions claiming this partition (that is, participating in a retained overlap).
claimant_listnSame as claimant_list, except that it is newline, rather than space-separated.
obliq_inentry obliquity for current region.
obliq_outexit obliquity for current region.
nm_x_inx component of entry normal vector
nm_y_iny component of entry normal vector
nm_z_inz component of entry normal vector
nm_h_inh component of entry normal vector
nm_v_inv component of entry normal vector
nm_d_ind component of entry normal vector
nm_x_outx component of exit normal vector
nm_y_outy component of exit normal vector
nm_z_outz component of exit normal vector
nm_h_outh component of exit normal vector
nm_v_outv component of exit normal vector
nm_d_outd component of exit normal vector
surf_num_inentry-surface ID of entry solid.
surf_num_outexit-surface ID of exit solid.



Table 3. Overlap Variables

ov_reg1_namename of one of the overlapping regions.
ov_reg2_namename of the other overlapping region.
ov_reg1_idregion ID of one of the overlapping regions.
ov_reg2_idregion ID of the other overlapping region.
ov_sol_inname of one of the overlapping solids.
ov_sol_outname of the other overlapping solid.
ov_losline-of-sight distance through the overlap.
ov_x_inx coordinate of entry into overlap.
ov_y_iny coordinate of entry into overlap.
ov_z_inz coordinate of entry into overlap.
ov_d_ind coordinate of entry into overlap.
ov_x_outx coordinate of exit from overlap.
ov_y_outy coordinate of exit from overlap.
ov_z_outz coordinate of exit from overlap.
ov_d_outd coordinate of exit from overlap.



Table 4. Gap Variables

x_gap_inx coordinate of entry into gap.
y_gap_iny coordinate of entry into gap.
z_gap_inz coordinate of entry into gap.
gap_losline-of-sight distance through gap.