VisualizationFoundation CAT3DCylinderGP

Usage: you must use this class as is. You should never derive it.


public class CAT3DCylinderGP

Class to create the graphic primitive of a 3D cylinder.
Role: Tesselation is stored the simplest way: 2 fans for extremal sections, 1 strip for the body of the cylinder. We only store vertices for the base section, and we dynamically generate tesselation during the draw.


Constructor and Destructor Index


o CAT3DCylinderGP(void)
Default constructor.
o CAT3DCylinderGP(float*,float*,float,float)
Constructs a 3D cylinder from its bottom face center coordinates, its extusion vector, its radius and the sag used for tesselation.

Method Index


o Draw(CATRender&)
Draws the cylinder.
o Get(int*,float**,int*,float**,int*,int**,int*,int**,int*,int**,int**,int*,int**)
o GetReadOnly(int*,float const**,int*,float const**,int*,int const**,int*,int const**,int*,int const**,int const**,int*,int const**)
Retrieves the tesselation information from the cylinder.
o GetTextureCoordinates(float**)
o GetTextureCoordinates(float**,int*)
o GetTextureCoordinatesReadOnly(float const**)
o GetTextureCoordinatesReadOnly(float const**,int*)
Retrieves the texture coordinates.
o GetVertices(int*,float**,int*)
o GetVerticesReadOnly(int*,float const**,int*)
Retrieves the cylinder vertices coordinates.
o SetTextureCoordinates(float*,int)

Constructor and Destructor


o CAT3DCylinderGP
public CAT3DCylinderGP( )
Default constructor.
o CAT3DCylinderGP
public CAT3DCylinderGP( iCenter,
iExtrusion,
iRadius,
iSag)
Constructs a 3D cylinder from its bottom face center coordinates, its extusion vector, its radius and the sag used for tesselation.
Parameters:
iCenter
Array made with the three coordinates of the cylinder bottom extremal face center.
iExtrusion
Array made with the extrusion vector coordinates. Indeed, a cylinder is the extrusion of a circle along a vector. The length of the iExtrusion vector is the length of the cylinder. this array size is equal to three.
iRadius
The radius of the cylinder.
iSag
This parameter defines the number of vertices along the cylinder, and means the chordal deviation along the base circle.

Methods


o Draw
public virtual Draw( iRender)
Draws the cylinder.
Parameters:
iRender
The render through which the cylinder is drawn.
o Get
public Get( oAllocate,
oVertices,
oVerticesArraySize,
oNormals,
oNormalsArraySize,
oTriangleIndices,
oNbTriangle,
oTriangleStripIndices,
oNbTriangleStrip,
oNbVertexPerTriangleStrip,
oTriangleFanIndices,
oNbTriangleFan,
oNbVertexPerTriangleFan)
Deprecated:
R216 see GetReadOnly
o GetReadOnly
public GetReadOnly( oAllocate,
oVertices,
oVerticesArraySize,
oNormals,
oNormalsArraySize,
oTriangleIndices,
oNbTriangle,
oTriangleStripIndices,
oNbTriangleStrip,
oNbVertexPerTriangleStrip,
oTriangleFanIndices,
oNbTriangleFan,
oNbVertexPerTriangleFan)
Retrieves the tesselation information from the cylinder.
Role: As this method is designed to return values on its parameters, it has to be called like this :
 int allocate;
 float const* vertices;
 ...
 GetReadOnly(&allocate, &vertices, ...);
 

Parameters:
oAllocate
Flag specifying whether retrieved data is copied or not.
Legal values:
1
retrieved data is copied.
0
retrieves references on data.
oAllocate flag is always returned equal to 1: GetVertices always allocates the returned arrays.
oVertices
Retrieves an array made of cylinder vertices coordinates: XYZXYZXYZ... If we have NCirclePoints to describe the base cylinder circle, the size of this array is equal to 3 * 4 * NCirclePoints. This array is structured like this: Its first NCirclePoints*3 fields contain the bottom circle vertices coordinates. Then, are stored respectively, the bottom circle first vertex coordinates, the top circle corresponding vertex coordinates, the bottom circle second vertex coordinates, the top circle corresponding vertex coordinates ... Finally, the last NCirclePoints*3 coordinates correspond to the top circle vertices coordinates. This kind of organization allows the drawing of the cylinder body thanks to triangles strips, by taking the points in the order they are stored. For example, let's assume that our bottom circle is tesselated thanks to 4 vertices. Let's call the bottom circle BC and the top circle TC. If the notation BC.P1 designates the first vertex of the bottom circle, the oVertices array will look like this :
      
                               -----------
                              | oVertices |
                               -----------
                           {  |   BC.P1   |  
      bottom circle points {  |   BC.P2   |   
                           {  |   BC.P3   |   
                           {  |   BC.P4   |   
                              |   BC.P1   | }
                              |   TC.P1   | }
                              |   BC.P2   | }
                              |   TC.P2   | } 
                              |   BC.P3   | } intermediate cylinder body
                              |   TC.P3   | }
                              |   BC.P4   | }
                              |   TC.P4   | }
                            { |   TC.P1   |
          top circle points { |   TC.P2   |
                            { |   TC.P3   |
                            { |   TC.P4   |   
                               -----------
                

   
Of course, for each point we have in reality 3 fields in the array, corresponding to this point's coordinates.
oVerticesArraySize
the oVertices array size. This size is equal to three times the number of vertices used to describe the bottom circle cross four.
oNormals
Retrieves an array made of normals coordinates. It is organized as oVertices : one vertex has exactly one normal at the same field entry.
oNormalsArraySize
Retrieves The size, in floats, of the oNormal array. Equal to three times the number of normals and equals to oVerticesArraySize.
oTriangleIndices
Indices of cylinder single triangles vertices. Always equal to NULL.
oNbTriangle
Number of cylinder single triangles. Always equal to 0.
oTriangleStripIndices
Retrieves the array used to store the cylinder triangles strip. There is only one triangles strip, used to describe the cylinder body. Each field contains a vertex index, belonging to the strip, in the oVertices array. As, we find, in the oVertices array, the XYZ coordinates for each vertex, the indices used to designate the vertices are multiples of three.
oNbTriangleStrip
Retrieves the number of triangles strips used to describe the cylinder body. Always equal to 1.
oNbVertexPerTriangleStrip
Retrieves an array, which size is one, containing the number of vertices used in the strip. If NCirclePoints is the number of vertices used to describe the cylinder bottom circle, the number of vertices belonging to the strip is equal to 2*NCirclePoints*3 + 2.
oTriangleFanIndices
Retrieves the array used to store the cylinder triangles fans vertices indices. There is only 2 triangles fans in a cylinder: one for each extremities circle. Each field contains a vertex index, belonging to one of the fans, in the oVertices array. As, we find, in the oVertices array, the XYZ coordinates for each vertex, the indices used to designate the vertices are multiples of three.


                   ----------------------
                  | *oTriangleFanIndices  |
                   ----------------------
                  |          i00         |   }
                  |          i01         |   } first triangle fan defined
                  |           .          |   } by the first n0 indices
                  |           .          |   }
                  |          i0n0        |   }
                  |                      |
                  |          i10         |   }
                  |          i11         |   }
                  |           .          |   } second triangle fan 
                  |           .          |   } with n1 vertices
                  |          i1n1        |   }
                   ----------------------


   
For example, index i10 allows to access the cylinder second fan first vertex wich coordinates are X = *oVertices[i10], Y = *oVertices[i10 + 1] and Z = *oVertices[i10 + 2], and which normal coordinates are Nx = *oNormals[i10], Ny = *oNormals[i10 + 1] and Nz = *oNormals[i10 + 2].
oNbTriangleFan
Retrieves the number of cylinder triangles fans. Always equal to 2.
oNbVertexPerTriangleFan
Retrieves the array containing the number of vertices for each cylinder triangles fan. The size of this array is equal to 2. For example, the first fan is made with *oNbVertexPerTriangleStrip[0] vertices.
                --------------------------
               | *oNbVertexPerTriangleFan |
                --------------------------
               |             n0           |
               |             n1           |   n1 = number of vertices of the second fan. (*oNbVertexPerTriangleFan[1]
                --------------------------    

   
o GetTextureCoordinates
public GetTextureCoordinates( oTextureCoord)
Deprecated:
V5R14
o GetTextureCoordinates
public GetTextureCoordinates( oTextureCoord,
oDimension)
Deprecated:
R216 see GetTextureCoordinatesReadOnly
o GetTextureCoordinatesReadOnly
public GetTextureCoordinatesReadOnly( oTextureCoord)
Deprecated:
in favor of GetTextureCoordinates (float ** oTextureCoord, int * oDimension) Retrieves the texture coordinates. This method must be used like this:
 float * textureCoord;
 GetTextureCoord(&textureCoord);
 
Parameters:
oTextureCoord
Retrieves the array of texture coordinates. Each vertex has an associated position in the texture map. The number of texture coordinates groups is always equal to the number of vertices.
o GetTextureCoordinatesReadOnly
public GetTextureCoordinatesReadOnly( oTextureCoord,
oDimension)
Retrieves the texture coordinates. This method must be used like this:
 float * textureCoord;
 GetTextureCoord(&textureCoord);
 
Parameters:
oTextureCoord
Retrieves the array of texture coordinates. Each vertex has an associated position in the texture map. The number of texture coordinates groups is always equal to the number of vertices.
oDimension
Retrieve the number of coordinates per vertex.
o GetVertices
public GetVertices( oAllocate,
oVertices,
oVerticesArraySize)
Deprecated:
R216 see GetVerticesReadOnly
o GetVerticesReadOnly
public GetVerticesReadOnly( oAllocate,
oVertices,
oVerticesArraySize)
Retrieves the cylinder vertices coordinates.
Role: As this method is designed to return values on its parameters, it has to be called like this :
 int allocate;
 float * vertices;
 ...
 GetVertices(&allocate, &vertices, ...);
 

Parameters:
oAllocate
Flag specifiying whether retrieved data is copied or not.
Legal values:
1
retrieved data is copied.
0
retrieves references on data.
oAllocate flag is always returned equal to 1: GetVertices always allocates the returned arrays.
oVertices
Retrieves an array made of cylinder vertices coordinates: XYZXYZXYZ... If we have NCirclePoints to describe the base cylinder circle, the size of this arrsy is equal to 3 * 4 * NCirclePoints. This array is structured like this: Its first NCirclePoints*3 fields contain the bottom circle vertices coordinates. Then, are stored respectively, the bottom circle first vertex coordinates, the top circle corresponding vertex coordinates, the bottom circle second vertex coordinates, the top circle corresponding vertex coordinates ... Finally, the last NCirclePoints*3 coordinates correspond to the top circle vertices coordinates. This kind of organization allows the drawing of the cylinder body thanks to triangles strips, by taking the points in the order they are stored. For example, let's assume that our bottom circle is tesselated thanks to 4 vertices. Let's call the bottom circle BC and the top circle TC. If the notation BC.P1 designates the first vertex of the bottom circle, the oVertices array will look like this :
      
                               -----------
                              | oVertices |
                               -----------
                           {  |   BC.P1   |  
      bottom circle points {  |   BC.P2   |   
                           {  |   BC.P3   |   
                           {  |   BC.P4   |   
                              |   BC.P1   | }
                              |   TC.P1   | }
                              |   BC.P2   | }
                              |   TC.P2   | } 
                              |   BC.P3   | } intermediate cylinder body
                              |   TC.P3   | }
                              |   BC.P4   | }
                              |   TC.P4   | }
                            { |   TC.P1   |
          top circle points { |   TC.P2   |
                            { |   TC.P3   |
                            { |   TC.P4   |   
                               -----------
                

   
Of course, for each point we have in reality 3 fields in the array, corresponding to this point's coordinates.
oVerticesArraySize
the oVertices array size. This size is equal to three times the number of vertices used to describe the bottom circle cross four.
o SetTextureCoordinates
public SetTextureCoordinates( iTextureCoord,
iFormat)
Deprecated:
R216 See CAT3DCylinderGPEditHelper Sets the texture coordinates.
Parameters:
iTextureCoord
Array of texture coordinates. Each vertex has an associated position in the texture map. The number of texture coordinates groups is always equal to the number of vertices.
iTextureFormat
iTextureFormat is the number of fields associated to one vertex in the iTextureCoord array. It is also the number of texture coordinates associated to each vertex. Indeed, each vertex has associated coordinates in the texture map. The number of coordinates depends on the map dimension: the texture map may be in 1D, 2D or 3D.
Legal values:
1
The texture map is a one dimension map. Each vertex has a single associated texture coordinate
2
The texture map is a two-dimension map. Each vertex has two associated texture coordinates
3
The texture map is a three-dimension map. Each vertex has three associated texture coordinates

This object is included in the file: CAT3DCylinderGP.h
If needed, your Imakefile.mk should include the module: CATVisFoundation

Copyright © 1999-2015, Dassault Systèmes. All rights reserved.