# HUtility

## Types

| `[anonymous]`
| `[anonymous]`

## Fields

| `X`
| `Y`
| `Z`
| `W`
| `XY`
| `XZ`
| `YZ`
const float | `PI`
const float | `EH_Epsilon`

## Functions

void | `Order`
void | `Find_Relative_Path`
float | `GetTime`
void | `ClampPointToWindow`
HC_KEY | `InsertBox`
HC_KEY | `InsertWireframeBox`
void | `GenerateCuboidPoints`
HC_KEY | `InsertRectangle`
void | `InsertArrow`
void | `ComputeDoublePrecisionCrossProduct`
double | `ComputeDoublePrecisionDotProduct`
double | `ComputeDoublePrecisionVectorLength`
void | `GetViewplaneVectors`
void | `NormalizeDoublePrecisionVector`
bool | `PointsEqual`
bool | `CreateAxisCircle`
void | `RotateToVector`
void | `SmoothTransition`
void | `SmoothTransition`
bool | `CamerasEqual`
void | `ComputeVectorToVectorRotationMatrix`
bool | `ExtractRGB`
void | `TransitionQuaternion`
void | `MatrixToQuaternion`
void | `QuaternionToMatrix`
void | `SmoothQuaternionTransition`
void | `SmoothMatrixTransition`
void | `MultiSmoothTransitions`
HPoint | `GetCentroid`
HPoint | `GetTransformedCentroid`
void | `URIencode`
void | `URIdecode`
void | `GetCameraFromMatrix`
void | `GetMatrixFromCamera`
void | `GetCameraFromGLFrustum`
bool | `PushAttribute`
void | `PushAttribute`
bool | `PopAttribute`
bool | `ModifyPushedAttribute`
bool | `ShowPushedAttribute`
void | `Recursive_Merge_Shells`
HC_KEY | `Merge_Shells`
HC_KEY | `Merge_Shells_Generate_Regions`
void | `Generate_LODs`
bool | `Segment_Shell_Allocate`
void | `Shell_Search`
void | `OptimizeSegmentTree`
void | `CountShellData`
void | `FindFileNameExtension`
void | `FindFileNameExtension`
void | `FindUnicodeFileNameExtension`
void | `FindFileNameAndDirectory`
void | `FindFileNameAndDirectory`
const char * | `extra_pointer_format`
HC_KEY | `CreateScaleIndependentSegment`
HC_KEY | `GetScaleIndependentGeomSegmentKey`
void | `SetScaleIndependentGeomPosition`
void | `GetScaleIndependentGeomPosition`
void | `RegisterCallbacks`
bool | `IsModelKey`
HC_KEY | `UserOptionExists`
void | `InsertRotatedArrow`
int | `CalculateKeyPath`
bool | `SegmentExists`
void | `UnsetAttributes`
int | `IsChildOf`
bool | `IsIdentityMatrix`
void | `ComputeShellNormal`
HC_KEY | `SelectUnderCursor`
HC_KEY | `SmartSelectUnderCursor`
bool | `ShowOneHeuristic`
bool | `ShowOneRenderingOption`
float | `EaseInEaseOut`
void | `UnwindIncludes`
void | `UnwindIncludes`
bool | `SafeSetUserOption`
bool | `SafeShowUserOption`
void | `ProjectShell`
HC_KEY | `MergeShells`
void | `ShowModellingMatrix`
void | `ConvertLocalPixelsToLocalWindow`
HC_KEY | `GrabSegment`
void | `RenameSegment`
void | `InterpolateNormalAlongEdge`
void | `ShowNormals`
bool | `IsSegmentKey`
int | `FindContents`
int | `CalculateMajorAxis`
HC_KEY | `FindOneObject`
void | `CloseAllSegments`
void | `ReadjustTarget`
bool | `GetAllowAnimation`
void | `SuppressAnimation`
int | `FindFaceByIndex`
bool | `ShowOneUserOption`
HC_KEY | `GetNextRenumberedKey`
void | `NameSegments`
void | `MoveToTemp`
void | `ShowContentsWithPath`
int | `ustrlen`
bool | `RLECompress`
bool | `ZlibCompress`
bool | `ZlibDecompress`
unsigned short * | `uconvert`
bool | `BuildIncludePath`
void | `BuildIncludePathFromSelection`
void | `MakeViewSnapshot`
void | `MakeViewSnapshot`
int | `ConstrainToVector`
void | `Camera_To_Transform`
void | `LocalPixelsToWorld`
float | `ComputeAngleBetweenVector`
int | `strlen16`
void | `CalculateBoundingInfo`
long | `ClipPolygonAgainstPlane`
`HFileIOResult` | `TwoPassPrint`
HC_KEY | `OpenSegmentFromKey`
bool | `IsPointInsideAllEdges`
void | `IntersectionLinePlane`
void | `DeleteManipulators`
void | `MergePointsIntoShell`
void | `SubdivideShells`
void | `MergePolylines`
void | `CreateZebraStripeTexture`
void | `ascii_to_unicode`
void | `unicode_to_ascii`
void | `BatchRead`
void | `AdjustPositionToPlane`
void | `CalculateCornerImagePosition`
void | `OptimizeModelByGrid`
void | `DecipherTextureString`
bool | `IsSafeForSinglePrecision`
bool | `IsSafeForSinglePrecision`

## Detailed Description

class HUtility

  The HUtility class contains a set of utility functions and data structures used widely in MVO classes.

  HUtility includes utility functions for double-precision vector math, creation of construction geometry, etc…

  Subclassed by HVerticalUtility

  Public Types

  enum [anonymous]

    Values:

    enumerator X
    enumerator Y
    enumerator Z
    enumerator W
  enum [anonymous]

    Values:

    enumerator XY
    enumerator XZ
    enumerator YZ

  Public Static Functions

  static void Order(HPoint *one, HPoint *two)

    This method orders the input points in each dimension. The resulting points are minimum and maximum for bounding box input.

    Parameters

      - one – A pointer to the first point to order.

      - two – A pointer to the second point to order.

  static void Find_Relative_Path(HC_KEY from_seg_key, HC_KEY to_seg_key, char *path)

    This method returns a relative path for the from_seg_key to the to_seg_key.

    Parameters

      - from_seg_key – The key to the start segment.

      - to_seg_key – The key to the end segment.

      - path – Pass an array that will be filled with the relative path.

  static float GetTime()
    Returns

      The system time in seconds.

  static void ClampPointToWindow(HPoint *point)

    ClampPointToWindow clamps a point to its nearest corner in window space.

    Parameters

      point – A pointer to an HPoint object.

  static HC_KEY InsertBox(HPoint const *max, HPoint const *min)

    InsertBox inserts a six-sided, rectangular cuboid based on 2 points.

    Parameters

      - max – A pointer to an HPoint describing a point on the box.

      - min – A pointer to an HPoint describing a point on the opposite face diagonal from the first point.

    Returns

      The key to the newly created box.

  static HC_KEY InsertWireframeBox(HPoint *max, HPoint *min)

    InsertWireframeBox uses a polyline to insert a six-sided, rectangular cuboid wireframe based on 2 points.

    Parameters

      - max – A pointer to an HPoint describing a point on the box.

      - min – A pointer to an HPoint describing a point on the opposite face diagonal from the first point.

    Returns

      The key to the newly created box.

  static void GenerateCuboidPoints(HPoint const *max, HPoint const *min, HPoint *points)

    GenerateCuboidPoints creates the vertices of a cuboid based on two input points.

    Parameters

      - max – A pointer to the first point that describes the cuboid.

      - min – A pointer to the point the is diagonally opposite the first point.

      - points – A pointer to an array that can hold the 8 HPoints that describe the cuboid. Passed by reference.

  static HC_KEY InsertRectangle(const char *seg, float x0, float y0, float x1, float y1, float z = 0.0f, bool fill = false)

    InsertRectangle inserts a 2d rectangle as a HOOPS Polyline.

    Parameters

      - seg – The segment name into which the rectangle should be inserted.

      - x0 – X-value of vertex 1 of the rectangle.

      - y0 – Y-value of vertex 1 of the rectangle.

      - x1 – X-value of vertex 3 of the rectangle.

      - y1 – Y-value of vertex 3 of the rectangle.

      - z – The z coordinate shared by vertext 1 and 3.

      - fill – Pass true to create a filled rectangle.

    Returns

      The key to the new created rectangle.

  static void InsertArrow(float stick_length, float tip_length, float stick_radius, float arrow_radius, const char *text, const char *stick_color, const char *tip_color, int num_sides = 6, float tip_falloff = 0.05, bool reverse = true)

    InsertArrow inserts an arrow consisting of a cylinder and a cone at the origin. This function is used by the Axis display. The arrow is completely customizable.

    Parameters

      - stick_length – The length of the cylindrical shaft of the arrow.

      - tip_length – The length of the conical tip of the arrow.

      - stick_radius – The radius of the cylindrical shaft of the arrow.

      - arrow_radius – The radius of the circular base of the arrow’s conical tip.

      - text – A pointer to a string that annotates the arrow.

      - stick_color – The color of the shaft of the arrow.

      - tip_color – The color of the tip of the arrow.

      - num_sides – The number of sides of arrow. The default is 6.

      - tip_falloff – The radius reduction value on stick. The default is 0.05.

      - reverse – Pass true to reverse the orientation.

  static void ComputeDoublePrecisionCrossProduct(double *vector1, double *vector2, double *up)

    ComputeDoublePrecisionCrossProduct computes the cross product of two double precision vectors.

    Parameters

      - vector1 – A pointer to a double precision vector.

      - vector2 – A pointer to a double precision vector.

      - up – Pass a pointer to a double. This method will populate up with the result of the cross product.

  static double ComputeDoublePrecisionDotProduct(double *vector1, double *vector2)

    ComputeDoublePrecisionDotProduct computes a double precision dot product of two vectors.

    Parameters

      - vector1 – A pointer to a double precision vector.

      - vector2 – A pointer to a double precision vector.

    Returns

      The double precision dot product of the two vectors.

  static double ComputeDoublePrecisionVectorLength(double *vector1)

    ComputeDoublePrecisionVectorLength computes the length of a double precision vector.

    Parameters

      vector1 – A pointer to a double precision vector.

    Returns

      The double precision length of the vector.

  static void GetViewplaneVectors(HC_KEY segment_key, double *view, double *up)

    GetViewplaneVectors computes the construction-plane-constrained vectors used for geometry insertion.

    Parameters

      - segment_key – The key to the construction segment.

      - view – A pointer to the double precision view vector. Passed by reference.

      - up – A pointer to the double precision up vector. Passed by reference.

  static void NormalizeDoublePrecisionVector(double *vector1)

    NormalizeDoublePrecisionVector normalizes a double-precision vector in place so that its magnitude is 1.

    Parameters

      vector1 – A pointer to a double precision vector.

  static bool PointsEqual(HPoint *point1, HPoint *point2)

    PointsEqual compares the equality of two (x,y,z) points.

    Parameters

      - point1 – A pointer to the first point to compare.

      - point2 – A pointer to the second point to compare.

    Returns

      True if the points are equal or false if they aren’t.

  static bool CreateAxisCircle(HPoint const &center, float radius, int axis, bool convert = true)

    CreateAxisCircle creates a circle based on a centerpoint and a radius. The centerpoint is assumed to be in viewpoint space. Note this function actually inserts a circle into the HOOPS scene using the HOOPS routine HC_Insert_Circle, whereas HUtilityGeometryCreation::GeneratePointsOnCircle only generates an array of points along a circular trajectory.

    Parameters

      - center – The center of the desired circle.

      - radius – The length of the radius of the circle.

      - axis – XY, XZ, or YZ. This defines the view plane in which the circle will be drawn.

      - convert – Pass true to convert to viewpoint space.

    Returns

      True if the operation was a success or false if it failed.

  static void RotateToVector(HPoint start, HPoint end, bool doTranslation = true)

    This method rotates the contents of the currently opened segment to a given vector in space.

    Parameters

      - start – The first point in space that defines vector.

      - end – The second point in space that defines vector.

      - doTranslation – Pass to perform translation in the segment via #HC_Translate_Object.

  static void SmoothTransition(const HPoint &co, const HPoint &to, const HPoint &uo, float fieldwidtho, float fieldheighto, const HPoint &cn, const HPoint &tn, const HPoint &un, float fieldwidthn, float fieldheightn, HBaseView *view)

    SmoothTransition takes two camera definitions and uses quaternions to smoothly move the camera on the HBaseView object from the first camera position to the next.

    Parameters

      - co – The initial camera position.

      - to – The initial camera target.

      - uo – The initial camera up vector.

      - fieldwidtho – The initial camera field width.

      - fieldheighto – The initial camera field heigth.

      - cn – The final camera position.

      - tn – The final camera target.

      - un – The final camera up vector.

      - fieldwidthn – The final camera field width.

      - fieldheightn – The final camera field heigth.

      - view – A pointer to the HBaseView object you want the camera movements to be applied.

  static void SmoothTransition(HCamera old_camera, const HCamera &new_camera, HBaseView *view)

    SmoothTransition takes two camera definitions and uses quaternions to smoothly move the camera on the HBaseView object from the first camera position to the next.

    Parameters

      - old_camera – The initial camera definition.

      - new_camera – The final camera definition.

      - view – A pointer to the HBaseView object you want the camera movements to be applied.

  static bool CamerasEqual(const HCamera &camera1, const HCamera &camera2)

    The CamerasEqual method tests two camera definitions for equality.

    Parameters

      - camera1 – The first camera definition.

      - camera2 – The second camera definition.

    Returns

      True if the cameras have the same definition or false if they don’t.

  static void ComputeVectorToVectorRotationMatrix(float matrix[], HPoint v1, HPoint v2)

    This method computes a rotation matrix that rotates between the two supplied vectors.

    Parameters

      - matrix – Pass an array that can hold a 4 x 4 matrix. This method will populate the matrix with the values for the rotation matrix.

      - v1 – The vector to rotate from.

      - v2 – The vector to rotate to.

  static bool ExtractRGB(char *text, float &r, float &g, float &b)

    This method parses the input string with the format “R=0.23, G=0.34, B=0.12” for the red, green and blue color values.

    Parameters

      - text – A pointer to null terminated char array with color information.

      - r – Returns the red color component.

      - g – Returns the green color component.

      - b – Returns the blue color component.

    Returns

      True if the operation was successful or false if it failed.

  static void TransitionQuaternion(float quat_old[], float quat_new[], float t, float qt[])

    TransitionQuaternion takes a start and end quaternion which represent two orientations in cartesian space. Based on a value t between 0 and 1, it comes up with a third quaternion vector that represents an orientation in cartesian space which is along the shortest, smooth path between the two initial orientations.

    Parameters

      - quat_old – An array of 4 by 1 floats representing the starting orientation in quaterion space.

      - quat_new – An array of 4 by 1 floats representing the final orientation in quaterion space.

      - t – A floating point value between 0 and 1 indicating the amount you want the returned quaternion to be along the interpolated path.

      - qt – A pointer which contains the 4 by 1 vector of the floating point values representing the transition quaternion. This value is returned to the user.

  static void MatrixToQuaternion(float matrix[], float quaternion[])

    MatrixToQuaternion converts a 4 by 4 matrix to it’s equivalent 4 by 1 vector in quaternion space.

    Parameters

      - matrix – A pointer to a 4 by 4 matrix of floating point values which typically represent a camera projection.

      - quaternion – A pointer which contains the 4 by 1 vector of floating point values representing the matrix in quaternion space. This value is returned to the user.

  static void QuaternionToMatrix(float quaternion[], float matrix[])

    QuaternionToMatrix converts an 4 by 1 array of floating point values to its equivalent 4 by 4 matrix in cartesian space.

    Parameters

      - quaternion – A pointer which contains the 4 by 1 vector of floating point values representing the matrix in quaternion space.

      - matrix – A pointer to a 4 by 4 matrix of floating point values which typically represent a camera projection. This value is returned to the user.

  static void SmoothQuaternionTransition(HBaseView *m_pView, char *old_seg, char *new_seg, int num_of_transitions)

    This method animates the rotation of an object from the object space of one segment to the object space of another. It uses quaternions to make the transition appear smooth.

    Parameters

      - m_pView – A pointer to the HBaseView object.

      - old_seg – The segment from which the transition should occur.

      - new_seg – The segment which has the modelling matrix which we want to transition to.

      - num_of_transitions – The numer of frames in the animation.

  static void SmoothMatrixTransition(HBaseView *m_pView, HC_KEY seg_key, float new_matrix[])

    This method transitions an object to the target modelling matrix. It uses quaternions to make the transition appear smooth.

    Parameters

      - m_pView – A pointer to the HBaseView object.

      - seg_key – The key of the segment to which the matrix should be applied.

      - new_matrix – The matrix to apply to the segment.

  static void MultiSmoothTransitions(HBaseView *m_pView, int num_keys, HC_KEY *seg_key, float new_matrix[], HCamera *new_camera = 0)

    This method transitions multiple segments to multiple target modelling matrices. It uses quaternions to make the transition appear smooth.

    Parameters

      - m_pView – A pointer to the HBaseView object.

      - num_keys – The number of segments in seg_key.

      - seg_key – A pointer to the array of segments to which the matrices should be applied.

      - new_matrix – A pointer to an array of matrices to apply to the given segments.

      - new_camera – If non-null, then the method will also smoothly transition the camera to this new camera.

  static HPoint GetCentroid(HC_KEY seg_key)

    This method returns the centroid of a segment in world space.

    Parameters

      seg_key – The segment to get centroid from.

    Returns

      The coordinate of the centroid.

  static HPoint GetTransformedCentroid(HC_KEY seg_key, float matrix[] = 0)

    This method returns the centroid of a segment, transformed by a given matrix.

    Parameters

      - seg_key – The segment to get centroid from.

      - matrix – The transformation to apply to the centroid.

    Returns

      The coordinate of the centroid.

  static void URIencode(const char *in_string, unsigned long n, char *out_buffer)

    This function takes an char buffer and create a URI encoded string.

    Parameters

      - in_string – A unencoded string.

      - n – The length of the in buffer.

      - out_buffer – A write back buffer of size 3*n+1.

  static void URIdecode(const char *in_string, char *out_buffer, unsigned long *n)

    This function decodes a URI encoded string.

    Parameters

      - in_string – A null terminated encoded string.

      - out_buffer – A write back buffer of size strlen(in)+1 after call this contains unencoded string.

      - n – A write back value with the length of the out_buffer.

  static void GetCameraFromMatrix(float matrix[], HPoint *target, HPoint *position, HPoint *up_vector, HPoint *translation)

    This method extracts the camera attributes from the input transformation matrix.

    Parameters

      - matrix – A pointer to the transformation matrix.

      - target – A pointer to HPoint object representing the camera target.

      - position – A pointer to HPoint object representing the camera position which this method will populate.

      - up_vector – A pointer to HPoint object representing the view-up vector which this method will populate.

      - translation – A pointer to HPoint object representing the translation which this method will populate.

  static void GetMatrixFromCamera(HPoint target, HPoint position, HPoint up_vector, HPoint translation, float matrix[])

    This method composes a transformation martix from the given camera attributes.

    Parameters

      - target – A pointer to HPoint object representing camera target.

      - position – A pointer to HPoint object representing camera position.

      - up_vector – A pointer to HPoint object representing view-up vector.

      - translation – A pointer to HPoint object representing translation.

      - *matrix – Resultant transformation matrix. Pass a pointer to an array that can accomodate a 4 x 4 matrix.

  static void GetCameraFromGLFrustum(double const left, double const right, double const bottom, double const top, double const near_z, double const far_z, bool const perspective, HPoint &pos, HPoint &target, HPoint &up, char *projection, double &width, double &height, double &near_limit)

    This method returns a set of HOOPS camera values and a HOOPS camera near-plane value based on a glFrustum or glOrtho definition. The resulting HOOPS camera values should be set within #HC_Set_Camera, AND the resulting near-plane should be set by #HC_Set_Camera_Near_Limit.

    Assumptions regarding the glFrustum values:

    right > left

    top > bottom

    far > near, and for perspective both should be positive.

    Parameters

      - left – The same parameter used by the glFrustum or glOrtho calls.

      - right – The same parameter used by the glFrustum or glOrtho calls.

      - bottom – The same parameter used by the glFrustum or glOrtho calls.

      - top – The same parameter used by the glFrustum or glOrtho calls.

      - near_z – The same parameter used by the glFrustum or glOrtho calls.

      - far_z – The same parameter used by the glFrustum or glOrtho calls.

      - perspective – If set to true, then a perspective frustrum (set via glFrustum) is assumed. If false, then an orthographic frustum (set via glOrtho) is assumed.

      - pos – The HOOPS camera position which is passed by reference and returned to the user.

      - target – The HOOPS camera target which is passed by reference and returned to the user.

      - up – The HOOPS camera up vector which is passed by reference and returned to the user.

      - projection – The HOOPS camera projection which is passed by reference and returned to user. The caller should pass in a char array of 64 characters. This is returned because the HOOPS camera projection might not be a simple choice between ‘perspective’ or ‘orthographic’ and thus won’t match what was passed in via the ‘perspective’ boolean. For example, the result HOOPS projection could be ‘oblique perspective’ based on the glFrustum values.

      - width – The HOOPS camera field width which passed by reference and returned to the user.

      - height – The HOOPS camera field height which passed by reference and returned to the user.

      - near_limit – The HOOPS camera near limit which passed by reference and returned to the user. This value represents the location of the HOOPS camera’s near clip plane.

  static bool PushAttribute(const char *attName)

    This method stores a local attribute as a user option in the currently open segment for later retrieval. This is useful for processes like highlighting and selection.

    Parameters

      attName – name of the attribute that needs to be stored. The currently supported attribute names are color, visibility, rendering options and edge weight.

    Returns

      True if the local attribute exist or false if it doesn’t.

  static void PushAttribute(const char *attName, const char *attText)

    This method stores a local attribute as a user option in the currently open segment for later retrieval. This function takes the attribute as a string instead of getting it from the segment directly This is useful for processes like highlighting and selection.

    Parameters

      - attName – name of the attribute that needs to be stored. The currently supported attribute names are color, visibility, rendering options and edge weight.

      - attText – The attribute definition (e.g. “faces = red, edges = blue”).

  static bool PopAttribute(const char *attName)

    This method replaces the requested attribute in the currently open segment with the stored attribute found in user options. The stored user option associated with that attribute will be deleted.

    Parameters

      attName – The name of the attribute that needs to be stored. The currently supported attribute names are color, visibility, rendering options and edge weight.

    Returns

      True if the stored attribute exists or false if it doesn’t.

  static bool ModifyPushedAttribute(const char *attName, const char *newStyle)

    This method modifies the stored attribute in the currently open segment.

    Example:

    The stored attribute is “faces = red”.

    The newStyle is “lines = yellow”.

    The result is “faces = red, lines = yellow”.
    Parameters

      - attName – The name of the stored attribute that needs to be modified.

      - newStyle – The modification string.

    Returns

      True if the stored attribute exists.

  static bool ShowPushedAttribute(const char *attName, HUserOptions &attText)

    This method retrieves the stored attribute in the currently open segment if present.

    Parameters

      - attName – The name of the stored attribute that needs to be retrieved.

      - attText – This method returns the attribute string.

    Returns

      True if the stored attribute exists or false if it doesn’t exist.

  static void Recursive_Merge_Shells(HShell *total_info, HShell *max_info, bool do_recurse, bool delete_orig_shells = false, bool insert_null_lods = false)

    This method steps through the child segments, and merges all of the shells into one. Note that this method assumes that the proper amount of memory has been allocated. You can use Segment_Shell_Allocate to allocate the correct amount of memory.

    Parameters

      - total_info – A pointer to where the newly merged shell.

      - max_info – A pointer to the largest shell data.

      - do_recurse – Pass true to recurse through the segment tree beneath or false to only merge shells in the currently open segment.

      - delete_orig_shells – Pass true to delete original shells that have been merged or false to keep them.

      - insert_null_lods – Pass true to insert placeholder LODs.

  static HC_KEY Merge_Shells(bool do_recurse, bool delete_orig_shells = false, bool optimize_shell = true, bool generate_regions = false)

    This method extracts all of the shells from the currently open segment and its children, and merges them into one.

    Parameters

      - do_recurse – A boolean value indicating if the children segments should also be searched for shells.

      - delete_orig_shells – Pass true if you want the original shells to be deleted after the merge.

    Returns

      The key to the newly merged shell.

  static HC_KEY Merge_Shells_Generate_Regions(int num_shells, HC_KEY *shell_keys, bool delete_orig_shells = false)

    This method merges the given shells into a single shell. The original shells are marked as regions in the merged shell.

    Parameters

      - num_shells – The number of elements in the shell_keys array.

      - shell_keys – The HOOPS keys of the shells to be merged.

      - delete_orig_shells – Pass true if you want the original shells to be deleted after the merge.

    Returns

      The key to the newly merged shell.

  static void Generate_LODs(bool do_recurse = true, bool delete_orig_shells = false, bool insert_null_lods = false, int n_lod_levels = 2, float reduction_ratio = 0.20)

    This function merges all the shells in the segement and generates LODs for the merged shell. These LODs are then attached to one of the shells in the segment.

    Parameters

      - do_recurse – Pass true to recursively searched for shells.

      - delete_orig_shells – Pass true to erase the original shells once they have been merged into a new shell.

      - insert_null_lods – Pass true to attach null shells as LOD geometry for all the shells except one.

      - n_lod_levels – The number of lod levels to be generated.

      - reduction_ratio – The ratio of the number of triangles in an LOD vs. the number of triangles in the previous LOD.

  static bool Segment_Shell_Allocate(HShell *total_info, HShell *max_info, bool do_recurse)

    This method allocates memory for merging the shells contained below the segment open in the current segment tree for use in method like Recursive_Merge_Shells.

    Parameters

      - total_info – Pass a pointer in which this method can allocate memory large enough to hold all the shell data.

      - max_info – Pass a pointer in which this method will allocate memory large enough to hold the largest shell data.

      - do_recurse – Pass true if you want the segment to be recursively searched for shells and allocated memory for.

  static void Shell_Search(HShell *total_info, HShell *max_info, bool do_recurse)

    This method is a helper function to Segment_Shell_Allocate. It finds how much memory is necessary for the current and child segments shells.

    Parameters

      - total_info – A pointer to the HShell that should be big enough to hold all the data for all of the shells put together.

      - max_info – A pointer to the HShell that should be big enough for the largest shell.

      - do_recurse – Pass true for the segment to be recursively searched for shells.

  static void OptimizeSegmentTree(HC_KEY old_seg_key, HC_KEY *new_seg_key, bool transform_shells = true, bool merge_shells = true, bool create_shell_regions = false)

    This is currently an INTERNAL USE function that is in development. Walks down the tree starting with ‘new_seg_key’, and builds a new tree underneath a new segment identified by ‘new_seg_key’. The ‘old_seg_key’ contents are flushed. The logic groups graphical primtives into segments based on attributes, and transforms primitives and merges shells depending on the passed-in parameters.

    Parameters

      - old_seg_key – HOOPS key of the segment tree to be optimized

      - new_seg_key – HOOPS key of the top of the new segment tree; this is a subsegment of the ‘old_seg_key’. Passed by reference, returned to user.

      - transform_shells – A boolean value indicating that shell points should be xformed through any local modeling matrix

      - merge_shells – A boolean value indicating that shells in each of the final segments should be merged into a single shell

      - create_shell_regions – A boolean value indicating that if original shells were merged, to mark them as regions in the final shell

  static void CountShellData(HC_KEY shell_key, int *faces, int *vertices, int *triangles, int *tristrips = 0)

    This method counts the number of faces, vertices and triangles in a given shell primitive.

    Parameters

      - shell_key – The HOOPS key to a given shell.

      - faces – Returns the number of faces in the given shell. Passed by reference.

      - vertices – Returns the number of vertices in the shell, including duplicates. Passed by reference

      - triangles – Returns the number of triangles in the shell after HOOPS triangulation calculation. Passed by reference.

      - tristrips – Returns the number of tristrips in the shell. Pass by reference.

  static void FindFileNameExtension(const char *filename_in, char *ext_out, int size = -1)

    Given a file name, this method returns the file extention. The extentions is returned in lowercase only.

    Parameters

      - filename_in – A null terminated string holding a filename.

      - ext_out – Pass a char pointer of size > strlen(filename_int)+1. This method will return the file extension.

  static void FindFileNameExtension(__wchar_t const *const filename_in, __wchar_t *ext_out, int size = -1)

    Given a file name, this method returns the file extention. The extentions is returned in lowercase only.

    Parameters

      - filename_in – A null terminated string holding a filename.

      - ext_out – Pass a char pointer of size > strlen(filename_int)+1. This method will return the file extension.

  static void FindUnicodeFileNameExtension(const unsigned short *filename_in, char *ext_out)

    Given a unicode file name, this method returns the file extention. The extentions is returned in lowercase only.

    Parameters

      - filename_in – A null terminated UNICODE string holding a filename.

      - ext_out – Pass a char pointer of size > strlen(filename_int)+1. This method will return the file extension.

  static void FindFileNameAndDirectory(const char *filename_in, char *dir_out, char *filename_out)

        Given a filename with path, this method returns the filename and directory.

        \param filename_in A null terminated string holding a filename.
        \param dir_out Pass a char pointer of size > strlen(filename_int)+1.  The method returns the directory part of the

    filename.
    Parameters

      filename_out – Pass a char pointer of size > strlen(filename_int)+1. The method returns the short filename part of the filename.

  static void FindFileNameAndDirectory(__wchar_t const *filename_in, __wchar_t *dir_out, __wchar_t *filename_out)

        Given a filename with path, this method returns the filename and directory.

        \param filename_in A null terminated string holding a filename.
        \param dir_out Pass a char pointer of size > strlen(filename_int)+1.  The method returns the directory part of the

    filename.
    Parameters

      filename_out – Pass a char pointer of size > strlen(filename_int)+1. The method returns the short filename part of the filename.

  static const char *extra_pointer_format()

    HOOPS likes window handles and colormaps to be printed as hex value with the form 0xXXXXXXXX but some systems sprintf functions print pointer with out the 0x part.

    So use sprintf(buffer,”%s%p”,extra_pointer_format(),pointer) to ensure correct formating for HOOPS.

    Returns

      A system dependent pointer printing extention either “” or “0x”.

  static HC_KEY CreateScaleIndependentSegment(const char *segname, bool SetCallback = true)

    This method is for internal use only.

  static HC_KEY GetScaleIndependentGeomSegmentKey(HC_KEY segkey)

    This is for internal use only.

  static void SetScaleIndependentGeomPosition(HC_KEY segkey, float x, float y, float z)

    This is for internal use only.

  static void GetScaleIndependentGeomPosition(HC_KEY segkey, float &x, float &y, float &z)

    This is for internal use only.

  static void RegisterCallbacks()

    This method register callbacks for HUtility with the HImManager.

  static bool IsModelKey(HC_KEY modelkey, HC_KEY objectkey)

    This method determines if the given key is underneath the model segment.

    Parameters

      - modelkey – They key to the model segment.

      - objectkey – The key to test.

    Returns

      True if the key is underneath the model segment or false if otherwise.

  static HC_KEY UserOptionExists(HC_KEY key, const char *attrib, char *result)

    This method determine if user options exists in or above the current segment.

    Parameters

      - key – The segment to begin the search.

      - attrib – The attribute to search for.

      - result – The attribute value of user option if it exists.

    Returns

      The highest segment where the user option was set or INVALID_KEY if no option existed.

  static void InsertRotatedArrow(float stick_length, float tip_length, float stick_radius, float tip_radius, float distance, int adelta, float rotang, const char *stick_color, const char *tip_color, int num_sides, float tip_falloff, bool reverse)

    Inserts a circular arrow consisting of a cylinder and a cone display. The arrow is completely customizable.

    Parameters

      - stick_length – The length of the cylindrical shaft of the arrow.

      - tip_length – The length of the conical tip of the arrow.

      - stick_radius – The radius of the cylindrical shaft of the arrow.

      - tip_radius – The radius of the circular base of the arrow’s conical tip.

      - distance – The x coordinate position of the center of the shaft.

      - adelta – The number of angular steps.

      - rotang – The angular interval. Multily this value by adelta to get maximum arrow radius.

      - stick_color – The color of the shaft of the arrow.

      - tip_color – The color of the tip of the arrow.

      - num_sides – The number of sides of the arrow. The default is six.

      - tip_falloff – The radius reduction value on the stick. The default is 0.05.

      - reverse – Pass true to invert the arrow’s orientation.

  static int CalculateKeyPath(HC_KEY startkey, HBaseView *view, HC_KEY *keyarray, int maxarray)

    This function returns a list of keys from the current segment to the top level scene segment.

    Parameters

      - startkey – The segment to start the keylist from.

      - view – A pointer to the current HBaseView object.

      - keyarray – Pass a pointer to an array that will hold the keylist. This method wil populate the array.

      - maxarray – The maximum size of array to calculate.

    Returns

      The size of the final keylist.

  static bool SegmentExists(const char *segment)

    This method determines if the segment with given name exists underneath the currently open segment.

    Parameters

      segment – The name of the segment to test existence for.

    Returns

      True if the segment does exist underneath the currently open segment or false if it doesn’t.

  static void UnsetAttributes()

    The method unsets various attributes in current segment. Currently, it unsets visibility, heuristics, and rendering options.

  static int IsChildOf(HC_KEY owner, HC_KEY child, HC_KEY klist[] = 0)

    This method determines if a given segment is a child of the given owner segment.

    Parameters

      - owner – The key of the owner segment.

      - child – The key of the potential child segment.

      - klist – A pointer to a list of keys. If non-null, the list of keys of segments between the child and owner will get written to the list.

    Returns

      True if the child segment is indeed a child of the owner segment.

  static bool IsIdentityMatrix(float matrix[])

    This function returns true if the matrix passed in is an identity matrix and false otherwise.

    Parameters

      matrix – the matrix to be queried.

    Returns

      True if matrix is an identity, false otherwise.

  static void ComputeShellNormal(HC_KEY skey, HPoint &tnormal)

    The method determines an appropriate normal vector for the given shell. For closed objects, the normal can be somewhat random. This is used for Zoom to Shell like functionality.

    Parameters

      - skey – The key to the shell you want a normal for.

      - tnormal – A pointer to an HPoint object. The method will populate this parameter with the calculated normal vector.

  static HC_KEY SelectUnderCursor(HBaseView *view, float x, float y, bool doSelection = true, bool DeSelect = false)

    Deprecated. Please use SmartSelectUnderCursor. Puts item under cursor in selection list.

    Parameters

      - view – Pointer to HBaseView Object.

      - x – Window X Coordinate for selection testing

      - y – Window Y Coordinate for selection testing

      - doSelection – Add Geometry to Selection List

      - DeSelect – De Select Geometry if already selected

    Returns

      Key to selected geometry

  static HC_KEY SmartSelectUnderCursor(HBaseView *view, float x, float y, bool doSelection = true, bool DeSelect = false)

    This method puts the item under cursor in the selection list. This api uses improved selection capability which helps the selection set deal with instanced segments and entities.

    Parameters

      - view – A pointer to HBaseView Object.

      - x – The window x coordinate for the selection testing.

      - y – Window Y Coordinate for selection testing.

      - doSelection – Add Geometry to Selection List.

      - DeSelect – Pass true to deselect the geometry if it already selected.

    Returns

      The key to the selected geometry.

  static bool ShowOneHeuristic(const char *type, char *res = 0)

    This method shows the specificed heuristic setting in the currently open segment.

    Parameters

      - type – The heuristic Setting to query (e.g. “quick moves”).

      - res – The result of query (e.g. “spriting”).

    Returns

      True if the heuristic setting is set or false if it is not set.

  static bool ShowOneRenderingOption(const char *type, char *res = 0)

    This method shows the specified rendering option setting in the currently open segment.

    Parameters

      - type – The rendering option setting to query (e.g. “lighting interpolation”).

      - res – The result of the query (e.g. “phong”)

    Returns

      True if the rendering option setting is set or false if it is not set.

  static float EaseInEaseOut(float t, float a, float b, float c)

    This method calculates the EaseIn/EaseOut for a given interval and speed. This ensure that animations have a smooth transition at the beginning and end.

    Parameters

      - t – The current interval which is from 0 to 1.

      - a – The ease in duration given a normalized interval.

      - b – The constant speed duration.

      - c – The ease out duration given a normalized interval.

    Returns

      The newly recalculated interval.

  static void UnwindIncludes(HC_KEY &key)

    From the current selection, this method walks up the segment tree until all includes are resolved.

    Parameters

      key – Segment to unwind from.

  static void UnwindIncludes(HC_KEY &newkey, HC_KEY *keys, int count)

    This method is a helper function for UnwindIncludes(HC_KEY &key).

    Parameters

      - newkey – The key to unwind from.

      - keys – The list of keys in the selection list.

      - count – The number of keys in the selection list.

  static bool SafeSetUserOption(const char *opt)

    This method acts as a wrapper around HC_Set_User_Options and protects and validates input to it. It acts on the currently open segment.

    Parameters

      opt – The user option to be input.

    Returns

      true if the option was set successfully, false otherwise.

  static bool SafeShowUserOption(char *opt)

    This method acts as a wrapper around HC_Show_User_Options and strips out extra characters inserted by SafeSetUserOption. It acts on the currently open segment.

    Parameters

      opt – The user option (if any). Returned to user.

    Returns

      true if a user option was found, false otherwise.

  static void ProjectShell(HC_KEY shellkey)

    This method projects the given shell to the net modelling matrix of the current segment.

    Parameters

      shellkey – The key to the shell.

  static HC_KEY MergeShells(HC_KEY shell1, HC_KEY shell2)

    This method merges two shells into one.

    Parameters

      - shell1 – The key to the first shell.

      - shell2 – The key to the secon shell.

    Returns

      The key of the newly merged shell.

  static void ShowModellingMatrix(float *segment_modelling_matrix)

    This method returns the modelling matrix of the currently open segment or identity matrix in none exists.

    Parameters

      segment_modelling_matrix – Pass a pointer to an array that can hold a 4 x 4 matrix. The method will populate it with the values of the currently opened segment’s modelling matrix.

  static void ConvertLocalPixelsToLocalWindow(HBaseView *view, HPoint *in_system, HPoint *out_system = 0)

    This method converts a point from local pixels space to local window space.

    Parameters

      - view – A pointer to the HBaseView Object.

      - in_system – The coordinates in Local Pixels. The method will do an in place conversion if you pass null for out_system.

      - out_system – Pass a pointer an HPoint distinct from in_system if you do not want an in place conversion. If you do, pass null.

  static HC_KEY GrabSegment(HC_KEY key)

    This method returns the key of the input object’s owner. If the input is itself a segment key, it is returned as is.

    Parameters

      key – The object key which can be segment or geometry.

    Returns

      The owner segment key.

  static void RenameSegment(HC_KEY segkey, const char *newname)

    This method renames a segment given by the key.

    Parameters

      - segkey – The key to the segment you want to rename.

      - newname – The new name of the segment.

  static void InterpolateNormalAlongEdge(HPoint &p1, HPoint &n1, HPoint &p2, HPoint &n2, HPoint &p3, HPoint &n3)

    Given two points and the normals at those points, this method calculates the interpolated normals given an additional third point.

    Parameters

      - p1 – The first point used for interpolation.

      - n1 – The first normal used for interpolation.

      - p2 – The second point used for interpolation.

      - n2 – The second normal used for interpolation.

      - p3 – The third point used for interpolation,

      - n3 – Returns the calculated normal.

  static void ShowNormals(HC_KEY shellkey, float normallength)

    This method renders the normals of a given shell as lines.

    Parameters

      - shellkey – The key of the shell to show the normals for.

      - normallength – The length of the lines that will be rendered to represent the normals.

  static bool IsSegmentKey(HC_KEY key)

    This method determines if the given key belongs to a segment.

    Parameters

      key – The key to identify.

    Returns

      True if the key is a segment key or false if it is not.

  static int FindContents(HC_KEY &key, bool original = false)

    This method is a wrapper for #HC_Find_Contents. Note you must call HC_Begin_Contents_Search before this call and #HC_End_Contents_Search after this call.

    Parameters

      - key – The key to identify.

      - original – Indicates whether the original key of the item is desired. Default is the current (possibly Renumbered) key.

    Returns

      True if items were found.

  static int CalculateMajorAxis(HBaseView *view)

    This method calculates the major axis of the current camera.

    Parameters

      view – A pointer to the HBaseView object.

    Returns

      The value 0 if the major axis is X or the value 1 if the major axis is Y or the value 2 if the major axis is Z.

  static HC_KEY FindOneObject(const char *type, bool l = 0)

    This method find a objects of given type in the current segment or globally.

    Parameters

      - type – HOOPS entity type like segment, shell, etc.

      - l – Pass true to search local or false to search globally.

    Returns

      The key to the matching HOOPS entity or INVALID_KEY if no object was found.

  static void CloseAllSegments(HC_KEY endkey = (-1L))

    This method closes the current segment and then walks up the database tree closing the any segments that are open until it reaches the top level segment or the end key if one is passed.

    Parameters

      endkey – Pass a key that will end the method.

  static void ReadjustTarget(HBaseView *view)

    This method resets the camera target to be in the center of the current view.

    Parameters

      view – A pointer to the HBaseView Object.

  static bool GetAllowAnimation(HC_KEY key)

    This method returns whether the user option to suppress animation is set for a given segment.

    Parameters

      key – The key of the segment in which you want to check the suppress animation option.

    Returns

      True if the suppress animation option was set or false if it wasn’t.

  static void SuppressAnimation()

    This method sets the user option to suppress animation for the currently opened segment.

  static int FindFaceByIndex(int findex, int *flist, int flen)

    Given Face Index (0,1,2…), this method finds position of face in face list array as described in #HC_Insert_Shell.

    Parameters

      - findex – The face index.

      - flist – The face list array.

      - flen – The length of face list array.

    Returns

      Position of the face in the face list array.

  static bool ShowOneUserOption(const char *option, char *res)

    This method shows the specified user option in the currently opened segment.

    Parameters

      - option – The user option to search for.

      - res – The result of the query.

    Returns

      True if the user option setting is set or false if it is not set.

  static HC_KEY GetNextRenumberedKey(HBaseView *view)

    This method finds the next unused globally renumbered key.

    Parameters

      view – A pointer to the HBaseView object.

    Returns

      The next available renumbered key.

  static void NameSegments(HC_KEY &key, HBaseView *view)

    This method gives unique names to the passed segment and all its parents.

    Parameters

      - key – The key to the start segment.

      - view – A pointer to the HBaseView object.

  static void MoveToTemp(HC_KEY movekey, HC_KEY tempkey)

    This method moves a given segment to a temporary segment.

    Parameters

      - movekey – The segment you want to move.

      - tempkey – The temporary segment to move to.

  static void ShowContentsWithPath(const char *entitytypes, struct vlist_s **ret_pathlist, bool storePath = false, bool includeIncludes = true, bool filterIncludes = true)

    This method recursively finds all entities in and below the current segment and returns each entity with its complete segment path.

    Parameters

      - entitytypes – The entities to search for.

      - ret_pathlist – Pass a pointer to a vlist. This method will populate it with all found entities. Each list element is a pointer to a HShowContentsWithPathType structure and needs to be freed by the caller.

      - storePath – Pass true if you want to the method to store the complete path in addition to entity key.

      - includeIncludes – Pass true to search included segments.

      - filterIncludes – Pass true to filter include keys from the list.

  static int ustrlen(unsigned short *text)

    This method returns the size of the unicode string.

    Parameters

      text – The unicode text string.

    Returns

      Size of the string excluding the delimiter.

  static bool RLECompress(int const in_len, unsigned char const *const in_buf, int *out_len, unsigned char *const out_buf)

    This method compresses the given data using RLE, run length encoding.

    Parameters

      - in_len – The length of the input buffer.

      - in_buf – A pointer to the data to be compressed.

      - out_len – Pass the length of the output buffer. When this method returns, it will populate the out_len with the value of the lenght of the compressed data.

      - out_buf – Pass a pointer so that this method can return where the output data is to be stored. This can be the same as in_buf if you want to do an in place compresion..

    Returns

      True if the operation is was success or false if it failed.

  static bool ZlibCompress(int const in_len, unsigned char const *const in_buf, int &out_len, unsigned char *const out_buf)

    This method compresses the input buffer using the ‘zlib’ compression library.

    Parameters

      - in_len – The length of the input buffer.

      - in_buf – The data to be compressed.

      - out_len – Pass the length of the output buffer. On return, out_len is the length of the compressed data.

      - out_buf – The output data is stored here. To do an in place compression, you can pass the same pointer as in_buf.

    Returns

      True if the operation was a success or false if it failed.

  static bool ZlibDecompress(int const in_len, unsigned char const *const in_buf, int &out_len, unsigned char *const out_buf)

    This method decompresses the input buffer using the ‘zlib’ compression library.

    Parameters

      - in_len – The length of the input buffer.

      - in_buf – The data to be decompressed.

      - out_len – Pass the length of the output buffer. On return, out_len is the length of the decompressed data.

      - out_buf – The output data is stored here. To do an in place decompression, you can pass the same pointer as in_buf.

    Returns

      True if the operation was a success or false if it failed.

  static unsigned short *uconvert(const char *text)

    This method converts an 8-bit string to a unicode string.

    Parameters

      text – The 8-bit string to convert.

    Returns

      A pointer to the newly created unicode string.

  static bool BuildIncludePath(HC_KEY objectkey, const HC_KEY *includelist, int ilength, HC_KEY *fullpath, int *fplength, HC_KEY matchkey = (-1L))

    Given an array of include keys, this method builds a full path consisting of segment keys and includes.

    Parameters

      - objectkey – The key to start segment or geometry.

      - includelist – The list of includes.

      - ilength – The length of include list.

      - fullpath – Return the full key path derived from the object key and include list.

      - fplength – Returns the length of the key path.

      - matchkey – Pass a key that when found by this method will stop building the path. If you want the method to walk the entire tree, pass INVALID_KEY.

  static void BuildIncludePathFromSelection(HSmartSelItem *sitem, int &plen, HC_KEY *fullpath)

    This method builds the include path for a given selection item.

    Parameters

      - sitem – A pointer to the selection item.

      - plen – Returns the length of the include path.

      - fullpath – Return the full key path of the selection item.

  static void MakeViewSnapshot(HBaseView *view, int width, int height, char **data)

    This method creates an image snapshot of the contents of a given view.

    Parameters

      - view – A pointer to the view you want a snapshot of.

      - width – The width of the image.

      - height – The height of the image.

      - data – Pass a double pointer so that HOOPS can return the character pointer used to store the image data. Note you must free this memory with delete [].

  static void MakeViewSnapshot(HBaseView *view, HC_KEY image_key)

    This method creates an image snapshot of the contents of a given view.

    Parameters

      - view – A pointer to the view you want a snapshot of.

      - image_key – to which we will render. Create this image before calling MakeViewSnapshot with this call: HC_KEY image_key = HC_KInsert_Image(0, 0, 0, “rgba”, width, height, 0).

  static int ConstrainToVector(const float matrix_in[], const HVector &vector, float matrix_out[])

    Given an input matrix and a vector, this method returns the original matrix but with the translation component constrained so that translation is along the provided vector.

    Parameters

      - matrix_in – A pointer to the modelling matrix.

      - vector – A vector along which translation should be constrained to.

      - matrix_out – Pass a pointer to an array that can hold a 4 x 4 matrix. The method will populate this array with the constrained matrix.

  static void Camera_To_Transform(HCamera *camera, float *pos, float projection_matrix[], float complete_matrix[])

    Given a camera, this method extracts the position, projection and full matrix information and returns it to the caller.

    Parameters

      - camera – A pointer to the camera information.

      - pos – Pass a pointer to an array that can hold a 4 x 4 matrix. The method will populate it with the position information.

      - projection_matrix – Pass a pointer to an array that can hold a 4 x 4 matrix. The method will populate it with the projection information.

      - complete_matrix – Pass a pointer to an array that can hold a 4 x 4 matrix. The method will populate it with the complete matix information.

  static void LocalPixelsToWorld(HCamera *camera, bool righthanded, float xres, float yres, int xwpix, int ywpix, float result[])

    This method calculates the the transformation matrix for local pixels to world coordinates.

    Parameters

      - camera – A pointer to the camera information.

      - righthanded – Pass true if the handedness setting is right or false if the handedness is left.

      - xres – The horizontal screen resolution.

      - yres – The vertical screen resolution.

      - xwpix – The number of horizontal pixels.

      - ywpix – The number of vertical pixels.

      - result – Pass an array that can hold a 4 x 4 matrix. This method will return the transformation matrix.

  static float ComputeAngleBetweenVector(HPoint p1, HPoint p2)

    This method calculates the angle between two vectors.

    Parameters

      - p1 – The first vector.

      - p2 – The second Vector.

    Returns

      The angle between the two vectors.

  static int strlen16(const unsigned short *p16)

    This method calculates the length of the give 16-bit string.

    Parameters

      p16 – The 16-bit character string.

    Returns

      The string length.

  static void CalculateBoundingInfo(HC_KEY startkey, HPoint &min, HPoint &max, HPoint &delta, HPoint &mid)

    This method uses #HC_Compute_Circumcuboid to calculate bounding information for a given segment hierachy.

    Parameters

      - startkey – The key of the segment to calculate bounding for.

      - min – Returns the minimum point of the bounding box.

      - max – Returns the maximum point of the bounding box.

      - delta – Returns the extent of the bounding box.

      - mid – Returns the center point of the bounding box.

  static long ClipPolygonAgainstPlane(long vertexCount, HPoint const vertex[], float const plane[], HPoint result[], bool *noCut = 0)

    This method clips a polygon against a plane described by the planar equation ax + by + cz + d = 0.

    Parameters

      - vertexCount – The number of vertices in the input polygon.

      - vertex – The vertices of input polygon.

      - plane – A pointer to an array that holds the five parameters a, b, c and d represented in the planar equation ax + by + cz + d = 0 respectively.

      - result – Returns the points of the newly clipped polygon.

    Returns

      The number of points in the clipped polygon.

  static HFileIOResult TwoPassPrint(const char *driver, HOutputHandlerOptions *options)

    This method performs a two pass print.

    Parameters

      - driver – The driver to print to.

      - options – A pointer to the options structure containing miscellaneous options.

    Returns

      The result of the printings.

  static HC_KEY OpenSegmentFromKey(HC_KEY key, char *segment)

    This method opens a segment with the given name underneath the segment given by key. If the segment doesn’t exist, a new one is created.

    Parameters

      - key – The key of segment which contains the newly created/opened segment.

      - segment – The name the segment you want to open.

    Returns

      The key to segment.

  static bool IsPointInsideAllEdges(const float *pt, const float points1[], int len, const int face1[], const float plane1[], float fudge)

    This method determine if the given point enclosed by all the given edges.

    Parameters

      - pt – The point to test.

      - points1 – The points array.

      - len – The length of the points array.

      - face1 – The face connectivity array as described in #HC_Insert_Shell.

      - plane1 – A pointer to an array of four values that specify the a, b, c and d values of the planar equation ax + by + cz + d = 0.

      - fudge – The threshold to decide in the point is inside or outside the plane.

    Returns

      True if the point is inside the edges or false if it isn’t.

  static void IntersectionLinePlane(HPoint *p1, HPoint *p2, HPlane *p, HPoint *res)

    This method calculates the intersection point between a line and a plane.

    Parameters

      - p1 – The starting point of the line.

      - p2 – The end point of the line.

      - p – A pointer to the plane.

      - res – Returns the intersection point.

  static void DeleteManipulators(HC_KEY key)

    This method removes manipulator handles from the geometry or segment identified by key

    Parameters

      key – The key to the geometry or segment with manipulators

  static void MergePointsIntoShell(int num_shell_points, HPoint plist1[], int num_shell_facelist, int flist1[], int num_merge_points, HPoint merge_points[], HPoint merge_vectors[], float tolerance, bool AddExtraPoints, int newpoints[], int *newpointslen)

    This method merges an array of points into a given shell.

    Parameters

      - num_shell_points – The mumber of points in the shell

      - plist1 – The shell point list.

      - num_shell_facelist – The length of the face list

      - flist1 – The face list as described in #HC_Insert_Shell.

      - num_merge_points – The number of points to merge.

      - merge_points – A pointer to an array of points to merge.

      - merge_vectors – An optional vector array to find correct merge location on face.

      - tolerance – Pass a value that indicates if two points are within the tolerance distance, they will be merged into one point.

      - AddExtraPoints – Pass true to allow additional points to be added to improve tesselation.

      - newpoints – Pass an array for this method to populate with the newly created points.

      - newpointslen – This method returns length of the newpoints array after it has been populated.

  static void SubdivideShells(HC_KEY sskey, HC_KEY startkey, HC_KEY newkey, int numx, int numy, int numz, ShellToRegionMapper *mapper = 0, bool DoCut = true, bool DeleteOriginalShells = false, bool breakShells = false)

    This function is still in development. Given a segment, this method subdivides the shells found into smaller shells according to how they are situated spatially. Given a cube that is divided into smaller sections, the new shells are created such that they are bounded by these smaller sections.

    Parameters

      - startkey – The key of segment to search for shells in.

      - newkey – key of segment to place subdivided geometry in.

      - numx – The subdivision sections in the X direction.

      - numy – The subdivision sections in Y direction.

      - numz – The subdivision sections in Z direction.

      - DoCut – Pass true to cut a shell that lies in between multiple sections or false to keep it in tact. Note that if you pass true, the image may not appear as seamless as the original.

      - DeleteOriginalShells – Pass true to delete the original shells or false to leave them.

      - breakshells –

  static void MergePolylines()

    This method merges all the polylines in the currently open segment.

  static void CreateZebraStripeTexture(int width, int height, int stripwidth, bool horizontal, HPixelRGB colorstripes, HPixelRGB colorbackground)
  static void ascii_to_unicode(char const *ascii, unsigned short *unicode)

    This method converts an ASCII string to a unicode string. Please use H_UNICODE_TEXT in place of this function as this may be removed in the next release.

    Parameters

      - ascii – The ASCII string you want to convert.

      - unicode – A pointer to the array that will hold the converted unicode string. Note this array should be at least as long as the ASCII string.

  static void unicode_to_ascii(unsigned short const *unicode, char *ascii)

    This method converts a unicode string into an ASCII string. Please use H_ASCII_TEXT in place of this function as this may be removed in the next release.

    Parameters

      - unicode – The unicode string you want to convert.

      - ascii – A pointer to the array that will hold the converted ASCII String. Note this array shold be at least as long as the unicode string.

  static void BatchRead(HBaseModel *model, const char *directory, const char *extension)

    This method loads all files with a particular extension into the model segment. It starts reading files in the given directory and then descends down the directory until it has read all files with the given extension.

    Parameters

      - model – A pointer to the model object to be used.

      - directory – The directory to start searching for files.

      - extension – The extension of the files to be loaded. All files encountered with this extension will be loaded.

  static void AdjustPositionToPlane(HBaseView *view, HPoint &position, HPoint point_in_plane)

    This function projects a point in world space onto the plane that contains point_in_plane and is parallel to the near clipping plane which is perpindicular to the view vector.

    Parameters

      - position – The point to be projected into the plane. This function returns the new adjusted coordinates.

      - point_in_plane – A point in the plane (which is perpindicular to the view vector) to which we’re going to project out world space position point.

  static void CalculateCornerImagePosition(HBaseView *view, int iwidth, int iheight, HWindowCorner corner, float &posx, float &posy)

    This method calculates the exact coordinates to place an image in a given corner of a window.

    Parameters

      - view – A pointer to the HBaseView object.

      - iwidth – The width of the image.

      - iheight – The height of the image.

      - corner – The corner in which you want to place the window which can be TopRight or BottomRight.

      - posx – Returns the x coordinate for the image.

      - posy – Returns the y coordinate for the image.

  static void OptimizeModelByGrid(HBaseView *view, ShellToRegionMapper *mapper)
  static void DecipherTextureString(char *texdef, char *Source, bool *DownSampling = 0, bool *DownSamplingSet = 0, char *ParameterizationSource = 0, char *InterpolationFilter = 0, char *DecimationFilter = 0, char *Layout = 0, char *Tiling = 0, bool *ValueScaleSet = 0, bool *ValueScale = 0, float *ValueScaleMin = 0, float *ValueScaleMax = 0, char *BlendingMode = 0)
  static inline bool IsSafeForSinglePrecision(double element, bool check_roundoff = false)

    This method checks whether a double precision element (usually from a matrix) can be safely stored as a single precision element

    Parameters

      - element – The element to test.

      - check_roundoff – If true, take into consideration the acceptable round-off error due to the double-to-single precision conversion.

  static inline bool IsSafeForSinglePrecision(int element_count, double const *elements, bool check_roundoff = false)

    This method checks whether a double precision matrix can be safely stored as a single precision matrix

    Parameters

      - element_count – The length of elements.

      - elements – The elements of a matrix.

      - check_roundoff – If true, take into consideration the acceptable round-off error due to the double-to-single precision conversion.

  Public Static Attributes

  static const float PI

    default=3.1415926f

  static const float EH_Epsilon

    default=0.01