==============
TKE_Heuristics
==============

Opcode
======

.. csv-table::

	"ASCII", "H"
	"Hexadecimal", "48"
	"Decimal", "72"


Operands
========

| Variable mask, Variable value,
| [Long related_limit], [Long internal_limit], 
| [Byte details] [Variable culling] 
| [Long obscuration_threshold] [Long maximum_extent] 
| [Long maximum_extent_mode] [Byte ordered_weights] 
| [(number of bits set in ordered_weights)xByte ordered_weight_valuess] 

.. raw:: html

	<table BORDER =1 WIDTH="530">
	  <tr> 
		<td height=21 width=131>mask</TD>
		<td height=21 width=390>bitmask of options which are specified, <STRONG>Short</STRONG>, 
		  if high bit set a second <STRONG>Short</STRONG> follows</TD>
	  </tr>
	  <tr> 
		<td height=21 width=131>value</TD>
		<td height=21 width=390>bitmask of options which are set <em>on</em>, 
		  <STRONG>Short</STRONG>, if high bit of mask set a second <STRONG>Short</STRONG> 
		  follows</TD>
	  </tr>
	  <TR> 
		<TD height=21 width=131>related_limit</TD>
		<TD height=21 width=390>number of additional geometry entities to record 
		  which also satisfy selection criteria</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=131>internal_limit</TD>
		<TD height=21 width=390>number of geometry components within a selected 
		  entity (ie, faces and edges within a shell) to record in addition to 
		  the "best" one</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=131>details</TD>
		<TD height=21 width=390>bitmask to clarify a couple of the options which 
		  aren't simply <em>on/off</em></TD>
	  </TR>
	  <tr> 
		<td height=21 width=131>culling</TD>
		<td height=21 width=390>bitmask of culling options, second byte if hight 
		  bit of first byte set</TD>
	  </tr>
	  <tr> 
		<td height=21 width=131>obscuration_tjreshold</TD>
		<td height=21 width=390>if using obscuration culling, the maximum number 
		  of pixels which can be considered obscured</TD>
	  </tr>
	  <tr> 
		<td height=21 width=131>maximum_extent</TD>
		<td height=21 width=390>when doing extent culling, the maximum screen 
		  dimension which can be considered <em>small</em></TD>
	  </tr>
	  <tr> 
		<td height=21 width=131>maximum_extent_mode</TD>
		<td height=21 width=390>when doing extent culling, the action to take 
		  for <em>small</em> items (default is to skip)</TD>
	  </tr>
	  <tr> 
		<td height=21 width=131>ordered_weights</TD>
		<td height=21 width=390>bitmask of weights specified for ordered drawing</TD>
	  </tr>
	</table>
	
	
Notes
=====

Heuristics provide hints on how you may improve drawing speed. Some options may change the appearance of the drawing, such as *quick moves* using ``Xor`` drawing mode or *partial erase*, leaving holes in the drawing. For the specific definitions on what these mean in HOOPS/3dGS please refer to the ``Set_Heuristics`` specification in the 3dGS Reference Manual.


Mask/value bits
---------------

.. raw:: html

	<table BORDER =1 WIDTH="500">
	  <TR> 
		<TD height=21 width=50>00000001</TD>
		<TD height=21 width=390>Hidden Surfaces</TD>
	  </TR>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00000002</td>
		<td WIDTH=390 HEIGHT=21>Backplane Cull</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00000004</td>
		<td WIDTH=390 HEIGHT=21>Polygon Handedness, <em>details</em> field will 
		  be present if <em>on</em></td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00000008</td>
		<td WIDTH=390 HEIGHT=21>Quick Moves, <em>details</em> field will be present 
		  if <em>on</em></td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00000010</td>
		<td WIDTH=390 HEIGHT=21>Partial Erase</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00000020</td>
		<td WIDTH=390 HEIGHT=21>Memory Purge</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00000040</td>
		<td WIDTH=390 HEIGHT=21>Related selection limit, <em>related_limit</em> 
		  field will be present if <em>on</em></td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00000080</td>
		<td WIDTH=390 HEIGHT=21>Internal selection limit, <em>internal_limit</em> 
		  field will be present if <em>on</em></td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00000100</td>
		<td WIDTH=390 HEIGHT=21>Clipping</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00000200</td>
		<td WIDTH=390 HEIGHT=21>Transformations</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00000400</td>
		<td WIDTH=390 HEIGHT=21>Intersecting Polygons</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00000800</td>
		<td WIDTH=390 HEIGHT=21>Polygons Crossings</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00001000</td>
		<td WIDTH=390 HEIGHT=21>Concave Polygons</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00002000</td>
		<td WIDTH=390 HEIGHT=21>Incremental Updates</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00004000</td>
		<td WIDTH=390 HEIGHT=21>Selection Sorting</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00008000</td>
		<td WIDTH=390 HEIGHT=21>Extended mask/value size</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00010000</td>
		<td WIDTH=390 HEIGHT=21>Culling</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00020000</td>
		<td WIDTH=390 HEIGHT=21>Exlude Bounding</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00040000</td>
		<td WIDTH=390 HEIGHT=21>Detail Selection</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00080000</td>
		<td WIDTH=390 HEIGHT=21>Ordered Drawing</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00100000</td>
		<td WIDTH=390 HEIGHT=21>Ordered Unit</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00200000</td>
		<td WIDTH=390 HEIGHT=21>Ordered Weights</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00400000</td>
		<td WIDTH=390 HEIGHT=21>Internal Polyline Limit</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>00800000</td>
		<td WIDTH=390 HEIGHT=21>Ordered Grid</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>01000000</td>
		<td WIDTH=390 HEIGHT=21>Selection Level</td>
	  </tr>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>02000000</td>
		<td WIDTH=390 HEIGHT=21>Static Model</td>
	  </tr>
	</table>
	<H4>Detail bits:</H4>
	<table BORDER =1 WIDTH="500">
	  <TR> 
		<TD height=21 width=50>01</TD>
		<TD height=21 width=390>Polygons Handedness is <strong>left</strong> if 
		  set, <strong>right</strong> otherwise</TD>
	  </TR>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>02</td>
		<td WIDTH=390 HEIGHT=21>Quick Moves is to use <strong>spriting</strong> 
		  if set, <strong>Xor/overlay</strong> otherwise</td>
	  </tr>
	</table>
	<h4>Culling bits:</h4>
	<table BORDER =1 WIDTH="500">
	  <TR> 
		<TD height=21 width=50>01</TD>
		<TD height=21 width=390>View Frustum culling should be used</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>02</TD>
		<TD height=21 width=390>Onscuration culling should be used</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>04</TD>
		<TD height=21 width=390>Extent culling should be used</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>10</TD>
		<TD height=21 width=390>View Frustum culling should be ignored</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>20</TD>
		<TD height=21 width=390>Onscuration culling should be ignored</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>40</TD>
		<TD height=21 width=390>Extent culling should be ignored</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>80</TD>
		<TD height=21 width=390>Extended bits (second byte) present</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0100</TD>
		<TD height=21 width=390>Obscuration culling should use an octree organization</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0200</TD>
		<TD height=21 width=390>Maximum extent mode specified</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0400</TD>
		<TD height=21 width=390>Vector culling should be used</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>0800</TD>
		<TD height=21 width=390>Vector Tolerance culling should be used</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>1000</TD>
		<TD height=21 width=390>Vector culling should be ignored</TD>
	  </TR>
	  <TR> 
		<TD height=21 width=50>2000</TD>
		<TD height=21 width=390>Vector Tolerance culling should be ignored</TD>
	  </TR>
	</table>
	<h4>Maximum Extent Mode:</h4>
	<table BORDER =1 WIDTH="500">
	  <TR> 
		<TD height=21 width=50>0</TD>
		<TD height=21 width=390>None - skip drawing</TD>
	  </TR>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>1</td>
		<td WIDTH=390 HEIGHT=21>Dot - draw a pixel to represnt the item</td>
	  </tr>
	  <TR> 
		<TD height=21 width=50>2</TD>
		<TD height=21 width=390>Box - draw a bounding box to represent the item</TD>
	  </TR>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>3</td>
		<td WIDTH=390 HEIGHT=21>Defer - draw the item later if time permits</td>
	  </tr>
	</table>
	
	
Ordered weights
---------------

.. raw:: html

	<table BORDER =1 WIDTH="500">
	  <TR> 
		<TD height=21 width=50>01</TD>
		<TD height=21 width=390>World Volume</TD>
	  </TR>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>02</td>
		<td WIDTH=390 HEIGHT=21>Screen Extent</td>
	  </tr>
	  <TR> 
		<TD height=21 width=50>04</TD>
		<TD height=21 width=390>Distance (from camera)</TD>
	  </TR>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>08</td>
		<td WIDTH=390 HEIGHT=21>Divergence (from view centerline)</td>
	  </tr>
	  <TR> 
		<TD height=21 width=50>10</TD>
		<TD height=21 width=390>Density</TD>
	  </TR>
	  <tr> 
		<td WIDTH=50 HEIGHT=21>20</td>
		<td WIDTH=390 HEIGHT=21>Priority</td>
	  </tr>
	</table>
