#include <math.h>
#include "GR_misc.h"
#include "GR_Cell.h"
#include "GR_Face.h"
#include "GR_Vertex.h"
#include "GR_Vec.h"

const Vert* HexCell::pVVert(const int i) const
{
  assert2(0, "Vertex ordering not defined for hexes");
  assert(iFullCheck());
  assert2(i >= 0 && i <= 3, "Vertex index out of range");
  const Face* const pFBase = ppFFaces[0];
  if (i == 0) return (pFBase->pVVert(0));
  if (pFBase->pCCellRight() == static_cast<const Cell*>(this))
    if (i == 1) return (pFBase->pVVert(1));
    else        return (pFBase->pVVert(2)); // i == 2 by elimination
  else
    if (i == 1) return (pFBase->pVVert(2));
    else        return (pFBase->pVVert(1)); // i == 2 by elimination
}

double HexCell::dSize() const
{
  assert2(0, "Volume calculation not supported for hexes");
  assert(iFullCheck());
//   const Vert *pV0, *pV1, *pV2;
//   const Face* const pFBase = ppFFaces[0];
//   pV0 = pFBase->pVVert(0);
//   if (pFBase->pCCellRight() == (const Cell*)this) {
//     pV1 = pFBase->pVVert(1);
//     pV2 = pFBase->pVVert(2);
//   }
//   else {
//     pV1 = pFBase->pVVert(2);
//     pV2 = pFBase->pVVert(1);
//   }

  return (0);
}

bool HexCell::qIsClosed() const
{
  assert2(0, "No closure check for pyramids");
  return false;
}
