The HUtility class contains a set of utility functions and data structures used widely in MVO classes. More...
#include <HUtility.h>
Public Types | |
enum | { X, Y, Z, W } |
enum | { XY, XZ, YZ } |
Static Public Member Functions | |
static void | AdjustPositionToPlane (HBaseView *view, HPoint &position, HPoint point_in_plane) |
static void | ascii_to_unicode (char const *ascii, unsigned short *unicode) |
static void | BatchRead (HBaseModel *model, const char *directory, const char *extension) |
static bool | BuildIncludePath (HC_KEY objectkey, const HC_KEY *includelist, int ilength, HC_KEY *fullpath, int *fplength, HC_KEY matchkey=INVALID_KEY) |
static void | BuildIncludePathFromSelection (HSmartSelItem *sitem, int &plen, HC_KEY *fullpath) |
static void | CalculateBoundingInfo (HC_KEY startkey, HPoint &min, HPoint &max, HPoint &delta, HPoint &mid) |
static void | CalculateCornerImagePosition (HBaseView *view, int iwidth, int iheight, HWindowCorner corner, float &posx, float &posy) |
static int | CalculateKeyPath (HC_KEY startkey, HBaseView *view, HC_KEY *keyarray, int maxarray) |
static int | CalculateMajorAxis (HBaseView *view) |
static void | Camera_To_Transform (HCamera *camera, float *pos, float projection_matrix[], float complete_matrix[]) |
static bool | CamerasEqual (const HCamera &camera1, const HCamera &camera2) |
static void | ClampPointToWindow (HPoint *point) |
static long | ClipPolygonAgainstPlane (long vertexCount, const HPoint vertex[], const float plane[], HPoint result[], bool *noCut=0) |
static void | CloseAllSegments (HC_KEY endkey=INVALID_KEY) |
static float | ComputeAngleBetweenVector (HPoint p1, HPoint p2) |
static void | ComputeDoublePrecisionCrossProduct (double *vector1, double *vector2, double *up) |
static double | ComputeDoublePrecisionDotProduct (double *vector1, double *vector2) |
static double | ComputeDoublePrecisionVectorLength (double *vector1) |
static void | ComputeShellNormal (HC_KEY skey, HPoint &tnormal) |
static void | ComputeVectorToVectorRotationMatrix (float matrix[], HPoint v1, HPoint v2) |
static int | ConstrainToVector (const float matrix_in[], const HVector &vector, float matrix_out[]) |
static void | ConvertLocalPixelsToLocalWindow (HBaseView *view, HPoint *in_system, HPoint *out_system=0) |
static void | CountShellData (HC_KEY shell_key, int *faces, int *vertices, int *triangles, int *tristrips=0) |
static bool | CreateAxisCircle (HPoint const ¢er, float radius, int axis, bool convert=true) |
static HC_KEY | CreateScaleIndependentSegment (const char *segname, bool SetCallback=true) |
static void | CreateZebraStripeTexture (int width, int height, int stripwidth, bool horizontal, HPixelRGB colorstripes, HPixelRGB colorbackground) |
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 void | DeleteManipulators (HC_KEY key) |
static float | EaseInEaseOut (float t, float a, float b, float c) |
static const char * | extra_pointer_format () |
static bool | ExtractRGB (char *text, float &r, float &g, float &b) |
static void | Find_Relative_Path (HC_KEY from_seg_key, HC_KEY to_seg_key, char *path) |
static int | FindContents (HC_KEY &key) |
static int | FindFaceByIndex (int findex, int *flist, int flen) |
static void | FindFileNameAndDirectory (const char *filename_in, char *dir_out, char *filename_out) |
static void | FindFileNameAndDirectory (__wchar_t const *filename_in, __wchar_t *dir_out, __wchar_t *filename_out) |
static void | FindFileNameExtension (const char *filename_in, char *ext_out, int size=-1) |
static void | FindFileNameExtension (__wchar_t const *const filename_in, __wchar_t *ext_out, int size=-1) |
static HC_KEY | FindOneObject (const char *type, bool l=0) |
static void | FindUnicodeFileNameExtension (const unsigned short *filename_in, char *ext_out) |
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) |
static void | GenerateCuboidPoints (HPoint const *max, HPoint const *min, HPoint *points) |
static bool | GetAllowAnimation (HC_KEY key) |
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) |
static void | GetCameraFromMatrix (float matrix[], HPoint *target, HPoint *position, HPoint *up_vector, HPoint *translation) |
static HPoint | GetCentroid (HC_KEY seg_key) |
static void | GetMatrixFromCamera (HPoint target, HPoint position, HPoint up_vector, HPoint translation, float matrix[]) |
static HC_KEY | GetNextRenumberedKey (HBaseView *view) |
static void | GetScaleIndependentGeomPosition (HC_KEY segkey, float &x, float &y, float &z) |
static HC_KEY | GetScaleIndependentGeomSegmentKey (HC_KEY segkey) |
static float | GetTime () |
static HPoint | GetTransformedCentroid (HC_KEY seg_key, float matrix[]=0) |
static void | GetViewplaneVectors (HC_KEY segment_key, double *view, double *up) |
static HC_KEY | GrabSegment (HC_KEY key) |
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) |
static HC_KEY | InsertBox (HPoint const *max, HPoint const *min) |
static HC_KEY | InsertRectangle (const char *seg, float x0, float y0, float x1, float y1, float z=0.0f, bool fill=false) |
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) |
static HC_KEY | InsertWireframeBox (HPoint *max, HPoint *min) |
static void | InterpolateNormalAlongEdge (HPoint &p1, HPoint &n1, HPoint &p2, HPoint &n2, HPoint &p3, HPoint &n3) |
static void | IntersectionLinePlane (HPoint *p1, HPoint *p2, HPlane *p, HPoint *res) |
static int | IsChildOf (HC_KEY owner, HC_KEY child, HC_KEY klist[]=0) |
static bool | IsIdentityMatrix (float matrix[]) |
static bool | IsModelKey (HC_KEY modelkey, HC_KEY objectkey) |
static bool | IsPointInsideAllEdges (const float *pt, const float points1[], int len, const int face1[], const float plane1[], float fudge) |
static bool | IsSegmentKey (HC_KEY key) |
static void | LocalPixelsToWorld (HCamera *camera, bool righthanded, float xres, float yres, int xwpix, int ywpix, float result[]) |
static void | MakeViewSnapshot (HBaseView *view, int width, int height, char **data) |
static void | MakeViewSnapshot (HBaseView *view, HC_KEY image_key) |
static void | MatrixToQuaternion (float matrix[], float quaternion[]) |
static HC_KEY | Merge_Shells (bool do_recurse, bool delete_orig_shells=false, bool optimize_shell=true, bool generate_regions=false) |
static HC_KEY | Merge_Shells_Generate_Regions (int num_shells, HC_KEY *shell_keys, bool delete_orig_shells=false) |
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) |
static void | MergePolylines () |
static HC_KEY | MergeShells (HC_KEY shell1, HC_KEY shell2) |
static bool | ModifyPushedAttribute (const char *attName, const char *newStyle) |
static void | MoveToTemp (HC_KEY movekey, HC_KEY tempkey) |
static void | MultiSmoothTransitions (HBaseView *m_pView, int num_keys, HC_KEY *seg_key, float new_matrix[], HCamera *new_camera=0) |
static void | NameSegments (HC_KEY &key, HBaseView *view) |
static void | NormalizeDoublePrecisionVector (double *vector1) |
static HC_KEY | OpenSegmentFromKey (HC_KEY key, char *segment) |
static void | OptimizeModelByGrid (HBaseView *view, ShellToRegionMapper *mapper) |
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) |
static void | Order (HPoint *one, HPoint *two) |
static bool | PointsEqual (HPoint *point1, HPoint *point2) |
static bool | PopAttribute (const char *attName) |
static void | ProjectShell (HC_KEY shellkey) |
static bool | PushAttribute (const char *attName) |
static void | PushAttribute (const char *attName, const char *attText) |
static void | QuaternionToMatrix (float quaternion[], float matrix[]) |
static void | ReadjustTarget (HBaseView *view) |
static void | Recursive_Merge_Shells (HShell *total_info, HShell *max_info, bool do_recurse, bool delete_orig_shells=false, bool insert_null_lods=false) |
static void | RegisterCallbacks () |
static void | RenameSegment (HC_KEY segkey, const char *newname) |
static bool | RLECompress (int const in_len, unsigned char const *const in_buf, int *out_len, unsigned char *const out_buf) |
static void | RotateToVector (HPoint start, HPoint end, bool doTranslation=true) |
static bool | SafeSetUserOption (const char *opt) |
static bool | SafeShowUserOption (char *opt) |
static bool | Segment_Shell_Allocate (HShell *total_info, HShell *max_info, bool do_recurse) |
static bool | SegmentExists (const char *segment) |
static HC_KEY | SelectUnderCursor (HBaseView *view, float x, float y, bool doSelection=true, bool DeSelect=false) |
static void | SetScaleIndependentGeomPosition (HC_KEY segkey, float x, float y, float z) |
static void | Shell_Search (HShell *total_info, HShell *max_info, bool do_recurse) |
static void | ShowContentsWithPath (const char *entitytypes, struct vlist_s **ret_pathlist, bool storePath=false, bool includeIncludes=true, bool filterIncludes=true) |
static void | ShowModellingMatrix (float *segment_modelling_matrix) |
static void | ShowNormals (HC_KEY shellkey, float normallength) |
static bool | ShowOneHeuristic (const char *type, char *res=0) |
static bool | ShowOneRenderingOption (const char *type, char *res=0) |
static bool | ShowOneUserOption (const char *option, char *res) |
static bool | ShowPushedAttribute (const char *attName, HUserOptions &attText) |
static HC_KEY | SmartSelectUnderCursor (HBaseView *view, float x, float y, bool doSelection=true, bool DeSelect=false) |
static void | SmoothMatrixTransition (HBaseView *m_pView, HC_KEY seg_key, float new_matrix[]) |
static void | SmoothQuaternionTransition (HBaseView *m_pView, char *old_seg, char *new_seg, int num_of_transitions) |
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) |
static void | SmoothTransition (HCamera old_camera, const HCamera &new_camera, HBaseView *view) |
static int | strlen16 (const unsigned short *p16) |
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) |
static void | SuppressAnimation () |
static void | TransitionQuaternion (float quat_old[], float quat_new[], float t, float qt[]) |
static HFileOutputResult | TwoPassPrint (const char *driver, HOutputHandlerOptions *options) |
static unsigned short * | uconvert (const char *text) |
static void | unicode_to_ascii (unsigned short const *unicode, char *ascii) |
static void | UnsetAttributes () |
static void | UnwindIncludes (HC_KEY &key) |
static void | UnwindIncludes (HC_KEY &newkey, HC_KEY *keys, int count) |
static void | URIdecode (const char *in_string, char *out_buffer, MVO_POINTER_SIZED_UINT *n) |
static void | URIencode (const char *in_string, MVO_POINTER_SIZED_UINT n, char *out_buffer) |
static HC_KEY | UserOptionExists (HC_KEY key, const char *attrib, char *result) |
static int | ustrlen (unsigned short *text) |
static bool | ZlibCompress (int const in_len, unsigned char const *const in_buf, int &out_len, unsigned char *const out_buf) |
static bool | ZlibDecompress (int const in_len, unsigned char const *const in_buf, int &out_len, unsigned char *const out_buf) |
Static Public Attributes | |
static const float | EH_Epsilon |
default=0.01 | |
static const float | PI |
default=3.1415926f | |
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...
|
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.
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 |
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.
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 |
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.
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 |
Given an array of include keys, this method builds a full path consisting of segment keys and includes.
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 |
This method builds the include path for a given selection item.
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 |
This method uses #HC_Compute_Circumcuboid to calculate bounding information for a given segment hierachy.
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 |
This method calculates the exact coordinates to place an image in a given corner of a window.
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 |
This function returns a list of keys from the current segment to the top level scene segment.
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. |
|
static |
This method calculates the major axis of the current camera.
view | A pointer to the HBaseView object. |
|
static |
Given a camera, this method extracts the position, projection and full matrix information and returns it to the caller.
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. |
The CamerasEqual method tests two camera definitions for equality.
camera1 | The first camera definition. |
camera2 | The second camera definition. |
|
static |
ClampPointToWindow clamps a point to its nearest corner in window space.
point | A pointer to an HPoint object. |
|
static |
This method clips a polygon against a plane described by the planar equation ax + by + cz + d = 0.
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. |
|
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.
endkey | Pass a key that will end the method. |
This method calculates the angle between two vectors.
p1 | The first vector. |
p2 | The second Vector. |
|
static |
ComputeDoublePrecisionCrossProduct computes the cross product of two double precision vectors.
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 |
ComputeDoublePrecisionDotProduct computes a double precision dot product of two vectors.
vector1 | A pointer to a double precision vector. |
vector2 | A pointer to a double precision vector. |
|
static |
ComputeDoublePrecisionVectorLength computes the length of a double precision vector.
vector1 | A pointer to a double precision vector. |
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.
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 |
This method computes a rotation matrix that rotates between the two supplied vectors.
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 |
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.
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 |
This method converts a point from local pixels space to local window space.
|
static |
This method counts the number of faces, vertices and triangles in a given shell primitive.
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 |
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.
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. |
|
static |
This method is for internal use only.
|
static |
This method removes manipulator handles from the geometry or segment identified by key
key | The key to the geometry or segment with manipulators |
|
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.
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. |
|
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.
|
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.
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. |
|
static |
This method returns a relative path for the from_seg_key to the to_seg_key.
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 |
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.
key | The key to identify. |
|
static |
Given Face Index (0,1,2...), this method finds position of face in face list array as described in #HC_Insert_Shell.
findex | The face index. |
flist | The face list array. |
flen | The length of face list array. |
|
static |
Given a filename with path, this method returns the filename and directory.
filename_in | A null terminated string holding a filename. |
dir_out | Pass a char pointer of size > strlen(filename_int)+1. The method returns the directory part of the filename. |
filename_out | Pass a char pointer of size > strlen(filename_int)+1. The method returns the short filename part of the filename. |
|
static |
Given a filename with path, this method returns the filename and directory.
filename_in | A null terminated string holding a filename. |
dir_out | Pass a char pointer of size > strlen(filename_int)+1. The method returns the directory part of the filename. |
filename_out | Pass a char pointer of size > strlen(filename_int)+1. The method returns the short filename part of the filename. |
|
static |
Given a file name, this method returns the file extention. The extentions is returned in lowercase only.
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 |
Given a file name, this method returns the file extention. The extentions is returned in lowercase only.
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 |
This method find a objects of given type in the current segment or globally.
type | HOOPS entity type like segment, shell, etc. |
l | Pass true to search local or false to search globally. |
|
static |
Given a unicode file name, this method returns the file extention. The extentions is returned in lowercase only.
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 |
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.
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 |
GenerateCuboidPoints creates the vertices of a cuboid based on two input points.
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 |
This method returns whether the user option to suppress animation is set for a given segment.
key | The key of the segment in which you want to check the suppress animation option. |
|
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.
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. |
Assumptions regarding the glFrustum values:
right > left
top > bottom
far > near, and for perspective both should be positive.
|
static |
This method extracts the camera attributes from the input transformation matrix.
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. |
This method returns the centroid of a segment in world space.
seg_key | The segment to get centroid from. |
|
static |
This method composes a transformation martix from the given camera attributes.
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. |
This method finds the next unused globally renumbered key.
view | A pointer to the HBaseView object. |
|
static |
This is for internal use only.
This is for internal use only.
|
static |
This method returns the centroid of a segment, transformed by a given matrix.
seg_key | The segment to get centroid from. |
matrix | The transformation to apply to the centroid. |
|
static |
GetViewplaneVectors computes the construction-plane-constrained vectors used for geometry insertion.
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. |
This method returns the key of the input object's owner. If the input is itself a segment key, it is returned as is.
key | The object key which can be segment or geometry. |
|
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.
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 |
InsertRectangle inserts a 2d rectangle as a HOOPS Polyline.
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. |
|
static |
Inserts a circular arrow consisting of a cylinder and a cone display. The arrow is completely customizable.
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. |
InsertWireframeBox uses a polyline to insert a six-sided, rectangular cuboid wireframe based on 2 points.
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. |
|
static |
Given two points and the normals at those points, this method calculates the interpolated normals given an additional third point.
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 |
This method calculates the intersection point between a line and a plane.
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. |
This method determines if a given segment is a child of the given owner segment.
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. |
|
static |
This function returns true if the matrix passed in is an identity matrix and false otherwise.
matrix | the matrix to be queried. |
This method determines if the given key is underneath the model segment.
modelkey | They key to the model segment. |
objectkey | The key to test. |
|
static |
This method determine if the given point enclosed by all the given edges.
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. |
|
static |
This method determines if the given key belongs to a segment.
key | The key to identify. |
|
static |
This method calculates the the transformation matrix for local pixels to world coordinates.
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 |
This method creates an image snapshot of the contents of a given view.
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 []. |
This method creates an image snapshot of the contents of a given view.
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 |
MatrixToQuaternion converts a 4 by 4 matrix to it's equivalent 4 by 1 vector in quaternion space.
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 |
This method extracts all of the shells from the currently open segment and its children, and merges them into one.
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. |
|
static |
This method merges the given shells into a single shell. The original shells are marked as regions in the merged shell.
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. |
|
static |
This method merges an array of points into a given shell.
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 |
This method merges all the polylines in the currently open segment.
This method merges two shells into one.
shell1 | The key to the first shell. |
shell2 | The key to the secon shell. |
|
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".
attName | The name of the stored attribute that needs to be modified. |
newStyle | The modification string. |
This method moves a given segment to a temporary segment.
movekey | The segment you want to move. |
tempkey | The temporary segment to move to. |
|
static |
This method transitions multiple segments to multiple target modelling matrices. It uses quaternions to make the transition appear smooth.
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. |
This method gives unique names to the passed segment and all its parents.
key | The key to the start segment. |
view | A pointer to the HBaseView object. |
|
static |
NormalizeDoublePrecisionVector normalizes a double-precision vector in place so that its magnitude is 1.
vector1 | A pointer to a double precision vector. |
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.
key | The key of segment which contains the newly created/opened segment. |
segment | The name the segment you want to open. |
|
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.
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 |
This method orders the input points in each dimension. The resulting points are minimum and maximum for bounding box input.
one | A pointer to the first point to order. |
two | A pointer to the second point to order. |
PointsEqual compares the equality of two (x,y,z) points.
point1 | A pointer to the first point to compare. |
point2 | A pointer to the second point to compare. |
|
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.
attName | The name of the attribute that needs to be stored. The currently supported attribute names are color, visibility, rendering options and edge weight. |
|
static |
This method projects the given shell to the net modelling matrix of the current segment.
shellkey | The key to the shell. |
|
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.
attName | name of the attribute that needs to be stored. The currently supported attribute names are color, visibility, rendering options and edge weight. |
|
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.
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 |
QuaternionToMatrix converts an 4 by 1 array of floating point values to its equivalent 4 by 4 matrix in cartesian space.
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 |
This method resets the camera target to be in the center of the current view.
view | A pointer to the HBaseView Object. |
|
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_Allocate to allocate the correct amount of memory.
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 |
This method register callbacks for HUtility with the HImManager.
|
static |
This method renames a segment given by the key.
segkey | The key to the segment you want to rename. |
newname | The new name of the segment. |
|
static |
This method compresses the given data using RLE, run length encoding.
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.. |
This method rotates the contents of the currently opened segment to a given vector in space.
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 |
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.
opt | The user option to be input. |
|
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.
opt | The user option (if any). Returned to user. |
|
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.
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 |
This method determines if the segment with given name exists underneath the currently open segment.
segment | The name of the segment to test existence for. |
|
static |
Deprecated. Please use SmartSelectUnderCursor. Puts item under cursor in selection list.
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 |
|
static |
This is for internal use only.
|
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.
|
static |
This method recursively finds all entities in and below the current segment and returns each entity with its complete segment path.
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 |
This method returns the modelling matrix of the currently open segment or identity matrix in none exists.
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 |
This method renders the normals of a given shell as lines.
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 |
This method shows the specificed heuristic setting in the currently open segment.
type | The heuristic Setting to query (e.g. "quick moves"). |
res | The result of query (e.g. "spriting"). |
|
static |
This method shows the specified rendering option setting in the currently open segment.
type | The rendering option setting to query (e.g. "lighting interpolation"). |
res | The result of the query (e.g. "phong") |
|
static |
This method shows the specified user option in the currently opened segment.
option | The user option to search for. |
res | The result of the query. |
|
static |
This method retrieves the stored attribute in the currently open segment if present.
attName | The name of the stored attribute that needs to be retrieved. |
attText | This method returns the attribute string. |
|
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.
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. |
|
static |
This method transitions an object to the target modelling matrix. It uses quaternions to make the transition appear smooth.
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 |
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.
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 |
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.
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 |
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.
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 |
This method calculates the length of the give 16-bit string.
p16 | The 16-bit character string. |
|
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.
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 |
This method sets the user option to suppress animation for the currently opened segment.
|
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.
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 |
This method performs a two pass print.
driver | The driver to print to. |
options | A pointer to the options structure containing miscellaneous options. |
|
static |
This method converts an 8-bit string to a unicode string.
text | The 8-bit string to convert. |
|
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.
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 |
The method unsets various attributes in current segment. Currently, it unsets visibility, heuristics, and rendering options.
|
static |
From the current selection, this method walks up the segment tree until all includes are resolved.
key | Segment to unwind from. |
This method is a helper function for UnwindIncludes(HC_KEY &key).
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 |
This function decodes a URI encoded string.
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 |
This function takes an char buffer and create a URI encoded string.
in_string | A unencoded string. |
n | The length of the in buffer. |
out_buffer | A write back buffer of size 3*n+1. |
This method determine if user options exists in or above the current segment.
key | The segment to begin the search. |
attrib | The attribute to search for. |
result | The attribute value of user option if it exists. |
|
static |
This method returns the size of the unicode string.
text | The unicode text string. |
|
static |
This method compresses the input buffer using the 'zlib' compression library.
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. |
|
static |
This method decompresses the input buffer using the 'zlib' compression library.
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. |