DGtal  1.5.beta
testDisplayKSCell.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/io/viewers/Viewer3D.h"
Include dependency graph for testDisplayKSCell.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Bertrand Kerautret (kerau.nosp@m.tre@.nosp@m.loria.nosp@m..fr ) LORIA (CNRS, UMR 7503), University of Nancy, France
Date
2011/05/30

Functions for testing class DisplayKSCell.

This file is part of the DGtal library.

Definition in file testDisplayKSCell.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 55 of file testDisplayKSCell.cpp.

56 {
57 
58  QApplication application(argc,argv);
59 
60 
61  KSpace K;
62  Point plow(0,0,0);
63  Point pup(3,3,2);
64  Domain domain( plow, pup );
65  K.init( plow, pup, true );
66 
67  Viewer3D<Space, KSpace> viewer(K);
68  viewer.show();
69  trace.beginBlock ( "Testing display KSCell in Viewer 3D" );
70  //viewer << SetMode3D( domain.className(), "Paving" );
71  // if the domain is visible can't see the cubes inside
72  // viewer << domain;
73 
74 
75  // Drawing cell of dimension 3
76  Cell voxelA = K.uCell(Point(1, 1, 1));
77  SCell voxelB = K.sCell(Point(1, 1, 3));
78  viewer << voxelB<< voxelA;//
79 
80  // drawing cells of dimension 2
81  SCell surfelA = K.sCell( Point( 2, 1, 3 ) );
82  SCell surfelB = K.sCell( Point( 1, 0, 1 ), false );
83  Cell surfelC = K.uCell( Point( 1, 2, 1 ) );
84  SCell surfelD = K.sCell( Point( 1, 1, 0 ) );
85  Cell surfelE = K.uCell( Point( 1, 1, 2 ) );
86  viewer << surfelA << surfelB << surfelC << surfelD << surfelE;
87 
88  Cell linelA = K.uCell(Point(2, 1 ,2));
89  SCell linelB = K.sCell(Point(2, 2 ,1));
90  SCell linelC = K.sCell(Point(1, 2 ,2), false);
91  viewer << linelA << linelB << linelC;
92 
93 
94  Cell center = K.uCell(Point(5,5,5));
95 // Testing display of oriented surfels:
96  SCell ssurfelXZ = K.sCell( Point( 5, 6, 5 ), false );
97  SCell ssurfelXY = K.sCell( Point( 5, 5, 6 ), false );
98  SCell ssurfelZY = K.sCell( Point( 6, 5, 5 ), false );
99  viewer<< center;
100 
101  SCell ssurfelXZo = K.sCell( Point( 5, 4, 5 ), false );
102  SCell ssurfelXYo = K.sCell( Point( 5, 5, 4 ), false );
103  SCell ssurfelZYo = K.sCell( Point( 4, 5, 5 ), false );
104 
105  viewer << ssurfelXZ << ssurfelXY << ssurfelZY;
106  viewer << ssurfelXZo << ssurfelXYo << ssurfelZYo;
107 
108  // Testing display oriented pointels
109  Cell pointelA = K.uCell(Point(2, 2, 2));
110  SCell pointelB = K.sCell(Point(4, 4, 4), true);
111  SCell pointelC = K.sCell(Point(6, 4, 4), false);
112  SCell linelAC = K.sCell(Point(5, 4, 4), false);
113  viewer << pointelA << pointelB << pointelC << linelAC;
114 
115  viewer << Viewer3D<>::updateDisplay;
116 
117  bool res = application.exec();
118  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
119  trace.endBlock();
120  return res ? 0 : 1;
121 }
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
SCell sCell(const SPreCell &c) const
From a signed cell, returns a signed cell lying into this Khalismky space.
Cell uCell(const PreCell &c) const
From an unsigned cell, returns an unsigned cell lying into this Khalismky space.
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
double endBlock()
Point center(const std::vector< Point > &points)
Trace trace
Definition: Common.h:153
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
MyPointD Point
Definition: testClone2.cpp:383
KSpace K
Domain domain

References DGtal::Trace::beginBlock(), domain, DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, DGtal::KhalimskySpaceND< dim, TInteger >::sCell(), DGtal::Viewer3D< TSpace, TKSpace >::show(), DGtal::trace, and DGtal::KhalimskySpaceND< dim, TInteger >::uCell().