Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HOpObjectClash Class Reference

#include <HOpObjectClash.h>

Inheritance diagram for HOpObjectClash:

HOpObjectTranslate HBaseOperator

List of all members.

Public Member Functions

virtual HBaseOperatorClone ()
virtual const char * GetName ()
 HOpObjectClash (HBaseView *view, int doRepeat=0, int doCapture=1)
virtual int OnKeyDown (HEventInfo &hevent)
virtual int OnLButtonDown (HEventInfo &hevent)
virtual int OnLButtonDownAndMove (HEventInfo &hevent)
virtual int OnLButtonUp (HEventInfo &hevent)
virtual void UpdateKeyList (void *data)
virtual ~HOpObjectClash ()
 The destructor restores the HBaseView's HSelectionSet to its state before this operator was initialized.

Protected Types

enum  HOOC_Result { HOOC_Unknown = -1, HOOC_In = 1, HOOC_Out = 2, HOOC_Clash = 3 }
enum  HOOC_SelectMode { HOOC_World = 1, HOOC_Screen = 2, HOOC_Shell = 3, HOOC_Enclosure = 4 }

Protected Member Functions

void ClashDetect (HEventInfo &hevent)
int GetScreenVolume (HC_KEY seg, HPoint &min, HPoint &max)
int GetWorldVolume (HC_KEY seg, HPoint &min, HPoint &max)
void GrabSelectionSet ()
int IntersectPolyline (HC_KEY key1, float *transformed_points1)
void ProcessSelectionResults (HC_KEY current_shell=HC_ERROR_KEY, float *transformed_points=0)
void RestoreSelectionSet ()
virtual int SelectByEnclosure (HSmartSelItem *sel_item)
virtual int SelectByScreenVolume (HSmartSelItem *sel_item)
virtual int SelectByShell (HSmartSelItem *sel_item)
virtual int SelectByWorldVolume (HSmartSelItem *sel_item)
void SetSelectMode (int mode)
int TestEnclosure (HC_KEY current_shell_key, float *transformed_points)

Protected Attributes

int m_IntersectPolylinesVisible
HSelectionSetm_pClashSelection
bool m_save_spriting_mode
int m_SelectMode
HC_KEY m_TempSegKey


Detailed Description

The HOpObjectClash class detects and highlights objects that intersect a set of translated objects. The set of objects to be translated, a.k.a. "the part", is assumed to be selected at the segment level prior to activating this operator. The computation can be done in several ways as described in HOOC_SelectMode but the most important mode that this operator demonstrates is HOOC_Shell. In that mode, shells from the scene, a.k.a "the environment", are selected and highlighted if their faces cross the part's faces.

This operator currently makes the (sometimes false) assumption that shells in the part are affected only by modelling matrices in their ancestry, as opposed to via some include path.

HOpObjectClash employs the transform functionality of HOpObjectTranslate to move an object around a scene, and extends two of the mouse event handlers defined on HOpObjectTranslate to perform clash detection. The operation consists of the following steps:

  1. Left Button Down: The operation is initiated. The translation objects are selected.
  2. Left Button Down and Drag: Clashed objects are highlighted.
  3. Left Button Up: The operation is ended. The clashed objects are deselected.
More Detailed Description: see event methods.

Member Enumeration Documentation

enum HOpObjectClash::HOOC_Result [protected]

HOOC_Result is the result code for the object clash calculation.

Enumerator:
HOOC_Unknown  The relationship between the objects is unknown.
HOOC_In  The translated objects are completely enclosed by the highlighted object.
HOOC_Out  The translated objects is not completely enclosed by the highlighted object.
HOOC_Clash  The selected objects intersect wit the translated objects.

The selection can be computed in several different ways.

Enumerator:
HOOC_World  This selection mode computes the selection in world coordinates prior to the camera transformation and then looks for bounding box intersections. Use this mode for speed.
HOOC_Screen  This selection mode computes the selection in screen coordinates and looks for bounding box intersections.
HOOC_Shell  This selection mode looks for shells that intersect the faces of the current selection set in HBaseView. This is the default mode and is most accurate.
HOOC_Enclosure  This selection mode detects if the selection is completely enclosed by the translated object.


Constructor & Destructor Documentation

HOpObjectClash::HOpObjectClash ( HBaseView view,
int  doRepeat = 0,
int  doCapture = 1 
)

Constructs an HOpObjectClash object.

Parameters:
view A pointer to an HBaseView object,
DoRepeat An integer denoting whether this is a repeatable operator. This parameter has been deprecated.
DoCapture An integer denoting whether the mouse state should be captured, which means that all mouse events should be received after a mousedown, even if it leaves the window.


Member Function Documentation

void HOpObjectClash::ClashDetect ( HEventInfo hevent  )  [protected]

This method performs a translation on the selected objects and then highlights objects that intersected with them.

Parameters:
hevent An HEventInfo object containing information about the current event.

virtual HBaseOperator* HOpObjectClash::Clone (  )  [virtual]

Creates a new operator which is a copy of the current operator. The user is responsible for deleting the newly created operator.

Returns:
A pointer to the newly created HOpObjectClash object.

Reimplemented from HOpObjectTranslate.

virtual const char* HOpObjectClash::GetName (  )  [virtual]

Returns:
A pointer to a character string denoting the name of the operator which 'HOpObjectClash'.

Reimplemented from HOpObjectTranslate.

int HOpObjectClash::GetScreenVolume ( HC_KEY  seg,
HPoint min,
HPoint max 
) [protected]

This method gets the screen space volume of the given segment, as seen by driver in the current view.

Parameters:
seg The key of segment in which you want to compute the bounding box.
min Returns the minimum point of the bounding box volume.
max Returns the maximum point of the bounding box volume.
Returns:
An HOperatorReturn indicating the status of the event.

int HOpObjectClash::GetWorldVolume ( HC_KEY  seg,
HPoint min,
HPoint max 
) [protected]

This method gets the world space volume of the given segment. This is a helper function to SelectByWorldVolume.

Parameters:
seg The key of segment in which you want to compute the bounding box.
min Returns the minimum point of the bounding box volume.
max Returns the maximum point of the bounding box volume.
Returns:
An HOperatorReturn indicating the status of the event.

void HOpObjectClash::GrabSelectionSet (  )  [protected]

This method temporary "steals" the selection set from the HBaseView and replaces it with a new empty one.

int HOpObjectClash::IntersectPolyline ( HC_KEY  key1,
float *  transformed_points1 
) [protected]

This method computes the polyline of intersection between two shells.

Parameters:
key1 The key of the shell to find intersection with the selection shell.
transformed_points1 The point list of the shell.
Returns:
The total number of intersecting line segments.

virtual int HOpObjectClash::OnKeyDown ( HEventInfo hevent  )  [virtual]

This method grabs the following hot keys and then passes the rest to HBaseOperator.

  • d : This hot key puts the operator into screen selection mode where it computes the selections in screen space and looks for bounding box intersections.
  • e : This hot key puts the operator into enclosure selection mode where it detect if the original shell completely encloses the selected shell.
  • p : This hot key toggles on and off the indicate whether to calculate the polylines of intersection between objects that we find clashing.
  • s : This hot key puts the operator into shell selection mode where it looks for shells that intersect the faces of the current selection set in HBaseView. Use shell selection mode for accuracy.
  • w : This hot key puts the operator into world selection mode where it computes the selections in world space prior to camera tranformations and looks for bounding box intersections. Use world selection mode for speed.
Parameters:
hevent An HEventInfo object containing information about the current event.
Returns:
An HOperatorReturn indicating the status of the event.

Reimplemented from HBaseOperator.

virtual int HOpObjectClash::OnLButtonDown ( HEventInfo hevent  )  [virtual]

OnLButtonDown records the first pointer position and initializes the translation mechanism. It then calls through to ClashDetect. It "steals" the view's selection set and sets it as a member variable so that the objects with which collisions are detected can be put there.

Parameters:
hevent An HEventInfo object containing information about the current event.
Returns:
An HOperatorReturn indicating the status of the event.

Reimplemented from HOpObjectTranslate.

virtual int HOpObjectClash::OnLButtonDownAndMove ( HEventInfo hevent  )  [virtual]

This method calls through to ClashDetect to do most of its work.

Parameters:
hevent An HEventInfo object containing information about the current event.
Returns:
An HOperatorReturn indicating the status of the event.

Reimplemented from HOpObjectTranslate.

virtual int HOpObjectClash::OnLButtonUp ( HEventInfo hevent  )  [virtual]

OnLButtonUp deselects the highlighted objects.

Parameters:
hevent An HEventInfo object containing information about the current event.
Returns:
An HOperatorReturn indicating the status of the event.

Reimplemented from HOpObjectTranslate.

void HOpObjectClash::ProcessSelectionResults ( HC_KEY  current_shell = HC_ERROR_KEY,
float *  transformed_points = 0 
) [protected]

This method loops through the selected object and all of the results from HC_Find_Related_Selection, and send them to the appropriate HSelectionSet.

Parameters:
current_shell The key of the shell we want to highlight.
transformed_points The point list of the shell.

void HOpObjectClash::RestoreSelectionSet (  )  [protected]

This method restores the selection set back to the HBaseView.

virtual int HOpObjectClash::SelectByEnclosure ( HSmartSelItem sel_item  )  [protected, virtual]

This method find if a given segment is fully enclosed by any other objects and then selects them. The selected items will be added to the current view's selection list and highlighted as usual.

Parameters:
seg The key of the segment to select.
Returns:
An HOperatorReturn indicating the status of the event.

virtual int HOpObjectClash::SelectByScreenVolume ( HSmartSelItem sel_item  )  [protected, virtual]

This method finds if a given segment in screen space clashes with any other objects in the scene and then selects them. The selected items will be added to the current view's selection list and highlighted as usual.

Parameters:
seg The key of the segment to perform clash detection on.
Returns:
An HOperatorReturn indicating the status of the event.

virtual int HOpObjectClash::SelectByShell ( HSmartSelItem sel_item  )  [protected, virtual]

This method finds if a given shell clashes with any other shells and selects them. After selection, the selection list will contain all shells in the model that intersect the faces of the shells in the segment given by "seg".

Parameters:
seg The key of the segment to check for clashes with other shells.
Returns:
An HOperatorReturn indicating the status of the event.

virtual int HOpObjectClash::SelectByWorldVolume ( HSmartSelItem sel_item  )  [protected, virtual]

This method finds if a given segment in world space clashes with any other object in the scene and then selects them. The selected items will be added to the current view's selection list and highlighted as usual.

Parameters:
seg The key of the segment to select.
Returns:
An HOperatorReturn indicating the status of the event.

void HOpObjectClash::SetSelectMode ( int  mode  )  [protected]

This method sets the type of computing selection described in HOOC_SelectMode enum. HOOC_Shell is the default.

Parameters:
mode The mode in which you would like to perform selection and clash detection.

int HOpObjectClash::TestEnclosure ( HC_KEY  current_shell_key,
float *  transformed_points 
) [protected]

This is a helper function for ProcessSelectionResults(). It tests if the hit object encloses the shell.

Parameters:
current_shell_key The key of the shell that we want to test if it is enclosed by another object.
transformed_points The point list of the shell.
Returns:
An HOOC_Result describing if result of the enclosure test.

virtual void HOpObjectClash::UpdateKeyList ( void *  data  )  [virtual]

This method is used to update the list of keys to translate when the selection list changes.

Reimplemented from HOpObjectTranslate.


Member Data Documentation

A boolean to indicate whether or not to calculate the polylines of intersection between objects that we find clashing.

The set of objects being dragged around.

The spriting mode before this operator started up which is restored on deletion.

The type of computing selection described in HOOC_SelectMode enum. HOOC_Shell is the default.

HC_KEY HOpObjectClash::m_TempSegKey [protected]

The key to the segment into which the text overlay, with a transparent window, is put.


The documentation for this class was generated from the following file: