/*==================================================================

  Program:   View Generation Toolkit
  Module:    viewpoints.h
  Language:  C++
  Date:      2002/05/27
  Version:   1.0

===================================================================*/

#ifndef __VIEWPOINTS_H__
#define __VIEWPOINTS_H__


// The following class is the collection of views about a
// sphere in a spherical coordinates (phi, theta).
//
class CViewPoints
{
 protected:
  // Array containing spherical coordinates of the view
  //
  int num;
  float* phi; float* theta;
  int mLevel;

 public:

  // Initializes the points about the sphere
  //
  CViewPoints();
  CViewPoints(int n);
  ~CViewPoints();

  float Phi(int ind);
  float Theta(int ind);

  // Returns the number of points in the collection
  int Size();

  // Returns the level number
  int Level();

  // Returns the pointer to the index list of neightbours.
  // All neighbours within range are returned. The range is 
  // an angle in degrees. The list requires deletion. 
  // Returns NULL if error occured
  //
  virtual int* GetNeighbours(int ind, double range, int& n);

  // Returns the pointer to the index list of neightbours.
  // n closest neighbours are returned, The list requires 
  // deletion. Returns NULL if error occured
  //
  virtual int* GetNeighbours(int ind, int n);
  
  // Computes the view points about a sphere
  //
  virtual void ComputePoints() {};
protected:
  // Allocates memory for points 
  // Remark: There is no check to see if memory alreafy allocated
  void AllocatePoints(int n);

  // Sends the exception and destroys the class
  void Abort();
};

// This is a derived class from CViewPoints that manages 
// the points on a sphere obtained by splitting octahedron
class COctahedronPoints : public CViewPoints
{
public:
  COctahedronPoints(int n);

  void ComputePoints();
};


#endif
