Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alta
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alta
alta
Commits
10076200
Commit
10076200
authored
Feb 09, 2015
by
Laurent Belcour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating the interface of data to incorporate an index based set function.
parent
ec2f94ea
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
115 additions
and
54 deletions
+115
-54
sources/core/common.h
sources/core/common.h
+1
-1
sources/core/data.h
sources/core/data.h
+16
-21
sources/core/params.h
sources/core/params.h
+6
-0
sources/core/vertical_segment.cpp
sources/core/vertical_segment.cpp
+7
-1
sources/core/vertical_segment.h
sources/core/vertical_segment.h
+5
-7
sources/plugins/SConscript
sources/plugins/SConscript
+2
-0
sources/plugins/data_astm/data.cpp
sources/plugins/data_astm/data.cpp
+1
-1
sources/plugins/data_astm/data.h
sources/plugins/data_astm/data.h
+1
-1
sources/plugins/data_brdf_slice/EXR_IO.h
sources/plugins/data_brdf_slice/EXR_IO.h
+4
-0
sources/plugins/data_brdf_slice/data.cpp
sources/plugins/data_brdf_slice/data.cpp
+9
-6
sources/plugins/data_brdf_slice/data.h
sources/plugins/data_brdf_slice/data.h
+3
-3
sources/plugins/data_merl/data.cpp
sources/plugins/data_merl/data.cpp
+11
-3
sources/plugins/data_merl/data.h
sources/plugins/data_merl/data.h
+5
-4
sources/python/alta.cpp
sources/python/alta.cpp
+1
-1
sources/softs/SConscript
sources/softs/SConscript
+3
-1
sources/softs/brdf2data/main.cpp
sources/softs/brdf2data/main.cpp
+14
-4
sources/softs/tests/main.cpp
sources/softs/tests/main.cpp
+26
-0
No files found.
sources/core/common.h
View file @
10076200
...
...
@@ -281,7 +281,7 @@ throw
// Mathematical definition not provided on the Window plateform
#ifdef _WIN32
#define M_PI 3.14159265
#define M_PI 3.14159265
35897932384626433832795
template
<
typename
T
>
bool
isnan
(
T
x
)
{
...
...
sources/core/data.h
View file @
10076200
...
...
@@ -58,25 +58,19 @@ class data : public parametrized
// Acces to data
virtual
vec
get
(
int
i
)
const
=
0
;
virtual
vec
operator
[](
int
i
)
const
=
0
;
/*
//! \brief Provide an evaluation in a BRDF way of the data.
//!
//! \details
//! The input vector in (can have texture coordinate) and the output
//! vector out are taken to grab a value and return it. The two vectors
//! should be compliant with the size and parametrization of the data.
virtual vec value(vec in, vec out) const = 0;
*/
//! \brief Provide an evaluation in a BRDF way of the data.
//! \brief Provide an evaluation of the data using interpolation. If
//! the data object does not provide an interpolation mechanism, it
//! should throw an exception.
//!
//! \details
//! The input vector must have the parametrization of the data.
virtual
vec
value
(
vec
in
)
const
=
0
;
//! The input vector must have the parametrization of the data, and
//! match the total dimension: dimX + dimY.
virtual
vec
value
(
const
vec
&
in
)
const
=
0
;
//! \brief Put the sample inside the data
virtual
void
set
(
vec
x
)
=
0
;
virtual
void
set
(
const
vec
&
x
)
=
0
;
virtual
void
set
(
int
i
,
const
vec
&
x
)
=
0
;
// Get data size, e.g. the number of samples to fit
...
...
@@ -130,11 +124,7 @@ class data_params : public data
save
(
std
::
string
(
"cluster.gnuplot"
));
}
virtual
vec
value
(
vec
,
vec
)
const
{
NOT_IMPLEMENTED
();
}
virtual
vec
value
(
vec
)
const
virtual
vec
value
(
const
vec
&
)
const
{
NOT_IMPLEMENTED
();
}
...
...
@@ -163,11 +153,16 @@ class data_params : public data
}
//! \todo This should crash at execution.
virtual
void
set
(
vec
x
)
virtual
void
set
(
const
vec
&
x
)
{
this
->
set
(
x
);
}
virtual
void
set
(
int
i
,
const
vec
&
x
)
{
this
->
set
(
i
,
x
);
}
// Get data size, e.g. the number of samples to fit
virtual
int
size
()
const
{
...
...
sources/core/params.h
View file @
10076200
...
...
@@ -369,6 +369,12 @@ class params
class
parametrized
{
public:
parametrized
(
params
::
input
in_param
,
params
::
output
out_param
)
{
_in_param
=
in_param
;
_out_param
=
out_param
;
_nX
=
params
::
dimension
(
_in_param
);
_nY
=
params
::
dimension
(
_out_param
);
}
parametrized
()
:
_in_param
(
params
::
UNKNOWN_INPUT
),
_out_param
(
params
::
UNKNOWN_OUTPUT
)
{
}
...
...
sources/core/vertical_segment.cpp
View file @
10076200
...
...
@@ -286,12 +286,18 @@ vec vertical_segment::get(int i) const
//! \todo Check the vertical segment size and if the data
//! is not already present.
void
vertical_segment
::
set
(
vec
x
)
void
vertical_segment
::
set
(
const
vec
&
x
)
{
// assert(x.size() == dimX() + dimY() || x.size() == dimX() + 3*dimY());
_data
.
push_back
(
x
);
}
void
vertical_segment
::
set
(
int
i
,
const
vec
&
x
)
{
// assert(x.size() == dimX() + dimY() || x.size() == dimX() + 3*dimY());
_data
[
i
]
=
x
;
}
int
vertical_segment
::
size
()
const
{
return
_data
.
size
()
;
...
...
sources/core/vertical_segment.h
View file @
10076200
...
...
@@ -90,18 +90,16 @@ class vertical_segment : public data
// Acces to data
virtual
vec
get
(
int
i
)
const
;
virtual
vec
operator
[](
int
i
)
const
;
virtual
vec
value
(
vec
,
vec
)
const
{
NOT_IMPLEMENTED
();
}
virtual
vec
value
(
vec
)
const
virtual
vec
operator
[](
int
i
)
const
;
virtual
vec
value
(
const
vec
&
)
const
{
NOT_IMPLEMENTED
();
}
//! \brief Put the sample inside the data
virtual
void
set
(
vec
x
);
virtual
void
set
(
const
vec
&
x
);
virtual
void
set
(
int
i
,
const
vec
&
x
);
//! \brief Specific accessor to a vertical segment, this gives the
//! complete vector, plus the ordinate segment
...
...
sources/plugins/SConscript
View file @
10076200
...
...
@@ -2,6 +2,7 @@
SConscript
(
'data_merl/SConscript'
)
SConscript
(
'data_brdf_slice/SConscript'
)
SConscript
(
'data_interpolant/SConscript'
)
#SConscript('data_io/SConscript')
# # Building nonlinear fitters
SConscript
(
'nonlinear_fitter_ceres/SConscript'
)
...
...
@@ -31,6 +32,7 @@ SConscript('rational_fitter_leastsquare/SConscript')
SConscript
(
'rational_fitter_quadprog/SConscript'
)
SConscript
(
'rational_fitter_parallel/SConscript'
)
SConscript
(
'rational_fitter_matlab/SConscript'
)
SConscript
(
'rational_fitters/SConscript'
)
# # Building rational functions
...
...
sources/plugins/data_astm/data.cpp
View file @
10076200
...
...
@@ -66,7 +66,7 @@ void data_astm::load(const std::string& filename, const arguments& args)
}
// Acces to data
vec
data_astm
::
get
(
int
i
)
const
vec
&
data_astm
::
get
(
int
i
)
{
return
_data
[
i
];
}
...
...
sources/plugins/data_astm/data.h
View file @
10076200
...
...
@@ -28,7 +28,7 @@ class data_astm : public QObject, public data
// Acces to data
virtual
vec
get
(
int
i
)
const
;
virtual
vec
operator
[](
int
i
)
const
;
virtual
vec
&
operator
[](
int
i
)
;
virtual
vec
value
(
vec
in
,
vec
out
)
const
;
// Get data size, e.g. the number of samples to fit
...
...
sources/plugins/data_brdf_slice/EXR_IO.h
View file @
10076200
...
...
@@ -10,6 +10,10 @@
#ifndef EXR_IO_H_
#define EXR_IO_H_
/*
* Author: Cyril Soler
*/
#include <stdexcept>
...
...
sources/plugins/data_brdf_slice/data.cpp
View file @
10076200
...
...
@@ -78,7 +78,7 @@ vec data_brdf_slice::operator[](int i) const
}
//! \todo Test this function
void
data_brdf_slice
::
set
(
vec
x
)
void
data_brdf_slice
::
set
(
const
vec
&
x
)
{
assert
(
x
.
size
()
==
6
);
assert
(
x
[
0
]
<=
0.5
*
M_PI
&&
x
[
0
]
>=
0.0
);
...
...
@@ -93,13 +93,16 @@ void data_brdf_slice::set(vec x)
_data
[
3
*
id
+
1
]
=
x
[
4
];
_data
[
3
*
id
+
2
]
=
x
[
5
];
}
vec
data_brdf_slice
::
value
(
vec
,
vec
)
const
void
data_brdf_slice
::
set
(
int
id
,
const
vec
&
x
)
{
vec
res
(
3
);
return
res
;
assert
(
x
.
size
()
==
3
);
_data
[
3
*
id
+
0
]
=
x
[
0
];
_data
[
3
*
id
+
1
]
=
x
[
1
];
_data
[
3
*
id
+
2
]
=
x
[
2
];
}
vec
data_brdf_slice
::
value
(
vec
x
)
const
vec
data_brdf_slice
::
value
(
const
vec
&
x
)
const
{
assert
(
x
[
0
]
<=
0.5
*
M_PI
&&
x
[
0
]
>=
0.0
);
assert
(
x
[
1
]
<=
0.5
*
M_PI
&&
x
[
1
]
>=
0.0
);
...
...
sources/plugins/data_brdf_slice/data.h
View file @
10076200
...
...
@@ -31,11 +31,11 @@ class data_brdf_slice : public data
virtual
vec
get
(
int
i
)
const
;
virtual
vec
operator
[](
int
i
)
const
;
virtual
vec
value
(
vec
in
,
vec
out
)
const
;
virtual
vec
value
(
vec
x
)
const
;
virtual
vec
value
(
const
vec
&
x
)
const
;
// Set data
virtual
void
set
(
vec
x
);
virtual
void
set
(
int
i
,
const
vec
&
x
);
virtual
void
set
(
const
vec
&
x
);
// Get data size, e.g. the number of samples to fit
virtual
int
size
()
const
;
...
...
sources/plugins/data_merl/data.cpp
View file @
10076200
...
...
@@ -342,13 +342,13 @@ vec data_merl::get(int i) const
res
[
5
]
=
brdf
[
i
+
BRDF_SAMPLING_RES_THETA_H
*
BRDF_SAMPLING_RES_THETA_D
*
BRDF_SAMPLING_RES_PHI_D
]
*
BLUE_SCALE
;
return
res
;
}
vec
data_merl
::
operator
[](
int
i
)
const
vec
data_merl
::
operator
[](
int
i
)
const
{
return
get
(
i
)
;
}
//! \todo Test this function
void
data_merl
::
set
(
vec
x
)
void
data_merl
::
set
(
const
vec
&
x
)
{
assert
(
x
.
size
()
==
6
);
const
int
phid_ind
=
phi_diff_index
(
x
[
2
]);
...
...
@@ -366,7 +366,15 @@ void data_merl::set(vec x)
brdf
[
i
+
BRDF_SAMPLING_RES_THETA_H
*
BRDF_SAMPLING_RES_THETA_D
*
BRDF_SAMPLING_RES_PHI_D
]
=
x
[
5
]
/
BLUE_SCALE
;
}
vec
data_merl
::
value
(
vec
in
)
const
void
data_merl
::
set
(
int
i
,
const
vec
&
x
)
{
assert
(
x
.
size
()
==
3
);
brdf
[
i
]
=
x
[
0
]
/
RED_SCALE
;
brdf
[
i
+
BRDF_SAMPLING_RES_THETA_H
*
BRDF_SAMPLING_RES_THETA_D
*
BRDF_SAMPLING_RES_PHI_D
/
2
]
=
x
[
1
]
/
GREEN_SCALE
;
brdf
[
i
+
BRDF_SAMPLING_RES_THETA_H
*
BRDF_SAMPLING_RES_THETA_D
*
BRDF_SAMPLING_RES_PHI_D
]
=
x
[
2
]
/
BLUE_SCALE
;
}
vec
data_merl
::
value
(
const
vec
&
in
)
const
{
double
r
,
g
,
b
;
lookup_brdf_val
(
brdf
,
in
[
0
],
in
[
1
],
in
[
2
],
r
,
g
,
b
)
;
...
...
sources/plugins/data_merl/data.h
View file @
10076200
...
...
@@ -27,13 +27,14 @@ class data_merl : public data
virtual
void
save
(
const
std
::
string
&
filename
)
const
;
// Acces to data
virtual
vec
get
(
int
i
)
const
;
virtual
vec
operator
[](
int
i
)
const
;
virtual
vec
get
(
int
i
)
const
;
virtual
vec
operator
[](
int
i
)
const
;
virtual
vec
value
(
vec
in
)
const
;
virtual
vec
value
(
const
vec
&
in
)
const
;
// Set data
virtual
void
set
(
vec
x
);
virtual
void
set
(
int
i
,
const
vec
&
x
);
virtual
void
set
(
const
vec
&
x
);
// Get data size, e.g. the number of samples to fit
virtual
int
size
()
const
;
...
...
sources/python/alta.cpp
View file @
10076200
...
...
@@ -155,7 +155,7 @@ BOOST_PYTHON_MODULE(alta)
bp
::
class_
<
data
,
ptr
<
data
>
,
boost
::
noncopyable
>
(
"data"
,
bp
::
no_init
)
.
def
(
"size"
,
&
data
::
size
)
.
def
(
"get"
,
&
data
::
get
)
.
def
(
"set"
,
&
data
::
set
)
//
.def("set", &data::set)
.
def
(
"load"
,
static_cast
<
void
(
data
::*
)(
const
std
::
string
&
)
>
(
&
data
::
load
))
.
def
(
"save"
,
&
data
::
save
);
bp
::
def
(
"get_data"
,
plugins_manager
::
get_data
);
...
...
sources/softs/SConscript
View file @
10076200
...
...
@@ -4,4 +4,6 @@ SConscript('data2moments/SConscript')
SConscript
(
'brdf2brdf/SConscript'
)
SConscript
(
'brdf2data/SConscript'
)
SConscript
(
'brdf2gnuplot/SConscript'
)
\ No newline at end of file
SConscript
(
'brdf2gnuplot/SConscript'
)
#SConscript('tests/SConscript')
sources/softs/brdf2data/main.cpp
View file @
10076200
...
...
@@ -95,6 +95,11 @@ int main(int argc, char** argv)
if
(
d
&&
f
!=
NULL
)
{
// Is the output data file already allocated and has the same size
// than the training data ?
const
bool
out_filled
=
d
->
size
()
==
d_out
->
size
();
const
bool
output_dif
=
args
.
is_defined
(
"export-diff"
);
vec
temp
(
f
->
dimX
());
for
(
int
i
=
0
;
i
<
d
->
size
();
++
i
)
{
...
...
@@ -111,12 +116,17 @@ int main(int argc, char** argv)
}
vec
y
=
f
->
value
(
temp
);
for
(
int
j
=
0
;
j
<
d
->
dimY
();
++
j
)
{
x
[
d
->
dimX
()
+
j
]
=
y
[
j
];
for
(
int
j
=
0
;
j
<
d
->
dimY
();
++
j
)
{
x
[
d
->
dimX
()
+
j
]
=
(
output_dif
)
?
x
[
d
->
dimX
()
+
j
]
-
y
[
j
]
:
y
[
j
];
}
d_out
->
set
(
x
);
// If the output data is already allocated and has the same size
// than the training data, we do simple copy of the index elements.
if
(
out_filled
)
{
d_out
->
set
(
i
,
y
);
}
else
{
d_out
->
set
(
x
);
}
}
d_out
->
save
(
args
[
"output"
]);
...
...
sources/softs/tests/main.cpp
View file @
10076200
/* ALTA --- Analysis of Bidirectional Reflectance Distribution Functions
Copyright (C) 2013 Inria
...
...
@@ -8,6 +9,29 @@
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <core/param.h>
int
main
(
int
argc
,
char
**
argv
)
{
spherical
sphericalParam
;
isotropic_tl_tv
isotropicParam
;
vec
in
(
4
);
in
[
0
]
=
0.0
;
in
[
1
]
=
0.0
;
in
[
2
]
=
0.0
;
in
[
3
]
=
0.0
;
vec
out
(
2
);
sphericalParam
.
convert_to
(
in
,
isotropicParam
,
out
);
return
0
;
}
#ifdef OLD
#include <core/args.h>
#include <core/data.h>
#include <core/function.h>
...
...
@@ -208,3 +232,5 @@ int parametrization_tests()
*/
return
nb_tests_failed
;
}
#endif
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