test-cube.cc

Construct a topological cube using Euler operators.

Geometrically, the constructed cube collapses to a single point, because All vertices are assigned to the same coords(1,1,1); to form a real cube, assign different pnt apropriately at each operation.

See conclass-cube.jpg for an illustration of the conclassion process

construct-cube.jpg

Author:
Xianming Chen
Computer Science Department
University of Utah
Date:
16 Aug 2006
Copyright (c) 2006, University of Utah
00001 /**
00002  *\file         test-cube.cc
00003  *
00004  *\brief        Construct a topological cube directly using Euler operators
00005  *. 
00006  *\example      test-cube.cc
00007  *
00008  *              Construct a topological cube using Euler operators. 
00009  *
00010  *              Geometrically, the constructed cube collapses to a single point, because 
00011  *              All vertices are assigned to the same coords(1,1,1);
00012  *              to form a real cube, assign different pnt apropriately at each operation.
00013  *
00014  *              See conclass-cube.jpg for an illustration of the conclassion process
00015  *
00016  *\image        html construct-cube.jpg
00017  *
00018  *\author       Xianming Chen\n
00019  *              Computer Science Department\n
00020  *              University of Utah
00021  *
00022  *\date          16 Aug 2006\n
00023  *              Copyright (c) 2006, University of Utah
00024  */
00025 
00026 
00027 #include "print.h"
00028 using namespace std;
00029 using namespace euler;
00030 
00031 
00032 int main()
00033 {
00034   point_t p(1.,1.,1.);  // geometrically collapsed to one pnt.
00035 
00036   /* 
00037    * intialize to skeletal cube: 
00038    * topology = 1 0d-cell + 1 2d-cells
00039    */
00040   solid_t *s = solid_t :: mvfs(p);
00041   loop_t *l = s->f->l;   // singular loop: 0
00042   cerr << s << endl;
00043   
00044   /* 
00045    * add 3 consecutive dangling edges to form an open square:
00046    * topology = 4 0d-cell + 3 1d-cells + 1 2d-cell          
00047    */
00048   l->mev( l->mev( l->mev( l->f->l->e, p ), p ), p );
00049   l->del_single_vertex_edge_pair();      // loop = 0 1 2 3 2 1
00050   cerr << l << endl;   
00051   
00052 
00053   /*
00054    * close the open square by splitting the loop
00055    * topology = 2 2d-cells (faces) + 4 1d-cells (edges) + 4 0d-cells (vertices)
00056    */
00057   s->mef(l->e, l->e->nxt->nxt->nxt);    // new loop: 3 0 1 2  (top cube face), old loop l= 0 3 2 1
00058   cerr << s << endl;                   
00059   cerr << l << endl;                   
00060 
00061   
00062   /*
00063    * next, add a dangling edge to each vertex of the square
00064    */
00065   edge_t
00066     *e03 = l->e,
00067     *e10 = e03->pre,
00068     *e21 = e10->pre,
00069     *e32 = e21->pre;
00070 
00071   l->mev(e03, p);
00072 
00073   l->mev(e10, p);
00074 
00075   l->mev(e21, p);
00076   l->mev(e32, p);   // now: 0 3 7 3 2 6 2 1 5 1 0 4
00077   cerr << s << endl;
00078   cerr << l << endl;
00079 
00080   /*
00081    * close the 4 opening squares to form the cube
00082    */
00083   edge_t
00084     *e40 = l->e->pre,
00085     *e73 = l->e->nxt->nxt,
00086     *e62 = e73->nxt->nxt->nxt,
00087     *e51 = e62->nxt->nxt->nxt;
00088     
00089   s->mef(e40, e73);
00090   s->mef(e73, e62);
00091   s->mef(e62, e51);
00092   s->mef(e51, e51->nxt->nxt->nxt);
00093 
00094   cerr << s << endl;
00095 }
00096 
00097 
00098 
00099 

Generated on Wed Aug 30 16:27:58 2006 for euler by  doxygen 1.4.6