Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
alta
alta
Commits
e9791b19
Commit
e9791b19
authored
Jun 06, 2014
by
Laurent Belcour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debugging the brdf2data and brdf2gnuplot programs
parent
3bd27e30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
64 deletions
+57
-64
sources/softs/brdf2data/main.cpp
sources/softs/brdf2data/main.cpp
+3
-9
sources/softs/brdf2gnuplot/main.cpp
sources/softs/brdf2gnuplot/main.cpp
+54
-55
No files found.
sources/softs/brdf2data/main.cpp
View file @
e9791b19
...
@@ -58,8 +58,7 @@ int main(int argc, char** argv)
...
@@ -58,8 +58,7 @@ int main(int argc, char** argv)
}
}
// Get the associated data object and load the file is any
// Get the associated data object and load the file is any
ptr
<
data
>
d
=
NULL
;
ptr
<
data
>
d
=
plugins_manager
::
get_data
(
args
[
"data"
])
;
d
=
plugins_manager
::
get_data
(
args
[
"data"
])
;
if
(
args
.
is_defined
(
"data-file"
))
if
(
args
.
is_defined
(
"data-file"
))
{
{
d
->
load
(
args
[
"data-file"
]);
d
->
load
(
args
[
"data-file"
]);
...
@@ -67,14 +66,9 @@ int main(int argc, char** argv)
...
@@ -67,14 +66,9 @@ int main(int argc, char** argv)
// Get the output object. In the case where it is not a VS file, we use
// Get the output object. In the case where it is not a VS file, we use
// the load object.
// the load object.
ptr
<
data
>
d_out
=
NULL
;
ptr
<
data
>
d_out
=
plugins_manager
::
get_data
(
args
[
"data"
])
;
if
(
!
dynamic_pointer_cast
<
vertical_segment
>
(
d
))
if
(
dynamic_pointer_cast
<
vertical_segment
>
(
d
))
{
{
d_out
=
d
;
}
else
{
d_out
=
ptr
<
data
>
(
new
vertical_segment
());
d_out
->
setDimX
(
d
->
dimX
());
d_out
->
setDimX
(
d
->
dimX
());
d_out
->
setDimY
(
d
->
dimY
());
d_out
->
setDimY
(
d
->
dimY
());
d_out
->
setParametrization
(
d
->
input_parametrization
());
d_out
->
setParametrization
(
d
->
input_parametrization
());
...
...
sources/softs/brdf2gnuplot/main.cpp
View file @
e9791b19
...
@@ -67,13 +67,19 @@ int main(int argc, char** argv)
...
@@ -67,13 +67,19 @@ int main(int argc, char** argv)
// Load a data file
// Load a data file
ptr
<
data
>
d
=
NULL
;
if
(
args
.
is_defined
(
"data"
)
||
args
.
is_defined
(
"in-data"
))
if
(
args
.
is_defined
(
"data"
)
||
args
.
is_defined
(
"in-data"
))
{
{
d
=
plugins_manager
::
get_data
(
args
[
"data"
]);
ptr
<
data
>
d
=
plugins_manager
::
get_data
(
args
[
"data"
]);
if
(
dynamic_pointer_cast
<
vertical_segment
>
(
d
))
// Load data file if the plugin manager created a plugin object.
if
(
d
)
{
d
->
load
(
args
[
"data-file"
]);
}
else
{
{
d
->
load
(
args
[
"in-data"
]);
std
::
cerr
<<
"<<ERROR>> unable to load the data plugin"
<<
std
::
endl
;
return
1
;
}
}
// Print the distance to the data to check if it correspond to the value
// Print the distance to the data to check if it correspond to the value
...
@@ -97,67 +103,60 @@ int main(int argc, char** argv)
...
@@ -97,67 +103,60 @@ int main(int argc, char** argv)
linear_plot
=
true
;
linear_plot
=
true
;
}
}
if
(
d
)
for
(
int
i
=
0
;
i
<
d
->
size
();
++
i
)
{
{
for
(
int
i
=
0
;
i
<
d
->
size
();
++
i
)
vec
v
=
d
->
get
(
i
)
;
vec
x
(
f
->
dimX
());
// Convert the data to the function's input space.
if
(
f
->
input_parametrization
()
==
params
::
UNKNOWN_INPUT
)
{
{
vec
v
=
d
->
get
(
i
)
;
memcpy
(
&
x
[
0
],
&
v
[
0
],
f
->
dimX
()
*
sizeof
(
double
));
vec
x
(
f
->
dimX
());
}
else
// Convert the data to the function's input space.
{
if
(
f
->
input_parametrization
()
==
params
::
UNKNOWN_INPUT
)
params
::
convert
(
&
v
[
0
],
d
->
input_parametrization
(),
f
->
input_parametrization
(),
&
x
[
0
]);
{
}
memcpy
(
&
x
[
0
],
&
v
[
0
],
f
->
dimX
()
*
sizeof
(
double
));
}
// Evaluate the function. I can add the cosine term to the BRDF
else
// value.
{
double
costerm
=
1.0
;
params
::
convert
(
&
v
[
0
],
d
->
input_parametrization
(),
f
->
input_parametrization
(),
&
x
[
0
]);
if
(
cos_plot
)
}
{
double
cart
[
6
];
// Evaluate the function. I can add the cosine term to the BRDF
params
::
convert
(
&
x
[
0
],
f
->
input_parametrization
(),
params
::
CARTESIAN
,
cart
);
// value.
costerm
=
cart
[
5
]
*
cart
[
2
];
double
costerm
=
1.0
;
}
if
(
cos_plot
)
vec
y2
=
costerm
*
f
->
value
(
x
)
;
{
double
cart
[
6
];
params
::
convert
(
&
x
[
0
],
f
->
input_parametrization
(),
params
::
CARTESIAN
,
cart
);
costerm
=
cart
[
5
]
*
cart
[
2
];
}
vec
y2
=
costerm
*
f
->
value
(
x
)
;
if
(
!
linear_plot
)
if
(
!
linear_plot
)
{
for
(
int
u
=
0
;
u
<
d
->
dimX
();
++
u
)
file
<<
v
[
u
]
<<
"
\t
"
;
}
else
{
file
<<
i
<<
"
\t
"
;
}
for
(
int
u
=
0
;
u
<
d
->
dimY
();
++
u
)
{
if
(
plot_error
)
{
{
for
(
int
u
=
0
;
u
<
d
->
dimX
();
++
u
)
file
<<
(
v
[
d
->
dimX
()
+
u
]
-
y2
[
u
])
<<
"
\t
"
;
file
<<
v
[
u
]
<<
"
\t
"
;
}
}
else
else
if
(
linear_plot
)
{
{
file
<<
i
<<
"
\t
"
;
file
<<
(
v
[
d
->
dimX
()
+
u
]
-
y2
[
u
])
/
v
[
d
->
dimX
()
+
u
]
<<
"
\t
"
;
}
}
else
for
(
int
u
=
0
;
u
<
d
->
dimY
();
++
u
)
{
{
if
(
plot_error
)
file
<<
y2
[
u
]
<<
"
\t
"
;
{
file
<<
(
v
[
d
->
dimX
()
+
u
]
-
y2
[
u
])
<<
"
\t
"
;
}
else
if
(
linear_plot
)
{
file
<<
(
v
[
d
->
dimX
()
+
u
]
-
y2
[
u
])
/
v
[
d
->
dimX
()
+
u
]
<<
"
\t
"
;
}
else
{
file
<<
y2
[
u
]
<<
"
\t
"
;
}
}
}
file
<<
std
::
endl
;
}
}
}
else
file
<<
std
::
endl
;
{
std
::
cerr
<<
"<<ERROR>> data argument is incorrectly defined"
<<
std
::
endl
;
}
}
}
}
else
if
(
args
.
is_defined
(
"polar-plot"
))
else
if
(
args
.
is_defined
(
"polar-plot"
))
...
...
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