ARX  1.0
The next-generation open source augmented reality toolkit.
Loading...
Searching...
No Matches
ARTrackable.h
Go to the documentation of this file.
1/*
2 * ARTrackable.h
3 * artoolkitX
4 *
5 * This file is part of artoolkitX.
6 *
7 * artoolkitX is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * artoolkitX is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with artoolkitX. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * As a special exception, the copyright holders of this library give you
21 * permission to link this library with independent modules to produce an
22 * executable, regardless of the license terms of these independent modules, and to
23 * copy and distribute the resulting executable under terms of your choice,
24 * provided that you also meet, for each linked independent module, the terms and
25 * conditions of the license of that module. An independent module is a module
26 * which is neither derived from nor based on this library. If you modify this
27 * library, you may extend this exception to your version of the library, but you
28 * are not obligated to do so. If you do not wish to do so, delete this exception
29 * statement from your version.
30 *
31 * Copyright 2018 Realmax, Inc.
32 * Copyright 2015 Daqri, LLC.
33 * Copyright 2010-2015 ARToolworks, Inc.
34 *
35 * Author(s): Julian Looser, Philip Lamb
36 *
37 */
38
39#ifndef ARTRACKABLE_H
40#define ARTRACKABLE_H
41
42#include <ARX/AR/ar.h>
44
45#include <vector>
46#include <utility>
47#include <atomic>
48
49#ifdef ARDOUBLE_IS_FLOAT
50# define _0_0 0.0f
51# define _1_0 1.0f
52#else
53# define _0_0 0.0
54# define _1_0 1.0
55#endif
56
57class ARController; // Forward declaration of owner.
58
63
64private:
66 ARdouble m_filterCutoffFrequency;
67 ARdouble m_filterSampleRate;
68
69protected:
71
73
74 static std::atomic<int> nextUID;
75
76public:
77
84 };
85
86 int UID;
87 static const int NO_ID = -1;
89
90 // Inputs from subclasses.
92 bool visible;
93
94 // Output.
97
102
103 ARTrackable(const ARTrackable&) = delete;
105
106 virtual ~ARTrackable();
107
110
118 virtual bool update(const ARdouble transL2R[3][4] = NULL);
119
120
121 virtual int getPatternCount() = 0;
122 virtual std::pair<float, float> getPatternSize(int patternIndex) = 0;
123 virtual std::pair<int, int> getPatternImageSize(int patternIndex, AR_MATRIX_CODE_TYPE matrixCodeType) = 0;
126 virtual bool getPatternTransform(int patternIndex, ARdouble T[16]) = 0;
127 virtual bool getPatternImage(int patternIndex, uint32_t *pattImageBuffer, AR_MATRIX_CODE_TYPE matrixCodeType) = 0;
128
129 // Filter control.
130 void setFiltered(bool flag);
131 bool isFiltered();
133 void setFilterSampleRate(ARdouble rate);
136
137};
138
139
140#endif // !ARTRACKABLE_H
artoolkitX core routines.
AR_MATRIX_CODE_TYPE
Values specifying the type of matrix code in use.
Definition: ar.h:320
double ARdouble
Definition: ar.h:99
Provides filtering of transformation matrices (pose estimates).
Wrapper for artoolkitX functionality.
Definition: ARController.h:80
Base class for supported trackable types.
Definition: ARTrackable.h:62
void setFilterSampleRate(ARdouble rate)
Definition: ARTrackable.cpp:157
int UID
Internal unique ID (note: not the same as artoolkitX pattern ID)
Definition: ARTrackable.h:86
ARdouble trans[3][4]
Transformation from camera to this trackable. If stereo, transform from left camera to this trackable...
Definition: ARTrackable.h:70
virtual std::pair< float, float > getPatternSize(int patternIndex)=0
static std::atomic< int > nextUID
Definition: ARTrackable.h:74
void setFiltered(bool flag)
Definition: ARTrackable.cpp:137
static const int NO_ID
Value of UID that indicates no ID.
Definition: ARTrackable.h:87
TrackableType type
Type of trackable: single, multi, ...
Definition: ARTrackable.h:88
bool visible
Whether or not the trackable is visible at current time.
Definition: ARTrackable.h:92
virtual bool update(const ARdouble transL2R[3][4]=NULL)
Completes an update begun in the parent class, performing filtering, generating OpenGL view matrix an...
Definition: ARTrackable.cpp:90
ARdouble positionScalefactor()
Definition: ARTrackable.cpp:85
ARTrackable & operator=(const ARTrackable &)=delete
Copy assignment is undefined.
ARdouble transformationMatrixR[16]
Transformation suitable for use in OpenGL.
Definition: ARTrackable.h:96
bool isFiltered()
Definition: ARTrackable.cpp:147
ARdouble m_positionScaleFactor
Definition: ARTrackable.h:72
virtual int getPatternCount()=0
virtual bool getPatternImage(int patternIndex, uint32_t *pattImageBuffer, AR_MATRIX_CODE_TYPE matrixCodeType)=0
virtual bool getPatternTransform(int patternIndex, ARdouble T[16])=0
Get the transform, relative to this trackable's origin, of this pattern.
ARdouble transformationMatrix[16]
Transformation suitable for use in OpenGL.
Definition: ARTrackable.h:95
ARdouble filterSampleRate()
Definition: ARTrackable.cpp:152
void setPositionScalefactor(ARdouble scale)
Definition: ARTrackable.cpp:80
virtual std::pair< int, int > getPatternImageSize(int patternIndex, AR_MATRIX_CODE_TYPE matrixCodeType)=0
ARTrackable(const ARTrackable &)=delete
Copy construction is undefined.
ARdouble filterCutoffFrequency()
Definition: ARTrackable.cpp:163
void setFilterCutoffFrequency(ARdouble freq)
Definition: ARTrackable.cpp:168
bool visiblePrev
Whether or not the trackable was visible prior to last update.
Definition: ARTrackable.h:91
virtual ~ARTrackable()
Definition: ARTrackable.cpp:75
TrackableType
Definition: ARTrackable.h:78
@ TwoD
A 2D textured marker backed by an image.
Definition: ARTrackable.h:82
@ SINGLE
A standard single square marker.
Definition: ARTrackable.h:79
@ NFT
A rectangular textured marker backed by an NFT data set.
Definition: ARTrackable.h:81
@ MULTI
A composite marker made up of multiple square markers.
Definition: ARTrackable.h:80
@ MULTI_AUTO
An automatically mapped composite marker made up of multiple square matrix (2D barcode) markers.
Definition: ARTrackable.h:83
Definition: arFilterTransMat.c:41