Logo Search packages:      
Sourcecode: v-sim version File versions  Download package

void visuDataSet_boxGeometry ( VisuData data,
float  geometry[6],
gboolean  periodic 
)

visuDataSet_boxGeometry: : a VisuData object ; : a 6 floating point array ; : a boolean.

This methods set the size of the box that defines the viewport. If the argument is TRUE, the box is also the limit of a periodic system.

Definition at line 1478 of file visu_data.c.

References _VisuData::privateDt.

{
  int i;
  float normY, normZ;

  if (!data || !geometry)
    {
      fprintf(stderr, "WARNING! 'visuDataSet_boxGeometry' has been called with no 'data'"
            " or no 'geometry' attribute.\n");
      return;
    }
  data->privateDt->isBoxPeriodic = periodic;
  for (i = 0; i < 6; i++)
    data->privateDt->boxGeometry[i] = geometry[i];
  normY = sqrt(geometry[VISU_DATA_BOX_DYX] * geometry[VISU_DATA_BOX_DYX] +
             geometry[VISU_DATA_BOX_DYY] * geometry[VISU_DATA_BOX_DYY]);
  normZ = sqrt(geometry[VISU_DATA_BOX_DZX] * geometry[VISU_DATA_BOX_DZX] +
             geometry[VISU_DATA_BOX_DZY] * geometry[VISU_DATA_BOX_DZY] +
             geometry[VISU_DATA_BOX_DZZ] * geometry[VISU_DATA_BOX_DZZ]);
  data->privateDt->boxNorm[0] = 1.;
  for (i = 1; i < 3; i++)
    data->privateDt->boxNorm[i] = geometry[i] / normY;
  for (i = 3; i < 6; i++)
    data->privateDt->boxNorm[i] = geometry[i] / normZ;
  DBG_fprintf(stderr, "Visu Data : the bounding box is set to :\n %f %f %f\n %f %f %f\n",
            geometry[0], geometry[1], geometry[2], geometry[3],
            geometry[4], geometry[5]);

  /* Create the transformation matrix. */
  data->privateDt->transformXYZtoBoxCoordinates[0][0] =
    1 / data->privateDt->boxGeometry[VISU_DATA_BOX_DXX];
  data->privateDt->transformXYZtoBoxCoordinates[0][1] =
    - data->privateDt->boxGeometry[VISU_DATA_BOX_DYX] /
    data->privateDt->boxGeometry[VISU_DATA_BOX_DXX] /
    data->privateDt->boxGeometry[VISU_DATA_BOX_DYY];
  data->privateDt->transformXYZtoBoxCoordinates[0][2] =
    - (data->privateDt->boxGeometry[VISU_DATA_BOX_DZX] /
       data->privateDt->boxGeometry[VISU_DATA_BOX_DXX] -
       data->privateDt->boxGeometry[VISU_DATA_BOX_DYX] *
       data->privateDt->boxGeometry[VISU_DATA_BOX_DZY] / 
       data->privateDt->boxGeometry[VISU_DATA_BOX_DXX] / 
       data->privateDt->boxGeometry[VISU_DATA_BOX_DYY] ) /
    data->privateDt->boxGeometry[VISU_DATA_BOX_DZZ];
  data->privateDt->transformXYZtoBoxCoordinates[1][0] = 0.;
  data->privateDt->transformXYZtoBoxCoordinates[1][1] =
    1 / data->privateDt->boxGeometry[VISU_DATA_BOX_DYY];
  data->privateDt->transformXYZtoBoxCoordinates[1][2] =
    - data->privateDt->boxGeometry[VISU_DATA_BOX_DZY] /
    data->privateDt->boxGeometry[VISU_DATA_BOX_DYY] /
    data->privateDt->boxGeometry[VISU_DATA_BOX_DZZ];
  data->privateDt->transformXYZtoBoxCoordinates[2][0] = 0.;
  data->privateDt->transformXYZtoBoxCoordinates[2][1] = 0.;
  data->privateDt->transformXYZtoBoxCoordinates[2][2] = 1 /
    data->privateDt->boxGeometry[VISU_DATA_BOX_DZZ];

  data->privateDt->transformBoxCoordinatestoXYZ[0][0] = data->privateDt->boxGeometry[VISU_DATA_BOX_DXX];
  data->privateDt->transformBoxCoordinatestoXYZ[0][1] = data->privateDt->boxGeometry[VISU_DATA_BOX_DYX];
  data->privateDt->transformBoxCoordinatestoXYZ[0][2] = data->privateDt->boxGeometry[VISU_DATA_BOX_DZX];
  data->privateDt->transformBoxCoordinatestoXYZ[1][0] = 0.;
  data->privateDt->transformBoxCoordinatestoXYZ[1][1] = data->privateDt->boxGeometry[VISU_DATA_BOX_DYY];
  data->privateDt->transformBoxCoordinatestoXYZ[1][2] = data->privateDt->boxGeometry[VISU_DATA_BOX_DZY];
  data->privateDt->transformBoxCoordinatestoXYZ[2][0] = 0.;
  data->privateDt->transformBoxCoordinatestoXYZ[2][1] = 0.;
  data->privateDt->transformBoxCoordinatestoXYZ[2][2] = data->privateDt->boxGeometry[VISU_DATA_BOX_DZZ];
}


Generated by  Doxygen 1.6.0   Back to index