Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HUtilityGeometryCreation Class Reference

This class provides utility functions for creating construction geometry as well as simple primitives (spheres, cones, cylinders, etc...). More...

#include <HUtilityGeometryCreation.h>

List of all members.

Static Public Member Functions

static void AdjustCuttingPlaneRendering (HBaseView *view)
static void AdjustSection (HBaseView *view, HC_KEY key)
static bool ComputeFIndexDemoData (HShellVertexData *pShellVertexData, int data_cycles=30)
static HC_KEY CreateBoolean (HC_KEY target, HC_KEY tool, int bool_type)
static HC_KEY CreateCone (HPoint center, float radius, float height, int numsides, HPoint axis, HPoint ref)
static HC_KEY CreateCuboid (HPoint *max, HPoint *min)
static HC_KEY CreateCuttingPlane (HBaseView *view, const char *segmentname=0, bool createplane=true)
static HC_KEY CreateCylinder (HPoint center, float radius, float height, int numsides, HPoint axis, HPoint ref)
static HC_KEY CreateShellFromPathSweep (int nProfilePoints, const HPoint pOuterProfilePoints[], const HPoint pInnerProfilePoints[], int nPathPoints, const HPoint pSweepPathPoints[], const bool bIsProfileClosed)
static HC_KEY CreateShellFromRotationalSweep (int nPoints, const HPoint profile[], const float *radii, float start_angle, float end_angle, int axis, const bool *hard, int n_sides)
static HC_KEY CreateShellWithFaceSpecificVertexAttributes (HPoint points[], int face_list_length, int *face_vertex_indices, HPoint normals[]=0, int *per_face_vertex_normal_indices=0, HPoint color_values[]=0, int *per_face_vertex_color_value_indices=0, float *color_findices=0, int *per_face_vertex_color_findex_indices=0, float *params=0, int *per_face_vertex_param_indices=0, int param_number=0, float crease_angle=0.f)
static HC_KEY CreateShellWithFaceSpecificVertexAttributes (float *points, int face_list_length, int *face_vertex_indices, float *normals=0, int *per_face_vertex_normal_indices=0, float *color_values=0, int *per_face_vertex_color_value_indices=0, float *color_findices=0, int *per_face_vertex_color_findex_indices=0, float *params=0, int *per_face_vertex_param_indices=0, int param_number=0, float crease_angle=0.f)
static void CreateSlice (HBaseView *view, float relative_thickness=0.1f)
static HC_KEY CreateSmoothedShell (int PointCount, const HPoint Points[], int FaceListLength, const int *FaceList, float creaseAngle)
static HC_KEY CreateSphere (HPoint center, float radius, int numsides, HPoint axis, HPoint ref)
static HC_KEY CreateSphere (const char *segment, HPoint center, float radius, int num_faces)
static void CreateThreeSidedSection (HBaseView *view)
static void CreateTwoSidedSection (HBaseView *view)
static HC_KEY CreateWireframeCircleWithEllipse (const HPoint &x1, const HPoint &x2, const HPoint &x3)
static HC_KEY GenerateFEAShell (HC_KEY definingShell, bool generateIsolines, const char *algorithm)
static bool GeneratePointOnCircle (HPoint *point, HPoint const &center, float radius, int axis, float angle, bool convert=true)
static bool GeneratePointsOnCircle (HPoint points[], HPoint const &center, float radius, int axis, int numpoints, bool convert=true)
static bool GeneratePointsOnCircularArc (HPoint points[], HPoint const &center, float radius, int axis, int numpoints, bool convert, float start_angle, float end_angle)
static void SetCuttingPlaneVisibilityForAll (HC_KEY startkey, const char *visibility)
static void SetupModellingMatrix (HVector axis, HVector ref, HVector side, HPoint pos)


Detailed Description

This class provides utility functions for creating construction geometry as well as simple primitives (spheres, cones, cylinders, etc...).

Member Function Documentation

static void HUtilityGeometryCreation::AdjustCuttingPlaneRendering ( HBaseView view  )  [static]

This method changes attribute settings for the cutting planes based on the current rendering mode. If render mode is HRenderHiddenLine, HRenderHiddenLineFast or HRenderBRepHiddenLine, then edges are visible and faces aren't. If the render mode is anything else, then faces are visible and edges aren't.

Parameters:
view A pointer to the HBaseView object.

static void HUtilityGeometryCreation::AdjustSection ( HBaseView view,
HC_KEY  key 
) [static]

This method takes a given key representing intersecting cutting planes and converts them into a cutting section that insect and affect each other.

Parameters:
view A pointer to the HBaseView object.
key The key to the interesecting cutting planes.

static bool HUtilityGeometryCreation::ComputeFIndexDemoData ( HShellVertexData pShellVertexData,
int  data_cycles = 30 
) [static]

This is a demonstration function that shows how a developer might use HOOPS to map analysis data to the object on which the analysis was performed. The mapped data could be results from some analysis that an application performed on a dataset (e.g., FEA thermal analysis of a crankshaft).

ComputeData looks at a given segment and for each shell in the segment computes data that is then attached to the shell vertices. In this example, the attached data are simply the y-values of the vertex normal vector. The data are then mapped into the interval [0.0, 12.0]. These values are directly used for color interpolation and color index interpolation rendering to provide color contouring.

A note on the pShellVertexData parameter: In addition to allocating it prior to the call as an HShellVertexData object, you must also allocate the array member, i.e., m_pFIndexArray, of this data structure. It must be able to hold (number of vertices + number of animation frames/cycles) floats (see MemorySizeForDemoAnimation).

Parameters:
entity_key Key to the geometry for which one wishes to compute the demo FIndex data.
pShellVertexData Pointer to HShellVertexData object allocated by application.
data_cycles Number of steps in a complete colormap or vertex-index cycle. Must be greater than zero.
Returns:
A boolean value indicating success or failure.

static HC_KEY HUtilityGeometryCreation::CreateBoolean ( HC_KEY  target,
HC_KEY  tool,
int  bool_type 
) [static]

This function performs the heavy lifting for the partviewer selection operations that compute booleans. It does handles all the set-up before and clean-up after calling HC_KCompute_Boolean_Shell. Both tool and target should be keys of manifold shells. If either is not a shell key, the return value will be INVALID_KEY.

Parameters:
target This is the target of the boolean operation.
tool This is the tool for the boolean operation. In the case of subtraction, this shell will be subtracted from the target.
bool_type This is the type of boolean operation to be performed. Should be one of the following: BOOLEAN_TYPE_INTERSECT, BOOLEAN_TYPE_SUBTRACT, BOOLEAN_TYPE_UNION.

static HC_KEY HUtilityGeometryCreation::CreateCone ( HPoint  center,
float  radius,
float  height,
int  numsides,
HPoint  axis,
HPoint  ref 
) [static]

CreateCone inserts a HOOPS/3dGS shell (representing a cone oriented about an arbitrary axis) into a no-name subsegment of the currently open segment. The two reference axes must be orthogonal.

Parameters:
center An HPoint object denoting the center of the cone.
radius The radius of the cone's base.
height The height of the cone.
numsides The number of longitudinal strips that will make up the sides of the cone.
axis The first reference axis used to define the orientation of the geometry.
ref The second reference axis used to define the orientation of the geometry.
Returns:
The HC_KEY of the HOOPS geometry inserted if the process was successful or INVALID_KEY if it failed.

static HC_KEY HUtilityGeometryCreation::CreateCuboid ( HPoint max,
HPoint min 
) [static]

CreateCuboid creates a solid box spanning diagonally from min to max point. NOTE: The difference between this routine and the HUtility::InsertBox is that each face does not share any corner points. Therefore the cuboid appears flat shaded even in smooth shading mode which is realistic.

Parameters:
max Max The coordinates that represent one end of the cuboid.
min Min The coordinates that lie diagonal from Max on the opposite face of the cuboid.
Returns:
The HC_KEY of the HOOPS geometry inserted if the process was successful or INVALID_KEY if it failed.

static HC_KEY HUtilityGeometryCreation::CreateCuttingPlane ( HBaseView view,
const char *  segmentname = 0,
bool  createplane = true 
) [static]

This function creates a cutting plane in the cutting plane segment of the view.

Parameters:
view A pointer to the HBaseView object.
segmentname The name you want to give the cutting plane segment.
Returns:
The key to the newly created cutting plane segment.

static HC_KEY HUtilityGeometryCreation::CreateCylinder ( HPoint  center,
float  radius,
float  height,
int  numsides,
HPoint  axis,
HPoint  ref 
) [static]

CreateCylinder inserts a HOOPS/3dGS shell representing a cylinder oriented about an arbitrary axis into a no-name subsegment of the currently open segment. The two reference axes must be orthogonal.

Parameters:
center An HPoint object denoting the center of the cylinder.
radius The radius of the cylinder.
height The height of the cylinder.
numsides The number of longitudinal strips that will make up the sides of the cone.
axis The first reference axis used to define the orientation of the geometry.
ref The second reference axis used to define the orientation of the geometry.
Returns:
The HC_KEY of the HOOPS geometry inserted if the process was successful or INVALID_KEY if it failed.

static HC_KEY HUtilityGeometryCreation::CreateShellFromPathSweep ( int  nProfilePoints,
const HPoint  pOuterProfilePoints[],
const HPoint  pInnerProfilePoints[],
int  nPathPoints,
const HPoint  pSweepPathPoints[],
const bool  bIsProfileClosed 
) [static]

Creates a surface which is the result of sweeping of the given profile along the give path (extrusion). The profile is divided into two parts - the inner and the outer. This provides an ability to sweep hollow elements (viz. pipes). For a solid geometry, the inner profile can be null. NOTE: If the inner profile is non-null, then the number of points in the inner and outer profiles should be same

Parameters:
nProfilePoints - number of points on outer profile
pOuterProfilePoints - array of profile points of outer profile
pInnerProfilePoints - array of profile points of inner profile (can be NULL for solid core)
nPathPoints - number of points in the sweep path.
pSweepPathPoints - array of points on path along which the profile is to be swept
bIsProfileClosed - If false, the first and last points of the outer and inner profiles will be joined automatically NOTE:The profile should always be placed at the start point of the path otherwise the resulting geometry will be incorrect.

static HC_KEY HUtilityGeometryCreation::CreateShellFromRotationalSweep ( int  nPoints,
const HPoint  profile[],
const float *  radii,
float  start_angle,
float  end_angle,
int  axis,
const bool *  hard,
int  n_sides 
) [static]

CreateShellFromRotationalSweep functions creates a spun geometry (shell). It takes a profile (closed) and spins it about an axis (about X or Y or Z axis). This api is very similar to HC_Insert_Polyclyliner - which takes points on the axis and the radii of polycylinder at each of this point. The polycylinder is just a polyline spun around, here you can spin a shape. If the profile is not closed, the function will automatically close it.

Parameters:
nPoints - no of points in the given profile.
profile - Array of points that defines the profile which is required to be spun. These are not the coordinates of actual profile points, but the profile points projected onto the spin axis (similar to polycylinder api)
radii - Array of distances of each point from axis.
start_angle - The starting Angle for spin, in radians.
end_angle - The end Angle for spin in radians.
axis - axis around which the profile will be rotated e.g. pass HUtility::XY for Z axis and so on.
hard - array of booleans passed with points, determines whether to keep the given edge of the profile hard. Points will be duplicated at hard edges for the lighting to appear appropriately. If null is passed, all the edges will be considered as hard edges.
sides - number of sides the spun geometry should have. Imagine the projection of this spun geometry along the spin axis. This is the total number of sides this polygon should have. It should be more than two. The quality and number of triangles will depend upon this parameter set of points on that edge.

static HC_KEY HUtilityGeometryCreation::CreateShellWithFaceSpecificVertexAttributes ( HPoint  points[],
int  face_list_length,
int *  face_vertex_indices,
HPoint  normals[] = 0,
int *  per_face_vertex_normal_indices = 0,
HPoint  color_values[] = 0,
int *  per_face_vertex_color_value_indices = 0,
float *  color_findices = 0,
int *  per_face_vertex_color_findex_indices = 0,
float *  params = 0,
int *  per_face_vertex_param_indices = 0,
int  param_number = 0,
float  crease_angle = 0.f 
) [static]

Creates and inserts a shell with any of a variety of user options.

Parameters:
points A pointer to an array of HPoint objects which will be used to build the shell.
face_list_length Total number of integers in the face_vertex_indices array.
face_vertex_indices Encoded description of how to connect the points to build the faces of the shell as described in HC_Insert_Shell.
normals A pointer to an array of HPoint objects which will be used as normal values.
per_face_vertex_normal_indices Encoded description of which normals should be applied. This should be in the same format as the face_vertex_indices.
color_values A pointer to an array of color triples.
per_face_vertex_color_value_indices Encoded description of which color_values should be applied. This should be in the same format as the face_vertex_indices.
color_findices A pointer to an array of floating-index values.
per_face_vertex_color_findex_indices Encoded description of which the color_findices should be applied. This should be in the same format as the face_vertex_indices.
params A pointer to a two-dimensional array of floating point vertex parameters.
per_face_vertex_param_indices Encoded description of which of the params should be applied where. This should be in the same format as the face_vertex_indices.
param_number The number of parameters to be set on each vertex of the shell. This is the width of the params array.
crease_angle If the angle between the normals of two neighboring faces that share a vertex exceeds this value (in degrees), the vertex will be duplicated to prevent the normals from being averaged. Default is off.

static HC_KEY HUtilityGeometryCreation::CreateShellWithFaceSpecificVertexAttributes ( float *  points,
int  face_list_length,
int *  face_vertex_indices,
float *  normals = 0,
int *  per_face_vertex_normal_indices = 0,
float *  color_values = 0,
int *  per_face_vertex_color_value_indices = 0,
float *  color_findices = 0,
int *  per_face_vertex_color_findex_indices = 0,
float *  params = 0,
int *  per_face_vertex_param_indices = 0,
int  param_number = 0,
float  crease_angle = 0.f 
) [static]

Creates and inserts a shell with any of a variety of user options.

Parameters:
points A pointer to an array of HPoint objects which will be used to build the shell.
face_list_length Total number of integers in the face_vertex_indices array.
face_vertex_indices Encoded description of how to connect the points to build the faces of the shell as described in HC_Insert_Shell.
normals A pointer to an array of HPoint objects which will be used as normal values.
per_face_vertex_normal_indices Encoded description of which normals should be applied. This should be in the same format as the face_vertex_indices.
color_values A pointer to an array of color triples.
per_face_vertex_color_value_indices Encoded description of which color_values should be applied. This should be in the same format as the face_vertex_indices.
color_findices A pointer to an array of floating-index values.
per_face_vertex_color_findex_indices Encoded description of which the color_findices should be applied. This should be in the same format as the face_vertex_indices.
params A pointer to a two-dimensional array of floating point vertex parameters.
per_face_vertex_param_indices Encoded description of which of the params should be applied where. This should be in the same format as the face_vertex_indices.
param_number The number of parameters to be set on each vertex of the shell. This is the width of the params array.
crease_angle If the angle between the normals of two neighboring faces that share a vertex exceeds this value (in degrees), the vertex will be duplicated to prevent the normals from being averaged. Default is off.

static HC_KEY HUtilityGeometryCreation::CreateSmoothedShell ( int  PointCount,
const HPoint  Points[],
int  FaceListLength,
const int *  FaceList,
float  creaseAngle 
) [static]

Creates and inserts into the currently open segment a shell with vertices split where they would otherwise straddle a hard edge. Most usefully, this process allows Gouraud shading to display hard edges.

Parameters:
PointCount The number of valid points in Points.
Points The list of vertices for building the shell.
FaceListLength The number of integers in FaceList.
FaceList Encoded description of how to connect the points to build the faces of the shell as described in HC_Insert_Shell().
creaseAngle The intersection angle, in degrees, beyond which an edge is considered "hard".

static HC_KEY HUtilityGeometryCreation::CreateSphere ( HPoint  center,
float  radius,
int  numsides,
HPoint  axis,
HPoint  ref 
) [static]

CreateSphere inserts a HOOPS/3dGS shell representing a sphere oriented about an arbitrary axis into a no-name subsegment of the currently open segment. The two reference axes must be orthogonal.

Parameters:
center An HPoint object denoting the center of the sphere.
radius The sphere radius.
numsides The number of longitudinal strips that will make up the sides of the sphere.
axis The first reference axis used to define the orientation of the geometry.
ref The second reference axis used to define the orientation of the geometry.
Returns:
The HC_KEY of the HOOPS geometry inserted if the process was successful or INVALID_KEY if it failed.

static HC_KEY HUtilityGeometryCreation::CreateSphere ( const char *  segment,
HPoint  center,
float  radius,
int  num_faces 
) [static]

CreateSphere inserts a HOOPS/3dGS shell representing a sphere into the specified segment.

Parameters:
segment The segment to insert the sphere into.
center The coordinate representing the center of the sphere.
radius The length of the sphere's radius.
num_faces The number of longitudinal strips that will make up the sides of the sphere.
Returns:
The HC_KEY of the HOOPS geometry inserted if the process was successful or INVALID_KEY if it failed.

static void HUtilityGeometryCreation::CreateThreeSidedSection ( HBaseView view  )  [static]

This method creates a three sided cutting section. This cutting section is more advanced form of cutting plane, where the cutting planes intersect and affect each other.

Parameters:
view A pointer to the HBaseView object.

static void HUtilityGeometryCreation::CreateTwoSidedSection ( HBaseView view  )  [static]

This method creates a two sided cutting section. This cutting section is more advanced form of cutting plane, where the cutting planes intersect and affect each other.

Parameters:
view A pointer to the HBaseView object.

static HC_KEY HUtilityGeometryCreation::CreateWireframeCircleWithEllipse ( const HPoint x1,
const HPoint x2,
const HPoint x3 
) [static]

CreateWireframeCircleWithEllipse inserts a HOOPS/3dGS ellipse that representing a circle into the currently open segment.

Parameters:
x1 An HPoint object which lies on the circumference of the circle.
x2 An HPoint object which lies on the circumference of the circle.
x3 An HPoint object which lies on the circumference of the circle.
Returns:
The HC_KEY of the HOOPS geometry inserted if the process was successful or INVALID_KEY if it failed.

static HC_KEY HUtilityGeometryCreation::GenerateFEAShell ( HC_KEY  definingShell,
bool  generateIsolines,
const char *  algorithm 
) [static]

Creates a new shell in the currently open segment with its faces tesselated/colored to represent a binary interpolation of the per vertex color parameters of that shell. The original shell is not changed and should be deleted after this call in most cases.

Parameters:
definingShell The key of shell to interpolate.
generateIsolines Pass true to create isolines as explicit polylines.
algorithm Pass bilinear or an empty string.
Returns:
The key to the newly created shell.

static bool HUtilityGeometryCreation::GeneratePointOnCircle ( HPoint point,
HPoint const &  center,
float  radius,
int  axis,
float  angle,
bool  convert = true 
) [static]

GeneratePointOnCircle generates a single point along a circle based on a centerpoint, a radius, and an angle.

Parameters:
point A pointer to an HPoint object which denotes the generated point.
center The center point of the 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, as well as the axis of rotation for the angular offset of the point. XY defines the z-axis, XZ defines the y-axis, and YZ defines the x-axis.
angle Radians measured from 0 about the axis defined by the 'axis' parameter.
convert Boolean indicating whether to convert the point from viewpoint space to world space. The default is true.
Returns:
A boolean value indicating success or failure

static bool HUtilityGeometryCreation::GeneratePointsOnCircle ( HPoint  points[],
HPoint const &  center,
float  radius,
int  axis,
int  numpoints,
bool  convert = true 
) [static]

GeneratePointsOnCircle generates multiple points along a circle based a center point and a radius. The desired number of points must be specified, and must be equal to the size of the points array if the size of that array has been defined. Note that the basic work in this function is accomplished by repeated calls to GeneratePointOnCircle.

Parameters:
points A pointer to an array of HPoint objects which denote the generated points.
center The center point of the circle.
radius The radius of the circle.
axis XY, XZ, or YZ. This defines the view plane in which the circle will be drawn.
numpoints The desired number of points in the circle.
convert Pass true if you want HOOPS to convert the point from viewpoint space to world space or false if you don't. The default is true.
Returns:
True if the operation was a success or false if it failed.

static bool HUtilityGeometryCreation::GeneratePointsOnCircularArc ( HPoint  points[],
HPoint const &  center,
float  radius,
int  axis,
int  numpoints,
bool  convert,
float  start_angle,
float  end_angle 
) [static]

GeneratePointsOnCircularArc generates multiple points along an arc based a center point and a radius. The desired number of points must be specified, and must be equal to the size of the points array if the size of that array has been defined. Note that the basic work in this function is accomplished by repeated calls to GeneratePointOnCircle.

Parameters:
points A pointer to an array of HPoint objects which denote the generated points.
center The center point of the arc.
radius The radius of the arc.
axis XY, XZ, or YZ. This defines the view plane in which the arc will be drawn.
numpoints The desired number of points in the arc.
convert Pass true if you want HOOPS to convert the point from viewpoint space to world space or false if you don't. The default is true.
start_angle In radians. Angle about the arc axis (in anticlockwise direction) from where the arc starts
end_angle In radians. Angle about the arc axis (in anticlockwise direction) where the arc starts. For e.g. if the start_angle is 0 and end_angle is 360, the arc will form a full circle.
Returns:
true if the operation was a success or false if it failed.

static void HUtilityGeometryCreation::SetCuttingPlaneVisibilityForAll ( HC_KEY  startkey,
const char *  visibility 
) [static]

Sets the given visibility for all cutting planes beginning with the given startkey.

Parameters:
startkey The cutting plane key start key.
visibility The visibility setting as described in HC_Set_Visibility().

static void HUtilityGeometryCreation::SetupModellingMatrix ( HVector  axis,
HVector  ref,
HVector  side,
HPoint  pos 
) [static]

Sets a modelling matrix based on the reference axes and position.


The documentation for this class was generated from the following file: