/****************************************************************************
** GMAF - The Geometry Modeling Algorithms Framework
**
** Created : 04032000
**
** Copyright (C) 2000 by Le-Jeng Shiue.  All rights reserved.
**
****************************************************************************/
#include <assert.h>
#include <iostream>

#include "gmafPCCMQuad.h"

#include "gmafConfig.h"
#include "BlitzExtension/blitzConfig.h"

#include "Algorithm/CCSubdivision/gmafQuad.h"

gmafPCCMQuad::gmafPCCMQuad(gmafQuad* q)
  : gmafDataStructure(), mpQuad(q), 
    mPCCMControlNet(q->getHeight()+2, q->getWidth()+2) {
  mPCCMControlNet = 0;
  mValid = true;
}


gmafPCCMQuad::~gmafPCCMQuad() {
}

void gmafPCCMQuad::dump() {
#if 0  
//#ifdef _DEBUG
    // create the file for surfacer
    cout.precision(10);
    cout << "7 " << 3 << " " << 3 << endl;
    int numknots = mPCCMControlNet.rows()+4;
    cout << numknots;
    for (int k = 0; k < numknots; k++)
	cout << " " << mpKnots[k];
    cout << endl;
    cout << numknots;
    for (int k = 0; k < numknots; k++)
	cout << " " << mpKnots[k];
    cout << endl;
    DOUBLE* ctlpts = (mPCCMControlNet.data())->data();
    int numcp = mPCCMControlNet.size();
    for (int i = 0; i < numcp; i++) {
	cout << *ctlpts++ << " ";
	cout << *ctlpts++ << " ";
	cout << *ctlpts++ << endl;
    }

  /*
  std::cerr << "PCCMQuad" << std::endl;
  for (int i = 0; i < mPCCMControlNet.rows(); i++) {
    for (int j = 0; j < mPCCMControlNet.cols(); j++)
      std::cerr << mPCCMControlNet(i,j);
    std::cerr << std::endl;
  }
  */
  /*
  DOUBLE* v = (mPCCMControlNet.data())->data();
  std::cerr << "PCCMQuad (DOUBLE*)" << std::endl;
  for (int i = 0; i < mPCCMControlNet.rows(); i++) {
    for (int j = 0; j < mPCCMControlNet.cols(); j++) {
      std::cerr << "[" << *v++ << " " ;
      std::cerr << *v++ << " ";
      std::cerr << *v++ << "] ";
    }
    std::cerr << std::endl;
  }
  */
#endif _DEBUG
}

