Developer Documentation
ICPPlugin.hh
1/*===========================================================================*\
2* *
3* OpenFlipper *
4 * Copyright (c) 2020, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39* *
40\*===========================================================================*/
41
42#pragma once
43
44
45#include <QSpinBox>
46
54#include <Eigen/Dense>
55#include <Eigen/Eigenvalues>
56#include <algorithm>
57#include "ICPToolbarWidget.hh"
58#include "VertexList.hh"
59#include <ACG/Geometry/Algorithms.hh>
61
64
66 int maxIterations_;
67 double errorThreshold_; //mse
68 double distanceThreshold_; //units
69 double normalDotThreshold_; //% (eg. 56.3 for 56.3%)
70 bool debugOutput_;
71 bool doResize_;
72 bool interpolateNormals_;
73};
74
75typedef struct ICPParameter ICPParameter;
76
77struct ICPContext {
78 TriMesh* sourceMesh_;
79 TriMesh* targetMesh_;
80 TriMeshObject* sourceObject_;
81 TriMeshObject* targetObject_;
82 int sourceID_;
83 int targetID_;
84 ICPParameters* params_;
85};
86
87typedef struct ICPContext ICPContext;
88
90{
91 Q_OBJECT
92 Q_INTERFACES(BaseInterface)
93 Q_INTERFACES(ToolboxInterface)
94 Q_INTERFACES(LoggingInterface)
95 Q_INTERFACES(ScriptInterface)
96 Q_INTERFACES(LoadSaveInterface)
97 Q_INTERFACES(BackupInterface)
98 Q_INTERFACES(PythonInterface)
99
100 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-ICP")
101
102 signals:
103 //BaseInterface
104 void updateView();
105 void updatedObject(int _id, const UpdateType& _type);
106
107 //LoggingInterface
108 void log(Logtype _type, QString _message);
109 void log(QString _message);
110
111 // ToolboxInterface
112 void addToolbox( QString _name , QWidget* _widget, QIcon* _icon);
113
114 // ScriptInterface
115 void scriptInfo(QString _functionName);
116
117 // BackupInterface
118 void createBackup( int _id , QString _name, UpdateType _type = UPDATE_ALL );
119
120 // LoadSaveInterface
121 void addEmptyObject( DataType _type, int& _id);
122 void deleteObject(int _id);
123 void deleteAllObjects();
124
125 private:
126 ICPToolbarWidget* tool_;
127 QIcon* toolIcon_;
128
129
130 public:
131
132 ICPPlugin();
133 ~ICPPlugin();
134
135 // BaseInterface
136 QString name() { return (QString("ICP")); }
137 QString description( ) { return (QString("Implementation of the ICP algorithm")); }
138
139 private:
140
141 private slots:
142 void initializePlugin(); // BaseInterface
143
144 void pluginsInitialized(); // BaseInterface
145
150 void toolbarICP();
151
152 // Scriptable functions
153 public slots:
154
159 void icp(int _maxIterations, double _errorThreshold, double _distanceThreshold, double _normalDotThreshold, bool _debugOutput, bool _doResize, bool _interpolateNormals, int _sourceObjectID, int _targetObjectID);
160
163 void doICP(ICPContext* _context);
164
165 QString version() { return QString("1.0"); }
166};
167
Logtype
Log types for Message Window.
Interface class for backup handling.
Interface class from which all plugins have to be created.
Predefined datatypes.
Definition: DataTypes.hh:83
QString description()
Return a description of what the plugin is doing.
Definition: ICPPlugin.hh:137
QString name()
Return a name for the plugin.
Definition: ICPPlugin.hh:136
void toolbarICP()
Definition: ICPPlugin.cc:686
void icp(int _maxIterations, double _errorThreshold, double _distanceThreshold, double _normalDotThreshold, bool _debugOutput, bool _doResize, bool _interpolateNormals, int _sourceObjectID, int _targetObjectID)
Definition: ICPPlugin.cc:658
void doICP(ICPContext *_context)
Definition: ICPPlugin.cc:576
Interface for all plugins which want to Load or Save files and create Objects.
Interface for all Plugins which do logging to the logging window of the framework.
Interface class for exporting functions to python.
Interface for all Plugins which provide scriptable Functions.
Plugins can add its own toolbox to the main widget's toolbox area by using this interface.
Type for a MeshObject containing a triangle mesh.
Definition: TriangleMesh.hh:67
Update type class.
Definition: UpdateType.hh:59
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.