Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
alta
alta
Commits
3c8186c0
Commit
3c8186c0
authored
Aug 28, 2013
by
Laurent Belcour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Loading/Saving Fresnel function
parent
f029428e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
12 deletions
+22
-12
sources/core/common.h
sources/core/common.h
+2
-0
sources/core/function.h
sources/core/function.h
+6
-10
sources/plugins/nonlinear_fresnel_schlick/function.cpp
sources/plugins/nonlinear_fresnel_schlick/function.cpp
+12
-1
sources/plugins/nonlinear_fresnel_schlick/function.h
sources/plugins/nonlinear_fresnel_schlick/function.h
+2
-1
No files found.
sources/core/common.h
View file @
3c8186c0
...
...
@@ -233,6 +233,8 @@ vec normalize(const vec& a);
double
dot
(
const
vec
&
a
,
const
vec
&
b
);
vec
product
(
const
vec
&
a
,
const
vec
&
b
);
//! \brief locate the first index of value v in vector vec. Complexity in
//! O(n) is the worst case.
template
<
typename
T
>
int
is_in
(
std
::
vector
<
T
>
ve
,
T
v
)
...
...
sources/core/function.h
View file @
3c8186c0
...
...
@@ -469,7 +469,9 @@ class fresnel : public nonlinear_function
virtual
vec
value
(
const
vec
&
x
)
const
{
vec
fres
=
fresnelValue
(
x
);
return
fres
*
f
->
value
(
x
);
vec
func
=
f
->
value
(
x
);
return
product
(
fres
,
func
);
}
//! Load function specific files
...
...
@@ -492,12 +494,6 @@ class fresnel : public nonlinear_function
f
->
bootstrap
(
d
,
args
);
}
//! Save the Fresnel part along with the function
virtual
void
save
(
const
std
::
string
&
filename
,
const
arguments
&
args
)
const
{
f
->
save
(
filename
,
args
);
}
//! Set the dimension of the input space of the function
virtual
void
setDimX
(
int
nX
)
{
...
...
@@ -545,9 +541,9 @@ class fresnel : public nonlinear_function
}
vec
fres_params
=
getFresnelParameters
();
for
(
int
i
=
nb_func_params
;
i
<
nb_params
;
++
i
)
for
(
int
i
=
0
;
i
<
nb_
fres_
params
;
++
i
)
{
params
[
i
]
=
fres_params
[
i
-
nb_func_params
];
params
[
i
+
nb_func_params
]
=
fres_params
[
i
];
}
return
params
;
...
...
@@ -600,7 +596,7 @@ class fresnel : public nonlinear_function
for
(
int
i
=
0
;
i
<
nb_fres_params
;
++
i
)
{
jac
[
y
+
_nY
*
(
i
+
nb_func_params
)]
=
fres_jacobian
[
y
+
_nY
*
i
]
*
f
res
_value
[
y
];
jac
[
y
+
_nY
*
(
i
+
nb_func_params
)]
=
fres_jacobian
[
y
+
_nY
*
i
]
*
f
unc
_value
[
y
];
}
}
...
...
sources/plugins/nonlinear_fresnel_schlick/function.cpp
View file @
3c8186c0
...
...
@@ -17,6 +17,8 @@ ALTA_DLL_EXPORT function* provide_function()
//! Load function specific files
void
schlick
::
load
(
std
::
istream
&
in
)
{
fresnel
::
load
(
in
);
// Parse line until the next comment
while
(
in
.
peek
()
!=
'#'
)
{
...
...
@@ -27,7 +29,7 @@ void schlick::load(std::istream& in)
// Checking for the comment line #FUNC nonlinear_fresnel_schlick
std
::
string
token
;
in
>>
token
;
if
(
token
!=
"FUNC"
)
{
std
::
cerr
<<
"<<ERROR>> parsing the stream. The #FUNC is not the next line defined."
<<
std
::
endl
;
}
if
(
token
!=
"
#
FUNC"
)
{
std
::
cerr
<<
"<<ERROR>> parsing the stream. The #FUNC is not the next line defined."
<<
std
::
endl
;
}
in
>>
token
;
if
(
token
!=
"nonlinear_fresnel_schlick"
)
{
std
::
cerr
<<
"<<ERROR>> parsing the stream. function name is not the next token."
<<
std
::
endl
;
}
...
...
@@ -35,6 +37,15 @@ void schlick::load(std::istream& in)
// R [double]
in
>>
token
>>
R
;
}
void
schlick
::
save_call
(
std
::
ostream
&
out
,
const
arguments
&
args
)
const
{
f
->
save_call
(
out
,
args
);
out
<<
"#FUNC nonlinear_fresnel_schlick"
<<
std
::
endl
;
out
<<
"R "
<<
R
<<
std
::
endl
;
out
<<
std
::
endl
;
}
vec
schlick
::
fresnelValue
(
const
vec
&
x
)
const
{
...
...
sources/plugins/nonlinear_fresnel_schlick/function.h
View file @
3c8186c0
...
...
@@ -18,8 +18,9 @@ class schlick : public fresnel
public:
// methods
//! \brief Load function specific files
virtual
void
load
(
std
::
istream
&
in
)
;
virtual
void
load
(
std
::
istream
&
in
)
;
virtual
void
save_call
(
std
::
ostream
&
out
,
const
arguments
&
args
)
const
;
protected:
// methods
...
...
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