bool validateCurveData(Abc::P3fArraySamplePtr pCurvePos,
                       Abc::Int32ArraySamplePtr pCurveNbVertices,
                       Abc::UInt16ArraySamplePtr pOrders,
                       Abc::FloatArraySamplePtr pKnotVec, AbcG::CurveType type)
{
  ESS_PROFILE_FUNC();

  int nDefaultOrder = 4;
  const int numCurves = (int)pCurveNbVertices->size();
  const int numControl = (int)pCurvePos->size();

  int numControlNB = 0;

  for (int i = 0; i < pCurveNbVertices->size(); i++) {
    numControlNB += pCurveNbVertices->get()[i];
  }

  if (numControl != numControlNB) {
    ESS_LOG_ERROR(
        "Size mismatch between vertices and nbVertices. Cannot load curve.");
    return false;
  }

  if (pOrders && pCurveNbVertices->size() != pOrders->size()) {
    ESS_LOG_ERROR(
        "Size mismatch between numOrders and nbVertices. Cannot load curve.");
    return false;
  }

  if (pKnotVec) {
    int abcTotalKnots = 0;  // numControl + numCurves * (nDefaultOrder - 2) ;

    if (pOrders) {
      // calculate the expected knot vec size
      for (int i = 0; i < pCurveNbVertices->size(); i++) {
        abcTotalKnots += pCurveNbVertices->get()[i] + pOrders->get()[i] - 2;
      }
    }
    else {  // single order
      int nOrder = 0;
      if (type == AbcG::kCubic) {
        nOrder = 4;
      }
      else if (type == AbcG::kLinear) {
        nOrder = 2;
      }

      abcTotalKnots = numControl + numCurves * (nOrder - 2);
    }

    if (abcTotalKnots != pKnotVec->size()) {
      ESS_LOG_ERROR("Knot vector has the wrong size. Cannot load curve.");
    }
  }

  return true;
}