Interactive Symmetry Generator User's Manual

Michael Wittman

User Interface

With the description given in the Interactive Symmetry Generator main page, the user interface should be fairly easy to understand, so I won't go into it here.

Quick Start

To use the symmetry classes in your program, do the following:
In your CWorld::LoadObjects() function:
  1. Create an instance of a symmetry class (say, pCSymmetry)
  2. do pCSymmetry->Init();
  3. before InsertCObject(m_pRoot), do pCSymmetry->SetObject(m_pRoot); m_pRoot = pCSymmetry;
In your CAppGL::InitTclModules() function add this code:
  if ( CGlideSymmetryUI::CreateOotClass(pInterp) == TCL_ERROR )
    {
      return TCL_ERROR;
    }

  if ( CRotationalSymmetryUI::CreateOotClass(pInterp) == TCL_ERROR )
    {
      return TCL_ERROR;
    }

Classes

Here are the parts of each class that are relevant to the user.

class CSymmetry : public CObject
{
public:
  CSymmetry();
  virtual ~CSymmetry();
  virtual BOOL Init();
  virtual VOID Uninit();

public:
  virtual VOID Render();

  virtual VOID DrawObject();
  virtual VOID DrawEdges();
  virtual VOID DrawVertices();
  virtual VOID DrawNormals();

  // set and get the object to be the subject of symmetry operations
  inline VOID SetObject(CObject *obj);
  inline CObject *GetObject();

  // checks whether we want to draw a "DrawRegion," which is the reference
  // region for what is replicated (for help in interactive designing)
  inline VOID SetDrawRegion(BOOL draw);
  inline BOOL GetDrawRegion();

  // set the origin and scaling to some other values to handle off-center data
  // and expand/shrink the DrawRegion
  inline VOID SetOrigin(const Vector &v);
  inline VOID SetScale(const Vector &v);

public:
  virtual BOOL GetChanged();
};

class CGlideSymmetry : public CSymmetry
{
public:
  CGlideSymmetry();
  virtual ~CGlideSymmetry();
  virtual BOOL Init();
  virtual VOID Uninit();

  // set and get rotations
  inline VOID SetRotation1(FLOAT theta, const Vector &v);
  inline VOID SetRotation2(FLOAT theta, const Vector &v);
  inline VOID SetRotation3(FLOAT theta, const Vector &v);
  inline VOID GetRotation1(FLOAT &theta, Vector &v);
  inline VOID GetRotation2(FLOAT &theta, Vector &v);
  inline VOID GetRotation3(FLOAT &theta, Vector &v);

  // set and get vectors
  inline VOID SetVector1(const Vector &v);
  inline VOID SetVector2(const Vector &v);
  inline VOID SetVector3(const Vector &v);
  inline VOID GetVector1(Vector &v);
  inline VOID GetVector2(Vector &v);
  inline VOID GetVector3(Vector &v);

  // set and get extents
  inline VOID SetExtent1(UINT_32 e);
  inline VOID SetExtent2(UINT_32 e);
  inline VOID SetExtent3(UINT_32 e);
  inline VOID GetExtent1(UINT_32 &e);
  inline VOID GetExtent2(UINT_32 &e);
  inline VOID GetExtent3(UINT_32 &e);
};

class CRotationalSymmetry : public CSymmetry
{
public:
  CRotationalSymmetry();
  virtual ~CRotationalSymmetry();
  virtual BOOL Init();
  virtual VOID Uninit();

public:
  // 3D symmetry groups
  enum Group { Cn, Dn, S2n, Dnd, Cnh, Cnv, Dnh,
	       OTetra, ODoubleTetra, Tetra, OOcta, Octa, OIcosa, Icosa,
	       ODodeca, Dodeca }; 
   
  // set and get symmetry group
  inline VOID SetSymmetryGroup(Group g, UINT_32 n = 1);
  VOID GetSymmetryGroup(Group &g, UINT_32 &n);
  VOID GetSymmetryGroup(Group &g);
};


wittman@cs.berkeley.edu