##############################
Creating Geometry PRC Entities
##############################

The Exchange API Reference describes the PRC entities that specify geometry in the Geometry module.
This module contains these submodules:

* **Surfaces:**  Entities that represent different kinds of surfaces, such as NURBS, spherical, and toric.
* **Curves:**  Entities that represent different kinds of curves, such as NURBS, elliptic, and helical.

This section describes the creation of a cylinder surface on which a circular co-edge is UV-mapped.

A circular curve includes a coordinate system and parameterization settings.
By default, the reference domain is [0, 2PI].
A circular curve uses an `A3IntervalData` entity as the linear domain and an `A3DMiscCartesianTransformationData` structure as the coordinate system.
New parameterization is computed from two coefficients applied to the reference parameterization [0, 2PI].

********************************
Create a Surface Cylinder Entity
********************************

* Declare a null pointer to an `A3DSurfCylinder` entity.

  .. code-block:: c

   A3DSurfCylinder* pSurfCylinder = NULL;

* Declare and initialize a surface cylinder data structure.

  .. code-block:: c

   A3DSurfCylinderData sData = A3D_MAKE_DATA(A3DSurfCylinderData);

* Set the UV-parameterization data of the surface cylinder data structure, which specifies how the circular curve is mapped to the cylinder. The following example specifies the trimming and orientation of the mapping:

  * Minimum and maximum extents in the UV domain (`sData.m_sParam.m_sUVDomain`) establish the trimming contour in the final parameterization space. Each extent is a 2D vector. The following example clips the texture represented by the co-edge to the area described by [0.0, 0.0] and [360.0 40.0].
  * Coefficients establish parameterization along the U and V axes. In this example, U values are expressed as inverted degrees (`1.0/degrees`). V values are expressed as inverted lengths (`1.0/length`).

  .. code-block:: c

   sData.m_sParam.m_sUVDomain.m_sMin.m_dX = 0.0;
   sData.m_sParam.m_sUVDomain.m_sMin.m_dY = 0.0;
   sData.m_sParam.m_sUVDomain.m_sMax.m_dX = 360.0;
   sData.m_sParam.m_sUVDomain.m_sMax.m_dY = 40.0;
   //	Parameters go from -1 to +1 in both directions
   sData.m_sParam.m_dUCoeffA =
   1.0 / (sData.m_sParam.m_sUVDomain.m_sMax.m_dX / 2);
   sData.m_sParam.m_dUCoeffB = -1.0;
   sData.m_sParam.m_dVCoeffA =
   1.0 / (sData.m_sParam.m_sUVDomain.m_sMax.m_dY / 2);
   sData.m_sParam.m_dVCoeffB = -1.0;
   sData.m_sParam.m_bSwapUV = FALSE;
   sData.m_sTrsf.m_ucBehaviour = kA3DTransformationIdentity;

* Set other member values of the surface cylinder data structure.
  In the following example, the radius of the cylinder is set to 10.0. The unit of measure (as multiples of millimeters) was previously set for the model file entity. (See :doc:`building_prc_2`.)

  .. code-block:: c

   sData.m_dRadius = 10.0;

* Package the cylinder data as a PRC entity by invoking the `A3DSurfCylinderCreate` function. The first argument is a pointer to the surface cylinder data, and the second is the pointer to the surface cylinder entity created in Step 1.

  .. code-block:: c

   A3DInt32 iRet = A3DSurfCylinderCreate(&sData, &pSurfCylinder);

* Declare a null pointer to a circular curve entity.

  .. code-block:: c

   A3DCrvCircle* pCrvCircle = NULL;

* Declare and initialize a circular curve data structure, and initialize the structures it contains.

  .. code-block:: c

   A3DCrvCircleData sData = A3D_MAKE_DATA(A3DCrvCircleData);

* Set the values of the circular curve data structure.
  The following example sets the radius of the circle to a value originally specified during loop creation. (See :doc:`building_prc_4`.)

  .. code-block:: c

   sData.m_dRadius = radius;

* Set the values of the parameterization structure within the circular curve data structure. In this example, the interval defines the circular arc as the entire circle and the co-efficients set the parameterization across the entire length of the circular arc.

  .. code-block:: c

   sData.m_sParam.m_dCoeffA = 1.0;
   sData.m_sParam.m_dCoeffB = 0.0;
   sData.m_sParam.m_sInterval.m_dMin = 0.0;
   sData.m_sParam.m_sInterval.m_dMax = 360;

* Set the values of the Cartesian transformation structure within the circular curve data structure. The following example sets the behavior of the Cartesian transformation data to the identity transformation.

  .. code-block:: c

   sData.m_sTrsf.m_ucBehaviour = kA3DTransformationIdentity;

* Package the curve data as a PRC entity by invoking the `A3DCrvCircleCreate` function. The first argument is a pointer to the curve circle data, and the second is the pointer to the circular curve entity created in Step 1.

  .. code-block:: c

   A3DInt32 iRet = A3DCrvCircleCreate(&sData, &pCrvCircle);

