Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
alta
alta
Commits
77e15f1c
Commit
77e15f1c
authored
Nov 04, 2013
by
Laurent Belcour
Browse files
The interpolant data loader seems to work
parent
78de3dc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
sources/plugins/data_interpolant/data.cpp
View file @
77e15f1c
...
...
@@ -33,17 +33,17 @@ void data_interpolant::load(const std::string& filename)
setMin
(
_data
->
min
());
setMax
(
_data
->
max
());
std
::
cout
<<
" "
<<
_kdtree
->
veclen
()
<<
std
::
endl
;
// Update the KDtreee by inserting all points
flann
::
Matrix
<
double
>
pts
(
new
double
[
dimX
()
*
_data
->
size
()],
_data
->
size
(),
dimX
());
for
(
int
i
=
0
;
i
<
_data
->
size
();
++
i
)
{
vec
x
=
_data
->
get
(
i
);
flann
::
Matrix
<
double
>
pts
(
&
x
[
0
],
dimX
(),
1
);
_kdtree
->
addPoints
(
pts
);
memcpy
(
pts
[
i
],
&
x
[
0
],
dimX
()
*
sizeof
(
double
));
}
_kdtree
->
buildIndex
();
_kdtree
->
buildIndex
(
pts
);
std
::
cout
<<
" "
<<
_kdtree
->
veclen
()
<<
std
::
endl
;
}
void
data_interpolant
::
load
(
const
std
::
string
&
filename
,
const
arguments
&
)
{
...
...
@@ -82,7 +82,7 @@ vec data_interpolant::value(vec x) const
vec
res
=
vec
::
Zero
(
dimY
());
// Query point
flann
::
Matrix
<
double
>
pts
(
&
x
[
0
],
dimX
()
,
1
);
flann
::
Matrix
<
double
>
pts
(
&
x
[
0
],
1
,
dimX
());
std
::
vector
<
std
::
vector
<
int
>
>
indices
;
std
::
vector
<
std
::
vector
<
double
>
>
dists
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment