HUtility
-
class
HUtility The
HUtilityclass contains a set of utility functions and data structures used widely in MVO classes.HUtilityincludes utility functions for double-precision vector math, creation of construction geometry, etc…Index
Methods
activity_change()AdjustPositionToPlane()ascii_to_unicode()BatchRead()BuildIncludePath()BuildIncludePathFromSelection()CalculateBoundingInfo()CalculateCornerImagePosition()CalculateKeyPath()CalculateMajorAxis()Camera_To_Transform()CamerasEqual()ClampPointToWindow()ClipPolygonAgainstPlane()CloseAllSegments()ComputeAngleBetweenVector()ComputeDoublePrecisionCrossProduct()ComputeDoublePrecisionDotProduct()ComputeDoublePrecisionVectorLength()ComputeShellNormal()ComputeVectorToVectorRotationMatrix()ConstrainToVector()ConvertLocalPixelsToLocalWindow()CountShellData()CreateAxisCircle()CreateScaleIndependentSegment()CreateZebraStripeTexture()DecipherTextureString()DeleteManipulators()EaseInEaseOut()extra_pointer_format()ExtractRGB()Find_Relative_Path()FindContents()FindFaceByIndex()FindFileNameAndDirectory()FindFileNameAndDirectory()FindFileNameExtension()FindFileNameExtension()FindOneObject()FindUnicodeFileNameExtension()Generate_LODs()GenerateCuboidPoints()GetAllowAnimation()GetCameraFromGLFrustum()GetCameraFromMatrix()GetCentroid()GetMatrixFromCamera()GetNextRenumberedKey()GetScaleIndependentGeomPosition()GetScaleIndependentGeomSegmentKey()GetTime()GetTransformedCentroid()GetViewplaneVectors()GrabSegment()InsertArrow()InsertBox()InsertRectangle()InsertRotatedArrow()InsertWireframeBox()InterpolateNormalAlongEdge()IntersectionLinePlane()IsChildOf()IsIdentityMatrix()IsModelKey()IsPointInsideAllEdges()IsSafeForSinglePrecision()IsSafeForSinglePrecision()IsSegmentKey()LocalPixelsToWorld()MakeViewSnapshot()MakeViewSnapshot()MatrixToQuaternion()Merge_Shells()Merge_Shells_Generate_Regions()MergePointsIntoShell()MergePolylines()MergeShells()ModifyPushedAttribute()MoveToTemp()MultiSmoothTransitions()NameSegments()NormalizeDoublePrecisionVector()OpenSegmentFromKey()OptimizeModelByGrid()OptimizeSegmentTree()Order()PointsEqual()PopAttribute()ProjectShell()PushAttribute()PushAttribute()QuaternionToMatrix()ReadjustTarget()Recursive_Merge_Shells()RegisterCallbacks()RenameSegment()ReplaceCharacter()RestoreAttributeFromOption()RLECompress()RotateToVector()SafeSetUserOption()SafeShowUserOption()scale_segment()Segment_Shell_Allocate()SegmentExists()SelectUnderCursor()SetAttribute()SetScaleIndependentGeomPosition()Shell_Search()ShowAttribute()ShowContentsWithPath()ShowContentsWithPathAddEntity()ShowContentsWithPathRecursive()ShowModellingMatrix()ShowNormals()ShowOneHeuristic()ShowOneRenderingOption()ShowOneUserOption()ShowPushedAttribute()SmartSelectUnderCursor()SmoothMatrixTransition()SmoothQuaternionTransition()SmoothTransition()SmoothTransition()strlen16()SubdivideOneShell()SubdivideShells()SuppressAnimation()TransitionQuaternion()TwoPassPrint()uconvert()unicode_to_ascii()UnsetAttributes()UnwindIncludes()UnwindIncludes()URIdecode()URIencode()UserOptionExists()ustrlen()ZlibCompress()ZlibDecompress()
Variables
Enumerations
Methods
-
static void
HUtility::Order(HPoint *one, HPoint *two) static
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
HUtility::Find_Relative_Path(HC_KEY from_seg_key, HC_KEY to_seg_key, char *path) static
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 void
HUtility::ClampPointToWindow(HPoint *point) static
ClampPointToWindow clamps a point to its nearest corner in window space.
Parameters
point: A pointer to anHPointobject.
-
static HC_KEY
HUtility::InsertBox(HPoint const *max, HPoint const *min) static
InsertBox inserts a six-sided, rectangular cuboid based on 2 points.
Parameters
Returns
The key to the newly created box.
-
static HC_KEY
HUtility::InsertWireframeBox(HPoint *max, HPoint *min) static
InsertWireframeBox uses a polyline to insert a six-sided, rectangular cuboid wireframe based on 2 points.
Parameters
Returns
The key to the newly created box.
-
static void
HUtility::GenerateCuboidPoints(HPoint const *max, HPoint const *min, HPoint points[]) static
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
HUtility::InsertRectangle(char const *seg, float x0, float y0, float x1, float y1, float z = 0.0f, bool fill = false) static
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
HUtility::InsertArrow(float stick_length, float tip_length, float stick_radius, float arrow_radius, char const *text, char const *stick_color, char const *tip_color, int num_sides = 6, float tip_falloff = 0.05, bool reverse = true) static
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
HUtility::ComputeDoublePrecisionCrossProduct(double const *vector1, double const *vector2, double up[]) static
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
HUtility::ComputeDoublePrecisionDotProduct(double const *vector1, double const *vector2) static
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
HUtility::ComputeDoublePrecisionVectorLength(double const *vector1) static
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
HUtility::GetViewplaneVectors(HC_KEY segment_key, double view[], double up[]) static
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
HUtility::NormalizeDoublePrecisionVector(double vector1[]) static
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
HUtility::PointsEqual(HPoint const *point1, HPoint const *point2) static
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
HUtility::CreateAxisCircle(HPoint const ¢er, float radius, int axis, bool convert = true) static
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::GeneratePointsOnCircleonly 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
HUtility::RotateToVector(HPoint const &start, HPoint const &end, bool doTranslation = true) static
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
HUtility::SmoothTransition(HPoint const &co, HPoint const &to, HPoint const &uo, float fieldwidtho, float fieldheighto, HPoint const &cn, HPoint const &tn, HPoint const &un, float fieldwidthn, float fieldheightn, HBaseView *view) static
SmoothTransition takes two camera definitions and uses quaternions to smoothly move the camera on the
HBaseViewobject 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
HBaseViewobject you want the camera movements to be applied.
-
static void
HUtility::SmoothTransition(HCamera old_camera, HCamera const &new_camera, HBaseView *view) static
SmoothTransition takes two camera definitions and uses quaternions to smoothly move the camera on the
HBaseViewobject 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
HBaseViewobject you want the camera movements to be applied.
-
static bool
HUtility::CamerasEqual(HCamera const &camera1, HCamera const &camera2) static
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
HUtility::ComputeVectorToVectorRotationMatrix(float matrix[], HPoint v1, HPoint v2) static
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
HUtility::ExtractRGB(char *text, float &r, float &g, float &b) static
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
HUtility::TransitionQuaternion(float quat_old[], float quat_new[], float t, float qt[]) static
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
HUtility::MatrixToQuaternion(float const matrix[], float quaternion[]) static
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
HUtility::QuaternionToMatrix(float const quaternion[], float matrix[]) static
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
HUtility::SmoothQuaternionTransition(HBaseView *m_pView, char const *old_seg, char const *new_seg, int num_of_transitions) static
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
HBaseViewobject.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
HUtility::SmoothMatrixTransition(HBaseView *m_pView, HC_KEY seg_key, float new_matrix[]) static
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
HBaseViewobject.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
HUtility::MultiSmoothTransitions(HBaseView *m_pView, int num_keys, HC_KEY *seg_key, float const new_matrix[], HCamera *new_camera = 0) static
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
HBaseViewobject.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
HUtility::GetCentroid(HC_KEY seg_key) static
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
HUtility::GetTransformedCentroid(HC_KEY seg_key, float const matrix[] = 0) static
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
HUtility::URIencode(char const *in_string, MVO_POINTER_SIZED_UINT n, char *out_buffer) static
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
HUtility::URIdecode(char const *in_string, char *out_buffer, MVO_POINTER_SIZED_UINT *n) static
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
HUtility::GetCameraFromMatrix(float const *matrix, HPoint *position, HPoint *up_vector, HPoint *translation) static
This method extracts the camera attributes from the input transformation matrix.
Parameters
matrix: A pointer to the transformation matrix.
position: A pointer to
HPointobject representing the camera position which this method will populate.up_vector: A pointer to
HPointobject representing the view-up vector which this method will populate.translation: A pointer to
HPointobject representing the translation which this method will populate.
-
static void
HUtility::GetMatrixFromCamera(HPoint const &target, HPoint const &position, HPoint up_vector, HPoint const &translation, float matrix[]) static
This method composes a transformation martix from the given camera attributes.
Parameters
target: A pointer to
HPointobject representing camera target.position: A pointer to
HPointobject representing camera position.up_vector: A pointer to
HPointobject representing view-up vector.translation: A pointer to
HPointobject representing translation.matrix: Resultant transformation matrix. Pass a pointer to an array that can accomodate a 4 x 4 matrix.
-
static void
HUtility::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) static
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
HUtility::PushAttribute(char const *attName) static
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
HUtility::PushAttribute(char const *attName, char const *attText) static
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
HUtility::PopAttribute(char const *attName) static
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
HUtility::ModifyPushedAttribute(char const *attName, char const *newStyle) static
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
HUtility::ShowPushedAttribute(char const *attName, HUserOptions &attText) static
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
HUtility::Recursive_Merge_Shells(HShell *total_info, HShell *max_info, bool do_recurse, bool delete_orig_shells = false, bool insert_null_lods = false) static
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_Allocateto 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
HUtility::Merge_Shells(bool do_recurse, bool delete_orig_shells = false, bool optimize_shell = true, bool generate_regions = false) static
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
HUtility::Merge_Shells_Generate_Regions(int num_shells, HC_KEY shell_keys[], bool delete_orig_shells = false) static
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
HUtility::Generate_LODs(bool do_recurse = true, bool delete_orig_shells = false, int n_lod_levels = 2, float reduction_ratio = 0.20) static
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.
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
HUtility::Segment_Shell_Allocate(HShell *total_info, HShell *max_info, bool do_recurse) static
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
HUtility::Shell_Search(HShell *total_info, HShell *max_info, bool do_recurse) static
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
-
static void
HUtility::OptimizeSegmentTree(HC_KEY old_seg_key, HC_KEY *new_seg_key, bool merge_shells = true) static
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
HUtility::CountShellData(HC_KEY shell_key, int *face_count, int *vertice_count, int *triangle_count, int *tristrips_count = 0) static
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.
face_count: Returns the number of faces in the given shell. Passed by reference.
vertice_count: Returns the number of vertices in the shell, including duplicates. Passed by reference
triangle_count: Returns the number of triangles in the shell after HOOPS triangulation calculation. Passed by reference.
tristrips_count: Returns the number of tristrips in the shell. Pass by reference.
-
static void
HUtility::FindFileNameExtension(char const *filename_in, char *ext_out) static
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
HUtility::FindFileNameExtension(__wchar_t const *filename_in, __wchar_t *ext_out, int size = -1) static
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
HUtility::FindUnicodeFileNameExtension(unsigned short const *filename_in, char *ext_out) static
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
HUtility::FindFileNameAndDirectory(char const *filename_in, char *dir_out, char *filename_out) static
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
HUtility::FindFileNameAndDirectory(__wchar_t const *filename_in, __wchar_t *dir_out, __wchar_t *filename_out) static
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 char const *
HUtility::extra_pointer_format() static
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
HUtility::CreateScaleIndependentSegment(char const *segname, bool SetCallback = true) static
This method is for internal use only.
-
static HC_KEY
HUtility::GetScaleIndependentGeomSegmentKey(HC_KEY segkey) static
This is for internal use only.
-
static void
HUtility::SetScaleIndependentGeomPosition(HC_KEY segkey, float x, float y, float z) static
This is for internal use only.
-
static void
HUtility::GetScaleIndependentGeomPosition(HC_KEY segkey, float &x, float &y, float &z) static
This is for internal use only.
-
static void
HUtility::RegisterCallbacks() static
This method register callbacks for
HUtilitywith theHImManager.
-
static bool
HUtility::IsModelKey(HC_KEY modelkey, HC_KEY objectkey) static
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
HUtility::UserOptionExists(HC_KEY key, char const *attrib, char *result) static
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
HUtility::InsertRotatedArrow(float tip_length, float stick_radius, float tip_radius, float distance, int adelta, float rotang, char const *stick_color, char const *tip_color, int num_sides) static
Inserts a circular arrow consisting of a cylinder and a cone display. The arrow is completely customizable.
Parameters
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.
-
static int
HUtility::CalculateKeyPath(HC_KEY startkey, HBaseView const *view, HC_KEY keyarray[], int maxarray) static
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
HBaseViewobject.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
HUtility::SegmentExists(char const *segment) static
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
HUtility::UnsetAttributes() static
The method unsets various attributes in current segment. Currently, it unsets visibility, heuristics, and rendering options.
-
static int
HUtility::IsChildOf(HC_KEY owner, HC_KEY child, HC_KEY klist[] = 0) static
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
HUtility::IsIdentityMatrix(float const matrix[]) static
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
HUtility::ComputeShellNormal(HC_KEY skey, HPoint &tnormal) static
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
HPointobject. The method will populate this parameter with the calculated normal vector.
-
static HC_KEY
HUtility::SelectUnderCursor(HBaseView *view, float x, float y, bool doSelection = true, bool DeSelect = false) static
Deprecated. Please use
SmartSelectUnderCursor. Puts item under cursor in selection list.Parameters
view: Pointer to
HBaseViewObject.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
HUtility::SmartSelectUnderCursor(HBaseView *view, float x, float y, bool doSelection = true, bool DeSelect = false) static
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
HBaseViewObject.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
HUtility::ShowOneHeuristic(char const *type, char *res = 0) static
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
HUtility::ShowOneRenderingOption(char const *type, char *res = 0) static
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
HUtility::EaseInEaseOut(float t, float a, float b, float c) static
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
HUtility::UnwindIncludes(HC_KEY &key) static
From the current selection, this method walks up the segment tree until all includes are resolved.
Parameters
key: Segment to unwind from.
-
static void
HUtility::UnwindIncludes(HC_KEY &newkey, HC_KEY const keys[], int count) static
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
HUtility::SafeSetUserOption(char const *opt) static
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
HUtility::SafeShowUserOption(char *opt) static
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
HUtility::ProjectShell(HC_KEY shellkey) static
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
HUtility::MergeShells(HC_KEY shell1, HC_KEY shell2) static
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
HUtility::ShowModellingMatrix(float segment_modelling_matrix[]) static
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
HUtility::ConvertLocalPixelsToLocalWindow(HBaseView const *view, HPoint *in_system, HPoint *out_system = 0) static
This method converts a point from local pixels space to local window space.
Parameters
-
static HC_KEY
HUtility::GrabSegment(HC_KEY key) static
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
HUtility::RenameSegment(HC_KEY segkey, char const *newname) static
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
HUtility::InterpolateNormalAlongEdge(HPoint &p1, HPoint &n1, HPoint &p2, HPoint &n2, HPoint &p3, HPoint &n3) static
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
HUtility::ShowNormals(HC_KEY shellkey, float normallength) static
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
HUtility::IsSegmentKey(HC_KEY key) static
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
HUtility::FindContents(HC_KEY &key, bool original = false) static
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
HUtility::CalculateMajorAxis(HBaseView const *view) static
This method calculates the major axis of the current camera.
Parameters
view: A pointer to theHBaseViewobject.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
HUtility::FindOneObject(char const *type, bool local_search = false) static
This method find a objects of given type in the current segment or globally.
Parameters
type: HOOPS entity type like segment, shell, etc.
local_search: 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
HUtility::CloseAllSegments(HC_KEY endkey = INVALID_KEY) static
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
HUtility::ReadjustTarget(HBaseView const *view) static
This method resets the camera target to be in the center of the current view.
Parameters
view: A pointer to theHBaseViewObject.
-
static bool
HUtility::GetAllowAnimation(HC_KEY key) static
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
HUtility::SuppressAnimation() static
This method sets the user option to suppress animation for the currently opened segment.
-
static int
HUtility::FindFaceByIndex(int findex, int const flist[], int flen) static
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
HUtility::ShowOneUserOption(char const *option, char *res) static
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
HUtility::GetNextRenumberedKey(HBaseView const *view) static
This method finds the next unused globally renumbered key.
Parameters
view: A pointer to theHBaseViewobject.Returns
The next available renumbered key.
-
static void
HUtility::NameSegments(HC_KEY &key, HBaseView const *view) static
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
HBaseViewobject.
-
static void
HUtility::MoveToTemp(HC_KEY movekey, HC_KEY tempkey) static
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
HUtility::ShowContentsWithPath(char const *entitytypes, struct vlist_s **ret_pathlist, bool storePath = false, bool includeIncludes = true, bool filterIncludes = true) static
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
HShowContentsWithPathTypestructure 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
HUtility::ustrlen(unsigned short *text) static
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
HUtility::RLECompress(int in_len, unsigned char const *in_buf, int *out_len, unsigned char *out_buf) static
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
HUtility::ZlibCompress(int in_len, unsigned char const *in_buf, int &out_len, unsigned char *out_buf) static
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
HUtility::ZlibDecompress(int const in_len, unsigned char const *const in_buf, int &out_len, unsigned char *const out_buf) static
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 *
HUtility::uconvert(char const *text) static
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
HUtility::BuildIncludePath(HC_KEY objectkey, HC_KEY const includelist[], int ilength, HC_KEY fullpath[], int *fplength, HC_KEY matchkey = INVALID_KEY) static
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
HUtility::BuildIncludePathFromSelection(HSmartSelItem *sitem, int &plen, HC_KEY fullpath[]) static
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
HUtility::MakeViewSnapshot(HBaseView *view, int width, int height, char **data) static
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
HUtility::MakeViewSnapshot(HBaseView *view, HC_KEY image_key) static
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
HUtility::ConstrainToVector(float const matrix_in[], HVector const &vector, float matrix_out[]) static
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
HUtility::Camera_To_Transform(HCamera const *camera, float pos[], float projection_matrix[], float complete_matrix[]) static
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
HUtility::LocalPixelsToWorld(HCamera const *camera, bool righthanded, float xres, float yres, int xwpix, int ywpix, float result[]) static
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
HUtility::ComputeAngleBetweenVector(HPoint p1, HPoint p2) static
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
HUtility::strlen16(unsigned short const *p16) static
This method calculates the length of the give 16-bit string.
Parameters
p16: The 16-bit character string.Returns
The string length.
-
static void
HUtility::CalculateBoundingInfo(HC_KEY startkey, HPoint &min, HPoint &max, HPoint &delta, HPoint &mid) static
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
HUtility::ClipPolygonAgainstPlane(long vertexCount, HPoint const vertex[], float const plane[], HPoint result[], bool *noCut = 0) static
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 HFileOutputResult
HUtility::TwoPassPrint(char const *driver, HOutputHandlerOptions *options) static
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
HUtility::OpenSegmentFromKey(HC_KEY key, char const *segment) static
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
HUtility::IsPointInsideAllEdges(float const *pt, float const points1[], int len, int const face1[], float const plane1[], float fudge) static
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
HUtility::IntersectionLinePlane(HPoint const *p1, HPoint const *p2, HPlane const *p, HPoint *res) static
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
HUtility::DeleteManipulators(HC_KEY key) static
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
HUtility::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) static
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
HUtility::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) static
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
HUtility::MergePolylines() static
This method merges all the polylines in the currently open segment.
-
static void
HUtility::CreateZebraStripeTexture(int width, int height, int stripwidth, bool horizontal, HPixelRGB const &colorstripes, HPixelRGB const &colorbackground) static
-
static void
HUtility::ascii_to_unicode(char const *ascii, unsigned short *unicode) static
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
HUtility::unicode_to_ascii(unsigned short const *unicode, char *ascii) static
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
HUtility::BatchRead(HBaseModel *model, char const *directory, char const *extension) static
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
HUtility::AdjustPositionToPlane(HBaseView const *view, HPoint &position, HPoint point_in_plane) static
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
HUtility::CalculateCornerImagePosition(HBaseView const *view, int iwidth, int iheight, HWindowCorner corner, float &posx, float &posy) static
This method calculates the exact coordinates to place an image in a given corner of a window.
Parameters
view: A pointer to the
HBaseViewobject.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
HUtility::OptimizeModelByGrid(HBaseView const *view, ShellToRegionMapper *mapper) static
-
static void
HUtility::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
-
static bool
HUtility::IsSafeForSinglePrecision(double element, bool check_roundoff = false) static
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 bool
HUtility::IsSafeForSinglePrecision(int element_count, double const *elements, bool check_roundoff = false) static
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.
-
static void
HUtility::scale_segment(HIC_Rendition const *rendition, HIC_Segment_Info const *geo3) private static
-
static void
HUtility::activity_change(HIC_Segment *seg, int old_activity, int new_activity) private static
-
static bool
HUtility::RestoreAttributeFromOption(char const *attName, HUserOptions &attText) private static
-
static void
HUtility::ShowContentsWithPathAddEntity(HC_KEY key, vlist_s *pathlist, int level, HC_KEY const patharray[], bool storePath) private static
-
static void
HUtility::ShowContentsWithPathRecursive(HC_KEY key, char const *entitytypes, vlist_s *pathlist, HC_KEY patharray[], int level, bool storePath, bool includeIncludes, bool filterIncludes) private static
-
static void
HUtility::SubdivideOneShell(HShellWrapper &myshell, int numx, int numy, int numz, HPoint const &totalmin, HPoint const &totaldeltadiv, HShellWrapper *shellmatrix, HShellWrapper &leftover, bool DoCut, int regionnum, ShellToRegionMapper *mapper, HC_KEY newkey) private static
Variables