44#include "DGtal/base/Common.h"
45#include "DGtal/helpers/StdDefs.h"
46#include "DGtal/io/viewers/Viewer3D.h"
58struct RandomPointKeyExtension :
public Viewer3D<Space, KSpace>::Extension
60 RandomPointKeyExtension()
70 const Qt::KeyboardModifiers modifiers =
event->modifiers();
71 if ( ( event->key() == Qt::Key_R ) && ( modifiers == Qt::ShiftModifier ) )
76 Point a( ( rand() % d[ 0 ] ) + p[ 0 ], ( rand() % d[ 1 ] ) + p[ 1 ],
77 ( rand() % d[ 2 ] ) + p[ 2 ] );
80 trace.
info() <<
"Adding point " << a << std::endl;
90 viewer.setKeyDescription( Qt::ShiftModifier + Qt::Key_R,
91 "Creates a random digital point." );
98 QString text(
"<h2> Random point Viewer3D </h2>" );
99 text +=
"Press Shift+R to add points.";
105int main(
int argc,
char ** argv )
108 QApplication application( argc, argv );
117 K.
init( p1, p2,
true );
124 viewer << p1 << p2 << p3;
127 return application.exec();
const KSpace & space() const
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
const Point & lowerBound() const
Return the lower bound for digital points in this space.
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
const Point & upperBound() const
Return the upper bound for digital points in this space.
virtual QString helpString() const
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
void setExtension(Extension *ext)
virtual void keyPressEvent(QKeyEvent *e)
DGtal is the top-level namespace which contains all DGtal functions and types.