# HShellWrapper

## Fields

int | `m_plen`
int | `m_flen`
HPoint * | `m_Points`
HPoint * | `m_VParams`
HPoint * | `m_VColors`
HPoint * | `m_VNormals`
int * | `m_Flist`
HC_KEY | `m_Key`
int | `m_facepointer`
int | `m_totalflen`
int | `m_totalplen`
int | `m_totalnumfaceslen`
int | `m_numfaceslen`
int * | `m_faceregion`
int * | `m_faceindirect`
FaceWithNormalInfo * | `m_FNArray`

## Functions

| `HShellWrapper`
| `HShellWrapper`
| `~HShellWrapper`
HC_KEY | `Insert`
HC_KEY | `Show`
HC_KEY | `GetKey`
void | `TransformPoints`
HC_KEY | `Optimize`
HC_KEY | `Optimize2`
void | `MakePolygon`
void | `OpenOwnerSegment`
void | `BeginFaceIteration`
void | `EndFaceIteration`
int | `GetFace`
int | `NextFace`
void | `CalculateFaceCenter`
void | `AddPoints`
void | `AddFace`
void | `AddFaceDirect`
void | `AddFace`
void | `Set`
void | `Regenerate`
void | `GrowArrays`
void | `GrowPointArray`
void | `GrowPointArray2`
void | `AddNextFaceWithDistinctNormals`
void | `AddNextFaceWithDistinctNormalsAndTexture`
void | `AddNextFaceWithDistinctNormalsAndColor`
void | `BeginAddFaces`
void | `EndAddFaces`
void | `GrowFaceArray`
void | `SubdivideOneQuadFace`
void | `SubdivideOneQuadFace2`
void | `SubdivideQuadFaces`
void | `SetVertexColors`
void | `ShowVertexColors`
void | `SetVertexColors`
void | `ShowVertexColors`
void | `MakeLod`
void | `FindExtents`
void | `ReplaceWithParameters`
void | `ReplaceWithParameters`
void | `Replace`
void | `SetFaceRegion`
void | `SetEmptyShell`

## Detailed Description

class HShellWrapper

  The HShellWrapper class is wraps shell information and provides methods to manipulate this information.

  HShellWrapper class contains all the information needed to describe a shell. It also have methods that allows you to manipulate and find out shell information such as adding points, iterating through the face list.

  Public Functions

  inline HShellWrapper(HC_KEY key)

    Constructs an HShellWrapper object.

    Parameters

      key – The key associated with the shell for this object.

  inline HShellWrapper()

    Construcst an HShellWrapper object.

  ~HShellWrapper()
  HC_KEY Insert(int plen, HPoint points[], int flen, int flist[], HC_KEY insertkey = (-1L))

    This method insert a new shell into the HOOPS database given a points list and face list as described in #HC_Insert_Shell.

    Parameters

      - plen – The number of points that describe the shell.

      - points – The list of points that describe the shell.

      - flen – The length of the face list.

      - flist – The list that describes the faces in relation to the points as specified in #HC_Insert_Shell.

      - insertkey – Pass a key if you want to insert the shell under a specific segment other wise HOOPS will insert the shell into the currently open segment.

  HC_KEY Show(int *plen, HPoint **points, int *flen, int **flist)

    This method get the current information associated with the shell from the HOOPS database.

    Parameters

      - plen – Returns the length of the points list.

      - points – Returns a pointer to the array of points that describe the shell.

      - flen – Returns the length of the face list.

      - flist – Returns a pointer to an array that describes the faces as specified in #HC_Insert_Shell.

  inline HC_KEY GetKey()
    Returns

      The key associated with the shell.

  void TransformPoints(float matrix[])

    This method performs a transformation of the shells given a transformation matrix.

    Parameters

      matrix – The matrix that describes the transformation.

  HC_KEY Optimize(char *options)

    This method performs optimization on the shell based on a set of given options.

    Parameters

      options – A pointer to the list of options in which you want the shell to be optimized. The available options are specified in #HC_Compute_Optimized_Shell.

  HC_KEY Optimize2(char *options)

    This method performs optimization on the shell based on a set of given options as well as doing created an optimized color map for the faces.

    Parameters

      options – A pointer to the list of options in which you want the shell to be optimized. The available options are specified in #HC_Compute_Optimized_Shell.

  void MakePolygon(int facelen, int face[], HPoint points[])
  void OpenOwnerSegment()

    This method opens the owner segment of the shell.

  void BeginFaceIteration()

    Call this method to initialize member variables before making calls to NextFace.

  inline void EndFaceIteration()

    Call this method to end the face iteration process.

  int GetFace(int facenum, int **face)
  int NextFace(int **face)

    Call this method after BeginFaceIteration to iterate through the shell’s face list.

    Parameters

      face – Returns a pointer to the position in the face list that describes this face.

    Returns

      The number of vertices that the face has.

  void CalculateFaceCenter(int face[], int flen, HPoint *mid)

    This method determines the centroid of a given face.

    Parameters

      - face – A pointer the beginning of the list of points that describe the face in the face list.

      - flen – The number of vertices that face has.

      - mid – Returns the coordinates for the center of the face.

  void AddPoints(HPoint points[], int pnum, HPoint param[] = 0, HPoint normals[] = 0, bool AddImmediately = false)

    This method adds the given points to the points list.

    Parameters

      - points – A pointer to the list of points to add.

      - pnum – The number of entries in points.

      - param – A pointer to the list of parameters to add.

      - AddImmediatly – Pass true to add the points immediately.

  void AddFace(int face[], int fnum, int regionnum, HPoint points[], HPoint normals[] = 0, bool AddImediately = false)

    This method adds a new face to the shell given the face and point list.

    Parameters

      - face – A pointer to the face list as describe in #HC_Insert_Shell.

      - fnum – The number of vertices for the face.

      - points – The list of vertices for the face.

      - AddImmediately – Pass true to add the face immediately.

  void AddFaceDirect(int face[], int fnum, bool reverse = false, bool AddImmediatly = false)

    This method add a new face to the shell given a face list. Note that no new points are added to the point list.

    Parameters

      - face – A pointer to the face list as described in #HC_Insert_Shell.

      - fnum – The number of vertices that define the face.

      - reverse – Pass true if you want to add the vertices in the face list in reverse order.

      - AddImmediately – Pass true to add the face immediately.

  void AddFace(HPoint points[], int fnum, bool AddImmediatly = false)

    This method adds a new face to the shell given the point list. A face list is derived from the point list by ordering the points as they appear in the point list.

    Parameters

      - points – The list of vertices that define the face.

      - fnum – The number of vertices.

      - AddImmediately – Pass true to add the points immediately.

  void Set(HC_KEY key)

    This method sets the key for the class.

    Parameters

      key – Pass the key that defines the shell you want to manipulate. If you pass INVALID_KEY, this method will insert a new shell and record the key that was generated.

  void Regenerate(HC_KEY newowner = (-1L), bool makeSegment = true, bool regenerate = false)

    This method regenerates the shell in the HOOPS database.

    Parameters

      - newowner – Pass the key in which you want the shell to be recreated in. If you want it the be created the current location pass INVALID_KEY.

      - makeSegment – Pass true to create a new segment under the new owner key. Note this parameter only work if a newowner key is not INVALID_KEY.

  void GrowArrays(int fnum)

    This is a helper function used by the AddFace and AddPoints methods. Given an additional number of points, the functions determines if the face and points lists sizes need to be increased and by the optimal amount.

    Parameters

      fnum – The number of points that will be added.

  void GrowPointArray(int fnum, bool gorwvparams = false, bool grownormals = false)

    This method is a helper functions used by the AddFace and AddPoints methods. Given an additional number of points, the functions determines if the points list size need to be increased and by the optimal amount.

    Parameters

      - fnum – The number of points that will be added.

      - growvparams – Pass true if you will be adding parameter pointers in addition to vertices.

  void GrowPointArray2(int fnum, bool growparamarray = false, bool grownormalarray = false, bool growfnarray = false, bool growcolorarray = false)
  void AddNextFaceWithDistinctNormals(HPoint const *points, HPoint const *normals, int const *face1, int const *face2, int fnum)
  void AddNextFaceWithDistinctNormalsAndTexture(HPoint const *points, HPoint const *normals, HPoint const *texcor, int const *face1, int const *face2, int const *face3, int fnum)
  void AddNextFaceWithDistinctNormalsAndColor(HPoint const *points, HPoint const *normals, int const *face1, int const *face2, HPoint *face3, int fnum)
  void BeginAddFaces(int pnum)
  void EndAddFaces()
  void GrowFaceArray(int fnum)

    This is a helper function used by the AddFace and AddPoints methods. Given an additional number of points, the functions determines if the face list size need to be increased and by the optimal amount.

    Parameters

      fnum – The number of points that will be added.

  void SubdivideOneQuadFace(int face[], HShellWrapper &wrapper, bool generateIsolines, int *facecolorlist, int &fclnum)

    This is a helper function to SubdivideQuadFaces and is for internal use only.

  void SubdivideOneQuadFace2(int face[])

    This is a helper function to SubdivideQuadFaces and is for internal use only.

  void SubdivideQuadFaces(bool GenerateIsolines)

    This method retesselates a shell whose faces are all quads so that isolines can be drawn. Note that this will not work for shells whose faces are triangles or other types of polygons.

    Parameters

      GenerateIsolines – Pass true to generate isolines.

  void SetVertexColors(HPoint *color)

    This method sets the shell’s vertices with the given color.

    Parameters

      color – Pass an HPoint populated with the r, g, and b values in the x, y, z position respectively.

  void ShowVertexColors(HPoint *color)

    This method show the shell’s vertices with the given color.

    Parameters

      color – Pass an HPoint populated with the r, g, and b values in the x, y, z position respectively.

  void SetVertexColors(float *findex)

    This method sets the shell’s v ertices with the given color.

    Parameters

      findex – Pass the index value in the colormap that indicates the color you want for this shell’s vertices.

  void ShowVertexColors(float *color)

    This method show the shell’s vertices with the given color.

    Parameters

      color – Pass the index value in the colormap that indicates the color you want for this shell’s vertices.

  void MakeLod(int lodnum, int percent)

    This method inserts a new level of detail given a number and percentage of simplification.

    Parameters

      - lodnum – The level of the LOD.

      - percent – The percent that the number of total triangle will be reduced to in the shell as described by #HC_Compute_Optimized_Shell.

  void FindExtents(HPoint &center, HPoint &min, HPoint &max)

    This method finds the center, minimum and maximum points for the given shell.

    Parameters

      - center – Pass by reference. This method returns the center point for the shell.

      - min – Pass by reference. This method returns the minimum point for the shell.

      - max – Pass by reference. This method returns the maxinum point for the shell.

  void ReplaceWithParameters(int plen, HPoint points[], int flen, int flist[], HPoint normals[] = 0, float params[] = 0, int paranum = 3, HPoint vcolors[] = 0, bool emptyshell = false)
  void ReplaceWithParameters(int plen, HPoint points[], int flen, int flist[], HPoint normals[], float params[], int paranum, bool emptyshell)
  void Replace(int plen, HPoint points[], int flen, int flist[], HPoint normals[] = 0, bool emptyshell = false)
  void SetFaceRegion(int regionnum)
  void SetEmptyShell(HC_KEY segmentkey, bool MakeSegment)

  Public Members

  int m_plen

    The number of points in the points list.

  int m_flen

    The length of the face list.

  HPoint *m_Points
  HPoint *m_VParams
  HPoint *m_VColors
  HPoint *m_VNormals
  int *m_Flist

    The list that defines the configuration of the faces in the shell in relation to the points as described in #HC_Insert_Shell.

  HC_KEY m_Key

    The key of the shell.

  int m_facepointer

    For Internal Use Only

  int m_totalflen

    For Internal Use Only

  int m_totalplen

    For Internal Use Only

  int m_totalnumfaceslen
  int m_numfaceslen
  int *m_faceregion
  int *m_faceindirect
  FaceWithNormalInfo *m_FNArray