HOpConstructCone

class HOpConstructCone

The HOpConstructCone class provides support for constructing a cone and inserting it into the model.

HOpConstructCone implements four of the mouse button event handlers defined on the base class and maps the event information to the local methods that rubberband a cone. This class provides the basic functionality for temporarily drawing a three-dimensional, tesselated cone with a circular base and a number of triangular, facetted sides with the default being 30. The operation consists of the following steps:

  1. Left Button Down: Registers the center point of the cone base.
  2. Left Button Down and Drag: Rubberbands the circle to the desired base circumferences
  3. Left Button Up: The base circumference is finalized.
  4. No Button Down and Drag: Rubberbands the cone to desired height.
  5. Left Button Down: The height is finalized, the operation is ended and the primitive is removed from the scene.

More Detailed Description: see event methods.

Inherits from: HBaseOperator

Methods

void HOpConstructCone::GenerateLinesThroughCircle(HPoint const &center, float radius)

private

void HOpConstructCone::ConstructWireframeCone(HPoint center, float radius, float height)

protected

ConstructWireframeCone transforms the pointer coordinates from screen to world space and inserts a wireframe cone into the scene. This function is called internally by OnNoButtonDownAndMove after the base dimensions have been finalized.

Parameters

center: The center of the circle that forms base of the cone.

radius: The length of the radius of the cone’s base.

height: The height of the cone.

HOpConstructCone::HOpConstructCone(HBaseView *view, int DoRepeat = 0, int DoCapture = 1)

Constructs an HOpConstructCone 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. This parameter has been deprecated.

virtual HOpConstructCone::~HOpConstructCone()

virtual

virtual char const *HOpConstructCone::GetName()

virtual

Returns

A pointer to a character string denoting the name of the operator, which is ‘HOpConstructCone‘.
virtual int HOpConstructCone::OnLButtonDown(HEventInfo &hevent)

virtual

OnLButtonDown records the first pointer position and initiates the cone-drawing mechanism. The first point is used as the center of the cone’s circular base. If the drawing mechanism has already been started such as LButtonDown having been called once already, LButtonDown record the last point, calculates the height of the cone, finalizes the operator and then clear the geometry from the scene.

Parameters

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

Returns

An HOperatorReturn indicating the status of the event.
virtual int HOpConstructCone::OnNoButtonDownAndMove(HEventInfo &hevent)

virtual

OnNoButtonDownAndMove draws rubberband lines from the circular base of the cone to the current mouse position. Note that the basic work is done by internal calls to HOpConstructCone::ConstructWireframeCone.

Parameters

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

Returns

An HOperatorReturn indicating the status of the event.
virtual int HOpConstructCone::OnLButtonDownAndMove(HEventInfo &hevent)

virtual

OnLButtonDownAndMove draws a rubberbanded line along the circumference of a circle centered on the first pointer position. Note that the basic drawing work is done by HUtility::CreateAxisCircle, while OnLButtonDownAndMove computes and keeps track of the radial vector that defines the base.

Parameters

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

Returns

An HOperatorReturn indicating the status of the event.
virtual int HOpConstructCone::OnLButtonUp(HEventInfo &hevent)

virtual

OnLButtonUp finalizes the size of the base, sets the value of m_RadiusLength and m_radius_world_vector, and cleans up. This function is not called after the second call to OnLButtonDown.

Parameters

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

Returns

An HOperatorReturn indicating the status of the event.
virtual HBaseOperator *HOpConstructCone::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 HOpConstructCone object.

Variables

float HOpConstructCone::m_height

protected

float

Height of the cone, based on first and last pointer positions

float HOpConstructCone::m_RadiusLength

protected

float

Magnitude of the base radius vector, in screen coordinates

HVector HOpConstructCone::m_WorldRadiusVector

protected

Base radius vector in world coordinates