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>

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 const *max, HPoint const *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 (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 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 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 (const char *segment, HPoint center, float radius, int num_faces)
 
static HC_KEY CreateSphere (HPoint center, float radius, int numsides, HPoint axis, HPoint ref)
 
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

◆ AdjustCuttingPlaneRendering()

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
viewA pointer to the HBaseView object.

◆ AdjustSection()

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
viewA pointer to the HBaseView object.
keyThe key to the interesecting cutting planes.

◆ ComputeFIndexDemoData()

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_keyKey to the geometry for which one wishes to compute the demo FIndex data.
pShellVertexDataPointer to HShellVertexData object allocated by application.
data_cyclesNumber of steps in a complete colormap or vertex-index cycle. Must be greater than zero.
Returns
A boolean value indicating success or failure.

◆ CreateBoolean()

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
targetThis is the target of the boolean operation.
toolThis is the tool for the boolean operation. In the case of subtraction, this shell will be subtracted from the target.
bool_typeThis is the type of boolean operation to be performed. Should be one of the following: BOOLEAN_TYPE_INTERSECT, BOOLEAN_TYPE_SUBTRACT, BOOLEAN_TYPE_UNION.

◆ CreateCone()

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
centerAn HPoint object denoting the center of the cone.
radiusThe radius of the cone's base.
heightThe height of the cone.
numsidesThe number of longitudinal strips that will make up the sides of the cone.
axisThe first reference axis used to define the orientation of the geometry.
refThe 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.

◆ CreateCuboid()

static HC_KEY HUtilityGeometryCreation::CreateCuboid ( HPoint const *  max,
HPoint const *  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
maxMax The coordinates that represent one end of the cuboid.
minMin 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.

◆ CreateCuttingPlane()

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
viewA pointer to the HBaseView object.
segmentnameThe name you want to give the cutting plane segment.
Returns
The key to the newly created cutting plane segment.

◆ CreateCylinder()

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
centerAn HPoint object denoting the center of the cylinder's base.
radiusThe radius of the cylinder.
heightThe height of the cylinder.
numsidesThe number of longitudinal strips that will make up the sides of the cone.
axisThis reference axis define the orientation of the cylinder's base.
refThis reference axis define the orientation of the cylinder's altitude.
Returns
The HC_KEY of the HOOPS geometry inserted if the process was successful or INVALID_KEY if it failed.

◆ CreateShellFromPathSweep()

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.

◆ CreateShellFromRotationalSweep()

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.

◆ CreateShellWithFaceSpecificVertexAttributes() [1/2]

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
pointsA pointer to an array of HPoint objects which will be used to build the shell.
face_list_lengthTotal number of integers in the face_vertex_indices array.
face_vertex_indicesEncoded description of how to connect the points to build the faces of the shell as described in #HC_Insert_Shell.
normalsA pointer to an array of HPoint objects which will be used as normal values.
per_face_vertex_normal_indicesEncoded description of which normals should be applied. This should be in the same format as the face_vertex_indices.
color_valuesA pointer to an array of color triples.
per_face_vertex_color_value_indicesEncoded description of which color_values should be applied. This should be in the same format as the face_vertex_indices.
color_findicesA pointer to an array of floating-index values.
per_face_vertex_color_findex_indicesEncoded description of which the color_findices should be applied. This should be in the same format as the face_vertex_indices.
paramsA pointer to a two-dimensional array of floating point vertex parameters.
per_face_vertex_param_indicesEncoded description of which of the params should be applied where. This should be in the same format as the face_vertex_indices.
param_numberThe number of parameters to be set on each vertex of the shell. This is the width of the params array.
crease_angleIf 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.

◆ CreateShellWithFaceSpecificVertexAttributes() [2/2]

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
pointsA pointer to an array of HPoint objects which will be used to build the shell.
face_list_lengthTotal number of integers in the face_vertex_indices array.
face_vertex_indicesEncoded description of how to connect the points to build the faces of the shell as described in #HC_Insert_Shell.
normalsA pointer to an array of HPoint objects which will be used as normal values.
per_face_vertex_normal_indicesEncoded description of which normals should be applied. This should be in the same format as the face_vertex_indices.
color_valuesA pointer to an array of color triples.
per_face_vertex_color_value_indicesEncoded description of which color_values should be applied. This should be in the same format as the face_vertex_indices.
color_findicesA pointer to an array of floating-index values.
per_face_vertex_color_findex_indicesEncoded description of which the color_findices should be applied. This should be in the same format as the face_vertex_indices.
paramsA pointer to a two-dimensional array of floating point vertex parameters.
per_face_vertex_param_indicesEncoded description of which of the params should be applied where. This should be in the same format as the face_vertex_indices.
param_numberThe number of parameters to be set on each vertex of the shell. This is the width of the params array.
crease_angleIf 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.

◆ CreateSmoothedShell()

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
PointCountThe number of valid points in Points.
PointsThe list of vertices for building the shell.
FaceListLengthThe number of integers in FaceList.
FaceListEncoded description of how to connect the points to build the faces of the shell as described in #HC_Insert_Shell().
creaseAngleThe intersection angle, in degrees, beyond which an edge is considered "hard".

◆ CreateSphere() [1/2]

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
segmentThe segment to insert the sphere into.
centerThe coordinate representing the center of the sphere.
radiusThe length of the sphere's radius.
num_facesThe 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.

◆ CreateSphere() [2/2]

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
centerAn HPoint object denoting the center of the sphere.
radiusThe sphere radius.
numsidesThe number of longitudinal strips that will make up the sides of the sphere.
axisThe first reference axis used to define the orientation of the geometry.
refThe 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.

◆ CreateThreeSidedSection()

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
viewA pointer to the HBaseView object.

◆ CreateTwoSidedSection()

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
viewA pointer to the HBaseView object.

◆ CreateWireframeCircleWithEllipse()

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
x1An HPoint object which lies on the circumference of the circle.
x2An HPoint object which lies on the circumference of the circle.
x3An 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.

◆ GenerateFEAShell()

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
definingShellThe key of shell to interpolate.
generateIsolinesPass true to create isolines as explicit polylines.
algorithmPass bilinear or an empty string.
Returns
The key to the newly created shell.

◆ GeneratePointOnCircle()

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
pointA pointer to an HPoint object which denotes the generated point.
centerThe center point of the circle.
radiusThe length of the radius of the circle.
axisXY, 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.
angleRadians measured from 0 about the axis defined by the 'axis' parameter.
convertBoolean indicating whether to convert the point from viewpoint space to world space. The default is true.
Returns
A boolean value indicating success or failure

◆ GeneratePointsOnCircle()

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
pointsA pointer to an array of HPoint objects which denote the generated points.
centerThe center point of the circle.
radiusThe radius of the circle.
axisXY, XZ, or YZ. This defines the view plane in which the circle will be drawn.
numpointsThe desired number of points in the circle.
convertPass 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.

◆ GeneratePointsOnCircularArc()

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
pointsA pointer to an array of HPoint objects which denote the generated points.
centerThe center point of the arc.
radiusThe radius of the arc.
axisXY, XZ, or YZ. This defines the view plane in which the arc will be drawn.
numpointsThe desired number of points in the arc.
convertPass 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_angleIn radians. Angle about the arc axis (in anticlockwise direction) from where the arc starts
end_angleIn 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.

◆ SetCuttingPlaneVisibilityForAll()

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
startkeyThe cutting plane key start key.
visibilityThe visibility setting as described in #HC_Set_Visibility().

◆ SetupModellingMatrix()

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: