00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkSpherePuzzle.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00042 #ifndef __vtkSpherePuzzle_h 00043 #define __vtkSpherePuzzle_h 00044 00045 #include "vtkPolyDataSource.h" 00046 00047 #define VTK_MAX_SPHERE_RESOLUTION 1024 00048 00049 class vtkTransform; 00050 00051 class VTK_EXPORT vtkSpherePuzzle : public vtkPolyDataSource 00052 { 00053 public: 00054 vtkTypeRevisionMacro(vtkSpherePuzzle,vtkPolyDataSource); 00055 void PrintSelf(ostream& os, vtkIndent indent); 00056 00057 static vtkSpherePuzzle *New(); 00058 00060 void Reset(); 00061 00063 void MoveHorizontal(int section, int percentage, int rightFlag); 00064 00066 void MoveVertical(int section, int percentage, int rightFlag); 00067 00073 int SetPoint(float x, float y, float z); 00074 00078 void MovePoint(int percentage); 00079 00081 int *GetState() {return this->State;} 00082 00083 protected: 00084 vtkSpherePuzzle(); 00085 ~vtkSpherePuzzle(); 00086 00087 void Execute(); 00088 void MarkVertical(int section); 00089 void MarkHorizontal(int section); 00090 00091 int State[32]; 00092 00093 // Stuff for storing a partial move. 00094 int PieceMask[32]; 00095 vtkTransform *Transform; 00096 00097 // Colors for faces. 00098 unsigned char Colors[96]; 00099 00100 // State for potential move. 00101 int Active; 00102 int VerticalFlag; 00103 int RightFlag; 00104 int Section; 00105 00106 private: 00107 vtkSpherePuzzle(const vtkSpherePuzzle&); // Not implemented 00108 void operator=(const vtkSpherePuzzle&); // Not implemented 00109 }; 00110 00111 #endif 00112 00113