# HOpObjectClash

## Functions

| `HOpObjectClash`
| `~HOpObjectClash`
const char * | `GetName`
int | `OnLButtonDown`
int | `OnLButtonDownAndMove`
int | `OnLButtonUp`
int | `OnKeyDown`
HBaseOperator * | `Clone`
void | `UpdateKeyList`

## Detailed Description

class HOpObjectClash : public HOpObjectTranslate

  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.

  Public Functions

  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.

  virtual ~HOpObjectClash()

    The destructor restores the HBaseView’s HSelectionSet to its state before this operator was initialized.

  virtual const char *GetName()
    Returns

      A pointer to a character string denoting the name of the operator which ‘HOpObjectClash’.

  virtual int OnLButtonDown(HEventInfo &hevent)

    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.

  virtual int OnLButtonDownAndMove(HEventInfo &hevent)

    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.

  virtual int OnLButtonUp(HEventInfo &hevent)

    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.

  virtual int OnKeyDown(HEventInfo &hevent)

    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.

  virtual HBaseOperator *Clone()

    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.

  virtual void UpdateKeyList(void *data)

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