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
92313844
Commit
92313844
authored
Feb 25, 2013
by
Laurent Belcour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The min and max arguments can be vectors now
parent
52fb76f9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
14 deletions
+44
-14
sources/core/args.h
sources/core/args.h
+24
-9
sources/core/vertical_segment.cpp
sources/core/vertical_segment.cpp
+6
-4
sources/softs/brdf2gnuplot/main.cpp
sources/softs/brdf2gnuplot/main.cpp
+14
-1
No files found.
sources/core/args.h
View file @
92313844
...
@@ -27,13 +27,19 @@ class arguments
...
@@ -27,13 +27,19 @@ class arguments
if
(
temp
.
compare
(
0
,
2
,
"--"
)
==
0
)
if
(
temp
.
compare
(
0
,
2
,
"--"
)
==
0
)
{
{
key
=
temp
.
substr
(
2
,
temp
.
size
()
-
2
)
;
key
=
temp
.
substr
(
2
,
temp
.
size
()
-
2
)
;
if
(
i
+
1
<
argc
)
int
j
=
i
+
1
;
while
(
j
<
argc
)
{
{
std
::
string
next
(
argv
[
i
+
1
])
;
std
::
string
next
(
argv
[
j
])
;
if
(
next
.
compare
(
0
,
2
,
"--"
)
!=
0
)
if
(
next
.
compare
(
0
,
2
,
"--"
)
!=
0
)
{
{
data
=
next
;
data
.
append
(
next
)
;
}
}
else
{
break
;
}
++
j
;
}
}
}
}
_map
.
insert
(
std
::
pair
<
std
::
string
,
std
::
string
>
(
key
,
data
))
;
_map
.
insert
(
std
::
pair
<
std
::
string
,
std
::
string
>
(
key
,
data
))
;
...
@@ -79,34 +85,43 @@ class arguments
...
@@ -79,34 +85,43 @@ class arguments
else
else
return
default_value
;
return
default_value
;
}
}
vec
get_vec
(
const
std
::
string
&
key
,
float
default_value
)
const
vec
get_vec
(
const
std
::
string
&
key
,
int
size
,
float
default_value
=
0.0
f
)
const
{
{
vec
res
;
vec
res
(
size
)
;
if
(
_map
.
count
(
key
)
>
0
)
if
(
_map
.
count
(
key
)
>
0
)
{
{
std
::
string
s
=
_map
.
at
(
key
);
std
::
string
s
=
_map
.
at
(
key
);
if
(
s
[
0
]
==
'\['
)
// Is an array of type [a, b, c]
if
(
s
[
0
]
==
'\['
)
// Is an array of type [a, b, c]
{
{
int
i
=
0
;
int
i
=
0
;
size_t
pos
=
0
;
size_t
pos
=
1
;
while
(
pos
!=
std
::
string
::
npos
)
while
(
pos
!=
std
::
string
::
npos
)
{
{
size_t
ppos
=
s
.
find
(
","
,
pos
);
size_t
ppos
=
s
.
find
(
','
,
pos
);
if
(
ppos
!=
std
::
string
::
npos
)
if
(
ppos
!=
std
::
string
::
npos
)
{
{
std
::
cout
<<
s
.
substr
(
pos
,
ppos
)
<<
std
::
endl
;
res
[
i
]
=
atof
(
s
.
substr
(
pos
,
ppos
).
c_str
());
res
[
i
]
=
atof
(
s
.
substr
(
pos
,
ppos
).
c_str
());
pos
=
ppos
+
1
;
pos
=
ppos
+
1
;
++
i
;
++
i
;
}
}
else
{
res
[
i
]
=
atof
(
s
.
substr
(
pos
,
ppos
-
1
).
c_str
());
pos
=
ppos
;
++
i
;
}
}
}
std
::
cout
<<
std
::
endl
;
return
res
;
return
res
;
}
}
}
}
float
val
=
get_float
(
key
,
default_value
);
float
val
=
get_float
(
key
,
default_value
);
res
.
push_back
(
default_value
);
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
res
[
i
]
=
val
;
}
return
res
;
return
res
;
}
}
...
...
sources/core/vertical_segment.cpp
View file @
92313844
...
@@ -23,9 +23,7 @@ void vertical_segment::load(const std::string& filename, const arguments& args)
...
@@ -23,9 +23,7 @@ void vertical_segment::load(const std::string& filename, const arguments& args)
throw
;
throw
;
}
}
double
min
,
max
;
vec
min
,
max
;
min
=
args
.
get_float
(
"min"
,
-
std
::
numeric_limits
<
double
>::
max
())
;
max
=
args
.
get_float
(
"max"
,
std
::
numeric_limits
<
double
>::
max
())
;
_nX
=
0
;
_nY
=
0
;
_nX
=
0
;
_nY
=
0
;
std
::
vector
<
int
>
vs
;
int
current_vs
=
0
;
std
::
vector
<
int
>
vs
;
int
current_vs
=
0
;
...
@@ -57,6 +55,10 @@ void vertical_segment::load(const std::string& filename, const arguments& args)
...
@@ -57,6 +55,10 @@ void vertical_segment::load(const std::string& filename, const arguments& args)
_min
.
resize
(
dimX
())
;
_min
.
resize
(
dimX
())
;
_max
.
resize
(
dimX
())
;
_max
.
resize
(
dimX
())
;
min
=
args
.
get_vec
(
"min"
,
_nX
,
-
std
::
numeric_limits
<
double
>::
max
())
;
max
=
args
.
get_vec
(
"max"
,
_nX
,
std
::
numeric_limits
<
double
>::
max
())
;
for
(
int
k
=
0
;
k
<
dimX
();
++
k
)
for
(
int
k
=
0
;
k
<
dimX
();
++
k
)
{
{
_min
[
k
]
=
std
::
numeric_limits
<
double
>::
max
()
;
_min
[
k
]
=
std
::
numeric_limits
<
double
>::
max
()
;
...
@@ -115,7 +117,7 @@ void vertical_segment::load(const std::string& filename, const arguments& args)
...
@@ -115,7 +117,7 @@ void vertical_segment::load(const std::string& filename, const arguments& args)
bool
is_in
=
true
;
bool
is_in
=
true
;
for
(
int
i
=
0
;
i
<
dimX
();
++
i
)
for
(
int
i
=
0
;
i
<
dimX
();
++
i
)
{
{
if
(
v
[
i
]
<
min
||
v
[
i
]
>
max
)
if
(
v
[
i
]
<
min
[
i
]
||
v
[
i
]
>
max
[
i
]
)
{
{
is_in
=
false
;
is_in
=
false
;
}
}
...
...
sources/softs/brdf2gnuplot/main.cpp
View file @
92313844
...
@@ -53,6 +53,13 @@ int main(int argc, char** argv)
...
@@ -53,6 +53,13 @@ int main(int argc, char** argv)
d
->
load
(
args
[
"data"
])
;
d
->
load
(
args
[
"data"
])
;
}
}
bool
plot_error
=
false
;
if
(
args
.
is_defined
(
"error"
))
{
std
::
cout
<<
"<<INFO>> Exporting an error plot"
<<
std
::
endl
;
plot_error
=
true
;
}
// Load the BRDF
// Load the BRDF
f
->
load
(
args
[
"input"
]);
f
->
load
(
args
[
"input"
]);
...
@@ -70,7 +77,13 @@ int main(int argc, char** argv)
...
@@ -70,7 +77,13 @@ int main(int argc, char** argv)
file
<<
v
[
u
]
<<
"
\t
"
;
file
<<
v
[
u
]
<<
"
\t
"
;
for
(
int
u
=
0
;
u
<
d
->
dimY
();
++
u
)
for
(
int
u
=
0
;
u
<
d
->
dimY
();
++
u
)
file
<<
y2
[
u
]
<<
"
\t
"
;
{
if
(
plot_error
)
{
file
<<
y2
[
u
]
<<
"
\t
"
;
}
else
{
file
<<
(
v
[
d
->
dimX
()
+
u
]
-
y2
[
u
])
/
v
[
d
->
dimX
()
+
u
]
<<
"
\t
"
;
}
}
file
<<
std
::
endl
;
file
<<
std
::
endl
;
}
}
...
...
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