<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%========================================================================
\section{Generating Your Own Hazard Files}
\label{sec_gen_hazards}
%========================================================================

Random hazard field files may be generated with the \app{gen\_hazard} utility.
For example, the following command-line invocation will generate the file 
shown in Section \ref{sec_hazard_format}:

\vspace{0.12in}
\begin{consoleverb}
 $ gen_hazards --polygon=-100,0:-100,-300:300,-300:300,0 --objects=5,hazard --objects=8,benign
\end{consoleverb}
\vspace{0.12in}

\noindent
Hazard resemblance factors may be automatically generated with the
\var{--exp=N} command line option. When this option is used, each
benign object will have a initial resemblance factor chosen with a
uniform random variable in the range of $[0,1]$. This number is then
raise to the power of $N$.  For example, the below command line
invocation:


\vspace{0.12in}
\begin{consoleverb}
 $ gen_hazards --polygon=-100,0:-100,-300:300,-300:300,0 --objects=5,hazard --objects=8,benign
  --exp 3 &gt; hazards.txt
\end{consoleverb}
\vspace{0.12in}

\noindent
would create a new file, \var{hazards.txt}, with the below
content. The first line is a comment line that reflects the command
line invocation responsible for the output.

\vspace{0.1in}
\begin{fileverb}
// gen_hazards --polygon=-150,-75:-150,-400:400,-400:400,-75 --objects=5,hazard --objects=8,benign 
--exp=3
hazard = x=292,y=-253,label=22,type=hazard
hazard = x=224,y=-322,label=51,type=hazard
hazard = x=-1,y=-136,label=37,type=hazard
hazard = x=131,y=-115,label=55,type=hazard
hazard = x=-14,y=-201,label=76,type=hazard
hazard = x=38,y=-230,label=87,type=benign,hr=0.0199
hazard = x=228,y=-134,label=49,type=benign,hr=0.02172
hazard = x=262,y=-346,label=9,type=benign,hr=0.06842
hazard = x=30,y=-310,label=45,type=benign,hr=0.01544
hazard = x=-29,y=-141,label=59,type=benign,hr=0.00417
hazard = x=57,y=-343,label=23,type=benign,hr=0.17845
hazard = x=148,y=-387,label=86,type=benign,hr=0.31861
hazard = x=30,y=-313,label=84,type=benign,hr=0.37481
\end{fileverb}
\vspace{0.12in}

\noindent
The \app{gen\_hazards} tool does not generate output regarding the shape, color
or width of an object. Those characteristics need to be added by hand in the 
hazard file if the user desires.

\pskip

One caveat is that the polygon provided to \app{gen\_hazards}, must be
convex. For example, note the following erroneous invocation and
output (two vertices do not constitute a convex polygon):

\vspace{0.12in}
\begin{consoleverb}
$ gen_hazards --polygon=400,-400:400,-75 --objects=3,hazard --objects=3,benign
Invalid/Non-convex polygon specified: 400,-400:400,-75
\end{consoleverb}
\vspace{0.12in}


</pre></body></html>