HUtilityGeomHandle
Functions
HC_KEY |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
float |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
HPoint * |
|
void |
|
HC_KEY |
|
bool |
|
void |
|
HC_KEY |
|
HC_KEY |
|
void |
|
void |
|
void |
|
HC_KEY |
|
void |
|
HC_KEY |
|
void |
|
void |
Detailed Description
-
class HUtilityGeomHandle
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.
Public Functions
-
inline virtual ~HUtilityGeomHandle()
-
virtual HC_KEY Insert(HPoint position, bool edges = false, int level = 4)
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.
-
virtual void SetupGeomHandleSegment(bool edges)
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.
-
virtual void ConstrainToPlane(HC_KEY handlekey, HPoint p1, HPoint p2, HPoint p3, HBaseView *view = 0)
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.
-
virtual void ConstrainToViewplane(HC_KEY handlekey, HBaseView *view = 0)
This method contrains the given handle’s movement to the view plane.
- Parameters
handlekey – The key to the handle segment.
-
virtual void ConstrainToRay(HC_KEY handlekey, HPoint p1, HPoint p2, HBaseView *view = 0)
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.
-
virtual void ConstrainToRotationVector(HC_KEY handlekey, HPoint p1, HPoint p2, HBaseView *view = 0)
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.
-
virtual void ConstrainToScale(HC_KEY handlekey, HPoint p1, HPoint p2, HBaseView *view = 0)
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.
-
virtual void ConstrainToOnOff(HC_KEY handlekey, HBaseView *view = 0)
This method constrains the given handle to delete associated geometry
- Parameters
handlekey – The key to the handle segment.
-
virtual void Move(HC_KEY handlekey, HPoint newposition, HC_KEY camerakey, HBaseView *view = 0)
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.
-
virtual void ShowBasePosition(HC_KEY handlekey, HPoint &bp)
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.
-
virtual void GetConstraintParameters(HC_KEY handlekey)
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
-
void 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.
-
virtual float CalculatePlaneZ(HC_KEY handlekey, HPoint point)
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.
-
virtual void AdjustPositionToRay(HC_KEY handlekey, HPoint &C, HPoint A, HPoint B)
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.
-
virtual void CalculatePositionOnPlane(HC_KEY handlekey, HPoint &p, float a, float b, float c, float d)
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.
-
void 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.
-
virtual void AdjustPositionToPlane(HC_KEY handlekey, HPoint &p, float a, float b, float c, float d, HC_KEY camerakey)
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
-
virtual void CalculateTransformedPosition(HC_KEY handlekey, HPoint &t, HBaseView *view)
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.
-
inline HConstrainType GetConstraintType(HC_KEY handlekey)
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.
-
virtual void ShowHandle(HC_KEY handlekey, float sf = 0.7f, HBaseView *view = 0)
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.
-
virtual void ResetHandle(HC_KEY handlekey, float scale = 0.5f, HBaseView *view = 0)
This method shows the given handle with default values.
- Parameters
handlekey – The key to the handle segment.
scale – The scale factor for the handle.
-
virtual void Scale(HC_KEY handlekey, float scalex, float scaley, float scalez)
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.
-
virtual void TurnOff(HC_KEY handlekey)
This method delete the geometry associated with the handle.
- Parameters
handlekey – The key to the handle segment.
Public Static Functions
-
static void RegisterCallbacks()
Registers various callbacks needed for this class.
-
static HC_KEY IsGeomHandle(HC_KEY key)
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.
-
static bool ContainsGeomHandles(HC_KEY key)
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.
-
static void ClearAllHandles(HBaseView *view)
This method delete all the handles from the current HBaseView.
- Parameters
view – A pointer to the view object.
-
static HC_KEY SelectHandle(HBaseView *view, HPoint pos)
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.
-
static HC_KEY SelectObject(HBaseView *view, HPoint pos, HC_KEY oldkey, bool exclude, float proximity = 0.3)
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.
-
static void SetupObject(HC_KEY key, HBaseView *view, float boxzoom = 1.0f)
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.
-
static void SetupTextObject(HC_KEY key, HBaseView *view, float boxzoom = 1.0f, float scale = 1.0f)
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.
-
static void SetupCuttingPlane(HC_KEY key, HBaseView *view)
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.
-
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)
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.
-
static void SetupCuttingPlaneManipulator(HC_KEY startkey, HBaseView *view, HPoint *midpoint = 0, bool omit_rotate = false)
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.
-
static HC_KEY GetMMSegment(HC_KEY handlekey)
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.
-
static void GetCenterPoint(HC_KEY objectkey, HPoint ¢erpoint)
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.
-
static void SetVisibilityForAll(HC_KEY startkey, char const *visibility)
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.
-
inline virtual ~HUtilityGeomHandle()