The HUtilityGeomHandle class contains a set of functions which controls the creation and manipulation of geometry handles.
More...
#include <HUtilityGeomHandle.h>
|
void | AdjustPointToRay (HC_KEY geomhandlekey, HPoint &p, HC_KEY camerasegment, HBaseView *view) |
|
virtual void | AdjustPositionToPlane (HC_KEY handlekey, HPoint &p, float a, float b, float c, float d, HC_KEY camerakey) |
|
virtual void | AdjustPositionToRay (HC_KEY handlekey, HPoint &C, HPoint A, HPoint B) |
|
virtual float | CalculatePlaneZ (HC_KEY handlekey, HPoint point) |
|
virtual void | CalculatePositionOnPlane (HC_KEY handlekey, HPoint &p, float a, float b, float c, float d) |
|
virtual void | CalculateTransformedPosition (HC_KEY handlekey, HPoint &t, HBaseView *view) |
|
virtual void | ConstrainToOnOff (HC_KEY handlekey, HBaseView *view=0) |
|
virtual void | ConstrainToPlane (HC_KEY handlekey, HPoint p1, HPoint p2, HPoint p3, HBaseView *view=0) |
|
virtual void | ConstrainToRay (HC_KEY handlekey, HPoint p1, HPoint p2, HBaseView *view=0) |
|
virtual void | ConstrainToRotationVector (HC_KEY handlekey, HPoint p1, HPoint p2, HBaseView *view=0) |
|
virtual void | ConstrainToScale (HC_KEY handlekey, HPoint p1, HPoint p2, HBaseView *view=0) |
|
virtual void | ConstrainToViewplane (HC_KEY handlekey, HBaseView *view=0) |
|
virtual void | GetConstraintParameters (HC_KEY handlekey) |
|
HConstrainType | GetConstraintType (HC_KEY handlekey) |
|
virtual HPoint * | GetRotationAxis (HC_KEY handlekey) |
|
virtual HC_KEY | Insert (HPoint position, bool edges=false, int level=4) |
|
virtual void | Move (HC_KEY handlekey, HPoint newposition, HC_KEY camerakey, HBaseView *view=0) |
|
virtual void | ResetHandle (HC_KEY handlekey, float scale=0.5f, HBaseView *view=0) |
|
void | Rotate (HC_KEY handlekey, float rotangle) |
|
virtual void | Scale (HC_KEY handlekey, float scalex, float scaley, float scalez) |
|
virtual void | SetupGeomHandleSegment (bool edges) |
|
virtual void | ShowBasePosition (HC_KEY handlekey, HPoint &bp) |
|
virtual void | ShowHandle (HC_KEY handlekey, float sf=0.7f, HBaseView *view=0) |
|
virtual void | TurnOff (HC_KEY handlekey) |
|
|
static void | ClearAllHandles (HBaseView *view) |
|
static bool | ContainsGeomHandles (HC_KEY key) |
|
static void | GetCenterPoint (HC_KEY objectkey, HPoint ¢erpoint) |
|
static HC_KEY | GetMMSegment (HC_KEY handlekey) |
|
static HC_KEY | IsGeomHandle (HC_KEY key) |
|
static void | RegisterCallbacks () |
| Registers various callbacks needed for this class.
|
|
static HC_KEY | SelectHandle (HBaseView *view, HPoint pos) |
|
static HC_KEY | SelectObject (HBaseView *view, HPoint pos, HC_KEY oldkey, bool exclude, float proximity=0.3) |
|
static void | SetupCuttingPlane (HC_KEY key, HBaseView *view) |
|
static void | SetupCuttingPlaneManipulator (HC_KEY startkey, HBaseView *view, HPoint *midpoint=0, bool omit_rotate=false) |
|
static HC_KEY | SetupManipulator (HC_KEY startkey, HBaseView *view, HPoint *mp, bool AddNonUniformScale=true, bool AddScale=true, bool AddPlane=true, bool AddAxismove=true, bool AddAxisrotate=true, bool AddViewplaneMove=true) |
|
static void | SetupObject (HC_KEY key, HBaseView *view, float boxzoom=1.0f) |
|
static void | SetupTextObject (HC_KEY key, HBaseView *view, float boxzoom=1.0f, float scale=1.0f) |
|
static void | SetVisibilityForAll (HC_KEY startkey, const char *visibility) |
|
The HUtilityGeomHandle class contains a set of functions which controls the creation and manipulation of geometry handles.
"Handles" can be attached to any geometry in the HOOPS segment tree. They can be used for dragging, rotating or scaling of objects. By specifying constraints, it is possible to limit their movement to a given ray or plane.
"Handles" are created as subsegments of any segment that contains geometry that needs to be manipulated. Multiple handles can be created fot the same geometry.
◆ AdjustPointToRay()
void HUtilityGeomHandle::AdjustPointToRay |
( |
HC_KEY |
geomhandlekey, |
|
|
HPoint & |
p, |
|
|
HC_KEY |
camerasegment, |
|
|
HBaseView * |
view |
|
) |
| |
This method adjusts the given point p to lie to the ray that constrains the given handles.
- Parameters
-
geomhandlekey | The key to the handle segment. |
p | The point to be adjusted. When the method returned, p will be populated with the newly adjusted values. |
camerasegment | The key to the associated camera segment. |
view | A pointer to the HBaseView object. |
◆ AdjustPositionToPlane()
virtual void HUtilityGeomHandle::AdjustPositionToPlane |
( |
HC_KEY |
handlekey, |
|
|
HPoint & |
p, |
|
|
float |
a, |
|
|
float |
b, |
|
|
float |
c, |
|
|
float |
d, |
|
|
HC_KEY |
camerakey |
|
) |
| |
|
virtual |
This method adjusts point p to lie on a plane(described by the planar equation ax + by + cz + d = 0) by constructing a ray defined by the camera position and the point itself.
- Parameters
-
handlekey | The key to the handle segment. |
p | The point to be adjusted. |
a | The first parameter that defines the plane. |
b | The second parameter that defines the plane. |
c | The third parameter that defines the plane. |
d | The fourth parameter that defines the plane. |
camerakey | key to segment with desired reference camera |
◆ AdjustPositionToRay()
virtual void HUtilityGeomHandle::AdjustPositionToRay |
( |
HC_KEY |
handlekey, |
|
|
HPoint & |
C, |
|
|
HPoint |
A, |
|
|
HPoint |
B |
|
) |
| |
|
virtual |
This method adjusts the given point C to lie on the ray defined by points A and B.
- Parameters
-
handlekey | The key to the handle segment. |
C | The point to be adjusted. |
A | The first point that define the ray. |
B | The second point that defines the ray. |
◆ CalculatePlaneZ()
virtual float HUtilityGeomHandle::CalculatePlaneZ |
( |
HC_KEY |
handlekey, |
|
|
HPoint |
point |
|
) |
| |
|
virtual |
This method calculates the correct z value corresponding to the handle plane for a given point.
Note that you must pass a segment with camera attributes to be open.
- Parameters
-
handlekey | The key to the handle segment. |
point | The point for which z value needs to be calculated |
- Returns
- The z value on the handle plane.
◆ CalculatePositionOnPlane()
virtual void HUtilityGeomHandle::CalculatePositionOnPlane |
( |
HC_KEY |
handlekey, |
|
|
HPoint & |
p, |
|
|
float |
a, |
|
|
float |
b, |
|
|
float |
c, |
|
|
float |
d |
|
) |
| |
|
virtual |
This method projects the given point C to a given plane described via the parameters of a planar equation ax + by + cz + d = 0.
- Parameters
-
handlekey | The key to the handle segment. |
p | The point to be adjusted. |
a | The first parameter that defines the plane. |
b | The second parameter that defines the plane. |
c | The third parameter that defines the plane. |
d | The fourth parameter that defines the plane. |
◆ CalculateTransformedPosition()
virtual void HUtilityGeomHandle::CalculateTransformedPosition |
( |
HC_KEY |
handlekey, |
|
|
HPoint & |
t, |
|
|
HBaseView * |
view |
|
) |
| |
|
virtual |
This method calculates the handle position after being combined with the world modelling transformation.
- Parameters
-
handlekey | The key to the handle segment. |
t | The handle position to be transformed. |
view | A pointer to HBaseView object. |
◆ ClearAllHandles()
static void HUtilityGeomHandle::ClearAllHandles |
( |
HBaseView * |
view | ) |
|
|
static |
This method delete all the handles from the current HBaseView.
- Parameters
-
view | A pointer to the view object. |
◆ ConstrainToOnOff()
virtual void HUtilityGeomHandle::ConstrainToOnOff |
( |
HC_KEY |
handlekey, |
|
|
HBaseView * |
view = 0 |
|
) |
| |
|
virtual |
This method constrains the given handle to delete associated geometry
- Parameters
-
handlekey | The key to the handle segment. |
◆ ConstrainToPlane()
This method constrains handle movement to the given plane.
- Parameters
-
handlekey | The key to the handle segment. |
p1 | The first point which defines the plane. |
p2 | The second point which defines the plane. |
p3 | The third point which defines the plane. |
◆ ConstrainToRay()
virtual void HUtilityGeomHandle::ConstrainToRay |
( |
HC_KEY |
handlekey, |
|
|
HPoint |
p1, |
|
|
HPoint |
p2, |
|
|
HBaseView * |
view = 0 |
|
) |
| |
|
virtual |
This method constrains the given handle's movement to the given ray.
- Parameters
-
handlekey | The key to the handle segment. |
p1 | The first point which defines the ray. |
p2 | The second point which defines the ray. |
◆ ConstrainToRotationVector()
virtual void HUtilityGeomHandle::ConstrainToRotationVector |
( |
HC_KEY |
handlekey, |
|
|
HPoint |
p1, |
|
|
HPoint |
p2, |
|
|
HBaseView * |
view = 0 |
|
) |
| |
|
virtual |
This method constrains the given handle's rotation to the passed rotation vector.
- Parameters
-
handlekey | The key to the handle segment. |
p1 | The first point which defines the rotation vector. |
p2 | The second point which defines the rotation vector. |
◆ ConstrainToScale()
virtual void HUtilityGeomHandle::ConstrainToScale |
( |
HC_KEY |
handlekey, |
|
|
HPoint |
p1, |
|
|
HPoint |
p2, |
|
|
HBaseView * |
view = 0 |
|
) |
| |
|
virtual |
The method contrains the given handle to the given scale.
- Parameters
-
handlekey | The key to the handle segment. |
p1 | The center for scaling. |
p2 | The initial scaling value along the three axis. Pass 1.0 to indicate no scaling. |
◆ ConstrainToViewplane()
virtual void HUtilityGeomHandle::ConstrainToViewplane |
( |
HC_KEY |
handlekey, |
|
|
HBaseView * |
view = 0 |
|
) |
| |
|
virtual |
This method contrains the given handle's movement to the view plane.
- Parameters
-
handlekey | The key to the handle segment. |
◆ ContainsGeomHandles()
static bool HUtilityGeomHandle::ContainsGeomHandles |
( |
HC_KEY |
key | ) |
|
|
static |
This method identifies if the given segment or any of it's subsegments contains handles.
- Parameters
-
key | The key to the segment. |
- Returns
- True if there is handle in segment or subsegments or false if there are no handles.
◆ GetCenterPoint()
static void HUtilityGeomHandle::GetCenterPoint |
( |
HC_KEY |
objectkey, |
|
|
HPoint & |
centerpoint |
|
) |
| |
|
static |
This method finds the center point of the object (in its local space) attached to the given handle.
- Parameters
-
objectkey | The object attached to the handle. |
centerpoint | Returns a center point of the object. |
◆ GetConstraintParameters()
virtual void HUtilityGeomHandle::GetConstraintParameters |
( |
HC_KEY |
handlekey | ) |
|
|
virtual |
This method restores the constraint parameters for a given handle from user options to the class members so that they can be used for calculations like rotate.
- Parameters
-
handlekey | key to handle segment |
◆ GetConstraintType()
HConstrainType HUtilityGeomHandle::GetConstraintType |
( |
HC_KEY |
handlekey | ) |
|
|
inline |
This method gets the constraint type for the given handle.
- Parameters
-
handlekey | The key to handle segment. |
- Returns
- The constraint type of the given handle.
◆ GetMMSegment()
static HC_KEY HUtilityGeomHandle::GetMMSegment |
( |
HC_KEY |
handlekey | ) |
|
|
static |
This method finds a key to attached a modelling matrix segment for a given handle.
- Parameters
-
handlekey | A key to the handle. |
- Returns
- The segment key containing modelling matrix.
◆ GetRotationAxis()
virtual HPoint* HUtilityGeomHandle::GetRotationAxis |
( |
HC_KEY |
handlekey | ) |
|
|
inlinevirtual |
This method gets the rotation axis for a handle with a rotational constraint.
- Parameters
-
handlekey | The key to the handle segment. |
- Returns
- A pointer to array defining the ray.
◆ Insert()
virtual HC_KEY HUtilityGeomHandle::Insert |
( |
HPoint |
position, |
|
|
bool |
edges = false , |
|
|
int |
level = 4 |
|
) |
| |
|
virtual |
Creates a new handle underneath the currently open segment.
- Parameters
-
position | The coordinates where the handle should be created. |
edges | Pass true to display edges for handle arrows or false not to show them. |
level | Modelling Matrix level for handles. |
- Returns
- The key of the newly created handle segment.
◆ IsGeomHandle()
static HC_KEY HUtilityGeomHandle::IsGeomHandle |
( |
HC_KEY |
key | ) |
|
|
static |
This method identifies if the given segment has handles.
- Parameters
-
key | The key to the segment. |
- Returns
- The original key that was passed if there are handles or INVALID_KEY if there are no handles.
◆ Move()
virtual void HUtilityGeomHandle::Move |
( |
HC_KEY |
handlekey, |
|
|
HPoint |
newposition, |
|
|
HC_KEY |
camerakey, |
|
|
HBaseView * |
view = 0 |
|
) |
| |
|
virtual |
This method moves the handle position. Note this affects the associated geometry.
- Parameters
-
handlekey | The key to the handle segment. |
newposition | The coordinates of the new handle position. |
camerakey | The key to the camera segment. |
view | A pointer to the HBaseView object. |
◆ ResetHandle()
virtual void HUtilityGeomHandle::ResetHandle |
( |
HC_KEY |
handlekey, |
|
|
float |
scale = 0.5f , |
|
|
HBaseView * |
view = 0 |
|
) |
| |
|
virtual |
This method shows the given handle with default values.
- Parameters
-
handlekey | The key to the handle segment. |
scale | The scale factor for the handle. |
◆ Rotate()
void HUtilityGeomHandle::Rotate |
( |
HC_KEY |
handlekey, |
|
|
float |
rotangle |
|
) |
| |
This method applies a given rotation angle to the associated geometry of the handle.
- Parameters
-
handlekey | The key to the handle segment. |
rotangle | The angle of rotation in degrees. |
◆ Scale()
virtual void HUtilityGeomHandle::Scale |
( |
HC_KEY |
handlekey, |
|
|
float |
scalex, |
|
|
float |
scaley, |
|
|
float |
scalez |
|
) |
| |
|
virtual |
This method applies a scale matrix to the geometry associated with the given handle.
- Parameters
-
handlekey | The key to the handle segment. |
scalex | The scale factor in x direction. |
scaley | The scale factor in y direction. |
scalez | The scale factor in z direction. |
◆ SelectHandle()
static HC_KEY HUtilityGeomHandle::SelectHandle |
( |
HBaseView * |
view, |
|
|
HPoint |
pos |
|
) |
| |
|
static |
This method finds the handle that is closest to the given screen position.
- Parameters
-
view | A pointer to the view object. |
pos | The screen position. |
- Returns
- The key of the closest handle or INVALID_KEY if no handle was found.
◆ SelectObject()
static HC_KEY HUtilityGeomHandle::SelectObject |
( |
HBaseView * |
view, |
|
|
HPoint |
pos, |
|
|
HC_KEY |
oldkey, |
|
|
bool |
exclude, |
|
|
float |
proximity = 0.3 |
|
) |
| |
|
static |
This method finds an object to attach handles to based on the given screen position.
- Parameters
-
view | A pointer to view object. |
pos | The screen position. |
oldkey | The key to the currently active object. |
exclude | Pass true to exclude currently active object from the search or false if you want to include it in the search. |
proximity | The selection proximity to be used. Pass a negative number for "no selection proximity" |
- Returns
- The key of the object that was found or INVALID_KEY if no object was found.
◆ SetupCuttingPlane()
static void HUtilityGeomHandle::SetupCuttingPlane |
( |
HC_KEY |
key, |
|
|
HBaseView * |
view |
|
) |
| |
|
static |
This method has been deprecated. Please use SetupCuttingPlaneManipulator instead.
- Parameters
-
key | The cutting plane segment to attach handles to. |
view | A pointer to the view object. |
◆ SetupCuttingPlaneManipulator()
static void HUtilityGeomHandle::SetupCuttingPlaneManipulator |
( |
HC_KEY |
startkey, |
|
|
HBaseView * |
view, |
|
|
HPoint * |
midpoint = 0 , |
|
|
bool |
omit_rotate = false |
|
) |
| |
|
static |
This method attaches default handles to a cutting plane object.
- Parameters
-
startkey | The cutting plane segment to attach handles to. |
view | A pointer to the view object. |
◆ SetupGeomHandleSegment()
virtual void HUtilityGeomHandle::SetupGeomHandleSegment |
( |
bool |
edges | ) |
|
|
virtual |
This method sets default attributes for the handle segment which includes turning LOD off and backplane culling.
- Parameters
-
edges | Pass true to display edges for handle arrows. |
◆ SetupManipulator()
static HC_KEY HUtilityGeomHandle::SetupManipulator |
( |
HC_KEY |
startkey, |
|
|
HBaseView * |
view, |
|
|
HPoint * |
mp, |
|
|
bool |
AddNonUniformScale = true , |
|
|
bool |
AddScale = true , |
|
|
bool |
AddPlane = true , |
|
|
bool |
AddAxismove = true , |
|
|
bool |
AddAxisrotate = true , |
|
|
bool |
AddViewplaneMove = true |
|
) |
| |
|
static |
This method attaches handles with the specified attributes to the given object.
- Parameters
-
startkey | The segment key to attach handles to. |
view | A pointer to the view object. |
mp | The midpoint for the handles. |
AddNonUniformScale | Pass true to create a handle of this type. |
AddScale | Pass true to create a handle of this type. |
AddPlane | Pass true to create a handle of this type. |
AddAxismove | Pass true to create a handle of this type. |
AddAxisrotate | Pass true to create a handle of this type. |
AddViewplaneMove | Pass true to create a handle of this type. |
- Returns
- The top level key that contains all the newly created handles.
◆ SetupObject()
static void HUtilityGeomHandle::SetupObject |
( |
HC_KEY |
key, |
|
|
HBaseView * |
view, |
|
|
float |
boxzoom = 1.0f |
|
) |
| |
|
static |
This method attaches default handles to a given object.
- Parameters
-
key | The key to the segment to attach handles to. |
view | A pointer to the view object. |
boxzoom | The default scale factor for the object's bounding box. |
◆ SetupTextObject()
static void HUtilityGeomHandle::SetupTextObject |
( |
HC_KEY |
key, |
|
|
HBaseView * |
view, |
|
|
float |
boxzoom = 1.0f , |
|
|
float |
scale = 1.0f |
|
) |
| |
|
static |
This method attaches default handles to a given text object.
- Parameters
-
key | The key to the segment to attach handles to. |
view | A pointer to the view object. |
boxzoom | The default scale factor for the object's bounding box. |
scale | The text scale factor. |
◆ SetVisibilityForAll()
static void HUtilityGeomHandle::SetVisibilityForAll |
( |
HC_KEY |
startkey, |
|
|
const char * |
visibility |
|
) |
| |
|
static |
This method sets the visibility for all handles.
- Parameters
-
startkey | The start key to search for handles. |
visibility | The visibility setting as described in HC_Set_Visibility. |
◆ ShowBasePosition()
virtual void HUtilityGeomHandle::ShowBasePosition |
( |
HC_KEY |
handlekey, |
|
|
HPoint & |
bp |
|
) |
| |
|
virtual |
This method shows the initial position of the given handle relative to segment attached to the handle.
- Parameters
-
handlekey | The key to the handle segment. |
bp | Returns the coordinate of the initial handle position. |
◆ ShowHandle()
virtual void HUtilityGeomHandle::ShowHandle |
( |
HC_KEY |
handlekey, |
|
|
float |
sf = 0.7f , |
|
|
HBaseView * |
view = 0 |
|
) |
| |
|
virtual |
This method shows the given handle with the passed scale factor and with a symbol based on constraint type.
- Parameters
-
handlekey | The key to handle segment. |
sf | The scale factor for the handle. |
◆ TurnOff()
virtual void HUtilityGeomHandle::TurnOff |
( |
HC_KEY |
handlekey | ) |
|
|
virtual |
This method delete the geometry associated with the handle.
- Parameters
-
handlekey | The key to the handle segment. |
The documentation for this class was generated from the following file: