Commit 1a47c706 authored by pacanows's avatar pacanows

Merge

parents 5f852776 7c6e2471
This file is part of the ALTA library.
ALTA is free software: you can redistribute it and/or modify it under the terms
of the GNU Lesser General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
ALTA is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
We however require that you contact us for any use or modification of ALTA.
You should have received a copy of the GNU Lesser General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
Contacts:
- Laurent Belcour <laurent.belcour@inria.fr>
- Romain Pacanowski <romain.pacanowski@inria.fr>
- Xavier Granier <xavier.granier@inria.fr>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="293.8457"
height="293.85001"
id="svg2"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="alta_logo.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.979899"
inkscape:cx="174.41936"
inkscape:cy="194.34737"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1200"
inkscape:window-height="1888"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-218.72743,-206.99795)">
<path
style="fill:none;stroke:#ff0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 224.12391,242.21248 c 13.75014,-24.3849 62.57976,-16.29367 92.34189,16.27477 29.76214,32.56845 41.1261,57.06917 49.22092,57.06917 8.09481,0 17.17249,-24.19853 45.31129,-54.32841 26.28078,-28.14042 71.92956,-44.49114 92.03679,-23.6903 22.68832,23.47096 -2.73331,74.43857 -42.23404,105.40769 -39.50073,30.96911 -94.75983,42.27522 -94.75983,42.27522 0,0 -46.47766,-5.96811 -85.35167,-34.05434 -38.87401,-28.08623 -73.46513,-78.9832 -56.56535,-108.9538 z"
id="path3913-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssssscss" />
<path
style="fill:none;stroke:#ff4545;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 236.62391,252.21248 c 14.17834,-20.33759 44.92431,-11.01902 78.41332,17.70334 32.97641,28.28274 41.84037,66.71203 49.93519,66.71203 8.09481,0 20.62643,-41.92398 51.73987,-68.97127 29.49506,-25.64042 57.46035,-35.7403 75.25107,-18.33316 15.56867,15.233 8.69527,49.43857 -31.8769,88.26484 -36.26388,34.70337 -94.86629,48.01117 -94.86629,48.01117 0,0 -41.01405,-7.77549 -79.88805,-35.86172 -38.87401,-28.08623 -66.12206,-72.54659 -48.70821,-97.52523 z"
id="path3913-2-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssssscss" />
<path
style="fill:none;stroke:#ffa5a5;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 252.14286,269.6479 c 11.22313,-19.90344 48.45526,-7.76059 72.74769,18.82241 24.29244,26.58301 33.85944,65.82044 40.46659,65.82044 6.60714,0 14.59953,-36.36721 37.56697,-60.95981 21.45089,-22.96876 56.37826,-44.76824 72.79018,-27.79019 18.51865,19.15746 -4.27153,57.26013 -36.5128,82.53773 -32.24127,25.2776 -73.93364,37.73013 -73.93364,37.73013 0,0 -34.6425,-9.8446 -66.37223,-32.76913 -31.72973,-22.92453 -60.54669,-58.92899 -46.75276,-83.39158 z"
id="path3913"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssssscss" />
<path
style="fill:none;stroke:#ffcece;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 281.25,295.18361 c 9.89568,-9.23073 28.95137,-3.81082 42.92626,11.67956 15.01774,16.64632 37.2523,68.67758 41.53802,68.67758 4.64286,0 11.68203,-37.64965 36.85269,-63.63838 10.82971,-11.18168 34.18545,-27.81335 46.71875,-17.61162 4.52996,3.68725 8.40704,28.6887 -26.15566,57.00202 -31.69261,25.96217 -57.86221,34.51584 -57.86221,34.51584 0,0 -34.10679,-16.45174 -56.37223,-34.91199 C 278.76114,325.91217 276.12533,299.96393 281.25,295.18361 z"
id="path3913-4"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssssscss" />
<g
id="g4237"
transform="translate(0,-12)">
<path
sodipodi:nodetypes="sssss"
inkscape:connector-curvature="0"
id="path3061-7"
d="m 325.98812,385.48016 c 21.68777,0.7741 38.93997,10.62505 38.91432,11.34364 -0.0275,0.76991 -17.93627,9.31448 -39.62404,8.54038 -21.68778,-0.7741 -39.11031,-5.85283 -38.91432,-11.34365 0.19598,-5.49081 17.93626,-9.31447 39.62404,-8.54037 z"
style="fill:none;stroke:#4eeb48;stroke-width:1.04782414;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0" />
<path
sodipodi:nodetypes="sssss"
inkscape:connector-curvature="0"
id="path3061-3-9"
d="m 338.96826,389.15328 c 14.68619,0.5242 26.36877,7.19491 26.35141,7.68152 -0.0186,0.52136 -12.14581,6.30744 -26.83201,5.78324 -14.6862,-0.52419 -26.48411,-3.96333 -26.3514,-7.68152 0.13271,-3.71818 12.1458,-6.30743 26.832,-5.78324 z"
style="fill:none;stroke:#82d178;stroke-width:0.70954955;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0" />
<path
sodipodi:nodetypes="sssss"
inkscape:connector-curvature="0"
id="path3061-3-5-0"
d="m 344.16366,391.3942 c 11.721,0.41836 21.06766,5.10295 21.05557,5.4415 -0.0129,0.36274 -9.66894,4.34485 -21.38994,3.92649 -11.72101,-0.41836 -21.1479,-2.8546 -21.05557,-5.4415 0.0923,-2.58689 9.66893,-4.34485 21.38994,-3.92649 z"
style="fill:none;stroke:#d0eacf;stroke-width:0.52873039;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0" />
<path
sodipodi:nodetypes="sssss"
inkscape:connector-curvature="0"
id="path3061-3-5-9-3"
d="m 349.19349,393.42965 c 8.86126,0.31628 15.95115,3.19438 15.94386,3.39864 -0.008,0.21884 -7.28434,2.56957 -16.1456,2.25328 -8.86125,-0.31628 -15.99955,-1.83791 -15.94385,-3.39865 0.0557,-1.56073 7.28433,-2.56956 16.14559,-2.25327 z"
style="fill:none;stroke:#cfe9cf;stroke-width:0.35708708;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0" />
</g>
<path
style="fill:none;stroke:#0014ff;stroke-width:1.5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
d="m 338.17413,454.67792 c 26.23203,-27.2526 28.51432,-67.74954 27.03189,-69.17645 -1.58831,-1.52883 -41.81995,2.43989 -68.05199,29.6925 -26.23204,27.25261 -38.31464,58.18399 -26.98725,69.08719 11.32737,10.90318 41.7753,-2.35062 68.00735,-29.60324 z"
id="path3061-2-9"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssss" />
<g
transform="matrix(-1,0,0,1,731.52215,-11.82353)"
id="g4237-4">
<path
sodipodi:nodetypes="sssss"
inkscape:connector-curvature="0"
id="path3061-7-7"
d="m 325.98812,385.48016 c 21.68777,0.7741 38.93997,10.62505 38.91432,11.34364 -0.0275,0.76991 -17.93627,9.31448 -39.62404,8.54038 -21.68778,-0.7741 -39.11031,-5.85283 -38.91432,-11.34365 0.19598,-5.49081 17.93626,-9.31447 39.62404,-8.54037 z"
style="fill:none;stroke:#4eeb48;stroke-width:1.04782414;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0" />
<path
sodipodi:nodetypes="sssss"
inkscape:connector-curvature="0"
id="path3061-3-9-6"
d="m 338.96826,389.15328 c 14.68619,0.5242 26.36877,7.19491 26.35141,7.68152 -0.0186,0.52136 -12.14581,6.30744 -26.83201,5.78324 -14.6862,-0.52419 -26.48411,-3.96333 -26.3514,-7.68152 0.13271,-3.71818 12.1458,-6.30743 26.832,-5.78324 z"
style="fill:none;stroke:#82d178;stroke-width:0.70954955;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0" />
<path
sodipodi:nodetypes="sssss"
inkscape:connector-curvature="0"
id="path3061-3-5-0-8"
d="m 344.16366,391.3942 c 11.721,0.41836 21.06766,5.10295 21.05557,5.4415 -0.0129,0.36274 -9.66894,4.34485 -21.38994,3.92649 -11.72101,-0.41836 -21.1479,-2.8546 -21.05557,-5.4415 0.0923,-2.58689 9.66893,-4.34485 21.38994,-3.92649 z"
style="fill:none;stroke:#d0eacf;stroke-width:0.52873039;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0" />
<path
sodipodi:nodetypes="sssss"
inkscape:connector-curvature="0"
id="path3061-3-5-9-3-1"
d="m 349.19349,393.42965 c 8.86126,0.31628 15.95115,3.19438 15.94386,3.39864 -0.008,0.21884 -7.28434,2.56957 -16.1456,2.25328 -8.86125,-0.31628 -15.99955,-1.83791 -15.94385,-3.39865 0.0557,-1.56073 7.28433,-2.56956 16.14559,-2.25327 z"
style="fill:none;stroke:#cfe9cf;stroke-width:0.35708708;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0" />
</g>
<path
style="fill:none;stroke:#737eff;stroke-width:1.5846529;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
d="m 347.2917,431.9146 c 17.76341,-18.4545 19.27866,-45.81714 18.27482,-46.7834 -1.07555,-1.03527 -28.28878,1.59175 -46.05219,20.04625 -17.76342,18.45451 -25.94531,39.40016 -18.2748,46.78341 7.67048,7.38324 28.28875,-1.59175 46.05217,-20.04626 z"
id="path3061-3-2-0"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssss" />
<path
style="fill:none;stroke:#0014ff;stroke-width:1.5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
d="m 393.58256,454.56803 c -26.23203,-27.2526 -28.46968,-67.66025 -26.98725,-69.08716 1.58831,-1.52883 41.77531,2.3506 68.00735,29.60321 26.23204,27.25261 38.31464,58.18399 26.98725,69.08719 -11.32737,10.90318 -41.7753,-2.35062 -68.00735,-29.60324 z"
id="path3061-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssss" />
<path
style="fill:none;stroke:#737eff;stroke-width:1.5846529;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
d="m 384.39803,432.05025 c -17.76341,-18.4545 -19.27866,-45.81714 -18.27482,-46.7834 1.07555,-1.03527 28.28878,1.59175 46.05219,20.04625 17.76342,18.45451 25.94531,39.40016 18.2748,46.78341 -7.67048,7.38324 -28.28875,-1.59175 -46.05217,-20.04626 z"
id="path3061-3-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssss" />
<path
style="fill:none;stroke:#0014ff;stroke-width:1.51787508;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
d="m 381.30553,331.48876 c 0,29.20938 -14.38907,52.88825 -15.51011,52.88825 -1.20111,0 -15.51012,-23.67887 -15.51012,-52.88825 0,-29.20939 6.94412,-52.88826 15.51012,-52.88826 8.56599,0 15.51011,23.67887 15.51011,52.88826 z"
id="path3061"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssss" />
<path
style="fill:none;stroke:#737eff;stroke-width:1.02785146;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
d="m 376.30439,349.12469 c 0,19.77956 -9.74377,35.81406 -10.5029,35.81406 -0.81335,0 -10.50291,-16.0345 -10.50291,-35.81406 0,-19.77957 4.70232,-35.81406 10.50291,-35.81406 5.80058,0 10.5029,16.03449 10.5029,35.81406 z"
id="path3061-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssss" />
<path
style="fill:none;stroke:#afb5ff;stroke-width:1.18082547;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
d="m 349.47045,421.04801 c 14.17692,-14.72848 16.70508,-35.29707 16.00666,-35.96933 -0.74831,-0.7203 -21.1556,2.63872 -35.33252,17.36719 -14.17693,14.72849 -21.34333,30.83251 -16.00665,35.96935 5.33667,5.13682 21.15559,-2.63873 35.33251,-17.36721 z"
id="path3061-3-5-7-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssss" />
<path
style="fill:none;stroke:#afb5ff;stroke-width:1.18082547;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
d="m 382.28625,421.25062 c -14.17692,-14.72848 -16.70508,-35.29707 -16.00666,-35.96933 0.74831,-0.7203 21.1556,2.63872 35.33252,17.36719 14.17693,14.72849 21.34333,30.83251 16.00665,35.96935 -5.33667,5.13682 -21.15559,-2.63873 -35.33251,-17.36721 z"
id="path3061-3-5-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssss" />
<path
style="fill:none;stroke:#afb5ff;stroke-width:0.76591736;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
d="m 373.1018,356.22061 c 0,15.786 -6.77914,28.58309 -7.3073,28.58309 -0.56589,0 -7.30731,-12.79709 -7.30731,-28.58309 0,-15.78601 3.2716,-28.58309 7.30731,-28.58309 4.0357,0 7.3073,12.79708 7.3073,28.58309 z"
id="path3061-3-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssss" />
<path
style="fill:none;stroke:#cdd1ff;stroke-width:0.79749054;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
d="m 379.89815,411.17982 c -10.71797,-11.13495 -13.99811,-25.36757 -13.57674,-25.77316 0.45147,-0.43456 14.51851,3.41511 25.23648,14.55007 10.71796,11.13495 16.79646,22.67398 13.57671,25.77316 -3.21974,3.09916 -14.51848,-3.41511 -25.23645,-14.55007 z"
id="path3061-3-5-9-0"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssss" />
<path
style="fill:none;stroke:#cdd1ff;stroke-width:0.51727533;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
d="m 370.21015,363.08395 c 0,11.93446 -4.09001,21.60925 -4.40866,21.60925 -0.34141,0 -4.40867,-9.67479 -4.40867,-21.60925 0,-11.93446 1.97383,-21.60924 4.40867,-21.60924 2.43483,0 4.40866,9.67478 4.40866,21.60924 z"
id="path3061-3-5-9"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssss" />
<path
style="fill:none;stroke:#cdd1ff;stroke-width:0.79749054;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
d="m 351.76926,411.13346 c 10.71797,-11.13495 13.99811,-25.36757 13.57674,-25.77316 -0.45147,-0.43456 -14.51851,3.41511 -25.23648,14.55007 -10.71796,11.13495 -16.79646,22.67398 -13.57671,25.77316 3.21974,3.09916 14.51848,-3.41511 25.23645,-14.55007 z"
id="path3061-3-5-9-0-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssss" />
</g>
</svg>
......@@ -180,8 +180,8 @@ class arguments
vec get_vec(const std::string& key, int size, float default_value = 0.0f) const
{
vec res(size);
for(int i=0; i<size; ++i)
res[i] = default_value;
for(int i=0; i<size; ++i)
res[i] = default_value;
if(_map.count(key) > 0)
{
......@@ -196,14 +196,14 @@ class arguments
if(ppos != std::string::npos)
{
res[i] = atof(s.substr(pos, ppos-pos).c_str());
res[i] = atof(s.substr(pos, ppos-pos).c_str());
pos = ppos+1;
++i;
}
else
{
std::string temp = s.substr(pos, std::string::npos);
res[i] = atof(temp.substr(0, temp.size()-1).c_str());
std::string temp = s.substr(pos, std::string::npos);
res[i] = atof(temp.substr(0, temp.size()-1).c_str());
pos = ppos;
++i;
}
......@@ -220,6 +220,38 @@ class arguments
return res;
}
//! \brief access a vector of element of type \a T of variable length.
//! the string associated with the key \a key should have the form
//! "[a, b, c]" where a, b, c are of type \a T.
template<typename T>
std::vector<T> get_vec(const std::string& key) const
{
std::vector<T> res;
if(_map.count(key) > 0)
{
std::string str = _map.find(key)->second;
if(str[0] == '[' && str[str.size()-1] == ']') // Is an array of type [a, b, c]
{
std::stringstream stream(str.substr(1, str.size()-2));
char s[256];
while(stream.good())
{
// Extract the value v from the stream s
stream.get(s, 256, ',');
stream.ignore(1);
std::stringstream sstream(s);
T v;
sstream >> v;
// Push the value at the end of the vector
res.push_back(v);
}
}
}
return res;
}
std::vector<std::string> get_vec(const std::string& key) const
{
std::vector<std::string> res;
......
......@@ -21,12 +21,15 @@ std::map<params::input, const param_info> create_map()
/* 2D Params */
_map.insert(std::make_pair<params::input, const param_info>(params::RUSIN_TH_TD, param_info("RUSIN_TH_TD", 2, "Radialy symmetric Half angle parametrization")));
_map.insert(std::make_pair<params::input, const param_info>(params::ISOTROPIC_TV_PROJ_DPHI, param_info("ISOTROPIC_TV_PROJ_DPHI", 2, "Isoptropic projected phi parametrization without a light direction.")));
_map.insert(std::make_pair<params::input, const param_info>(params::ISOTROPIC_TV_PROJ_DPHI, param_info("THETA_OUT_COS_DPHI_THETA_OUT_SIN_DPHI", 2, "Isoptropic projected phi parametrization without a light direction.")));
/* 3D Params */
_map.insert(std::make_pair<params::input, const param_info>(params::RUSIN_TH_TD_PD, param_info("RUSIN_TH_TD_PD", 3, "Isotropic Half angle parametrization")));
_map.insert(std::make_pair<params::input, const param_info>(params::ISOTROPIC_TV_TL_DPHI, param_info("ISOTROPIC_TV_TL_DPHI", 3, "Isotropic Light/View angle parametrization")));
_map.insert(std::make_pair<params::input, const param_info>(params::RUSIN_VH, param_info("RUSIN_VH", 3, "Vector representation of the Half angle only")));
_map.insert(std::make_pair<params::input, const param_info>(params::SCHLICK_VK, param_info("SCHLICK_VH", 3, "Vector representation of the Back angle only")));
_map.insert(std::make_pair<params::input, const param_info>(params::ISOTROPIC_TL_TV_PROJ_DPHI, param_info("ISOTROPIC_TL_TV_PROJ_DPHI", 3, "Isoptropic projected phi parametrization.")));
/* 4D Params */
_map.insert(std::make_pair<params::input, const param_info>(params::RUSIN_TH_PH_TD_PD, param_info("RUSIN_TH_PH_TD_PD", 4, "Complete Half angle parametrization")));
......@@ -85,9 +88,19 @@ void params::to_cartesian(const double* invec, params::input intype,
case params::COS_TH_TD:
half_to_cartesian(acos(invec[0]), 0.0, acos(invec[1]), 0.0, outvec);
break;
case params::RUSIN_TH_TD:
half_to_cartesian(invec[0], 0.0, invec[1], 0.5*M_PI, outvec);
half_to_cartesian(invec[0], 0.0, invec[1], 0.5*M_PI, outvec);
break;
case ISOTROPIC_TV_PROJ_DPHI:
{
const double theta = 0.5*sqrt(invec[0]*invec[0] + invec[1]*invec[1]);
outvec[3] = invec[0]/theta*sin(theta);
outvec[4] = invec[1]/theta*sin(theta);
outvec[5] = cos(theta);
outvec[0] = 0.0;
outvec[1] = 0.0;
outvec[2] = 1.0;
}
break;
// 3D Parametrization
......@@ -107,7 +120,7 @@ void params::to_cartesian(const double* invec, params::input intype,
half_to_cartesian(acos(invec[2]), atan2(invec[1], invec[0]), 0.0, 0.0, outvec);
break;
// \todo I should handle the phi_k in the conversion to CARTESIAN
case params::SCHLICK_VK:
case params::SCHLICK_VK:
outvec[0] = invec[2]*invec[2]-1.0;
outvec[1] = 0.0;
outvec[2] = invec[2];
......@@ -115,6 +128,17 @@ void params::to_cartesian(const double* invec, params::input intype,
outvec[4] = 0.0;
outvec[5] = invec[2];
break;
case ISOTROPIC_TL_TV_PROJ_DPHI:
{
const double theta = 0.5*sqrt(invec[1]*invec[1] + invec[2]*invec[2]);
outvec[3] = invec[1]/theta*sin(theta);
outvec[4] = invec[2]/theta*sin(theta);
outvec[5] = cos(theta);
outvec[0] = 0.0;
outvec[1] = 0.0;
outvec[2] = cos(invec[0]);
}
break;
// 4D Parametrization
case params::RUSIN_TH_PH_TD_PD:
......@@ -130,29 +154,28 @@ void params::to_cartesian(const double* invec, params::input intype,
outvec[5] = cos(invec[2]);
break;
case params::STEREOGRAPHIC:
{
// Project the 2D direction on the surface invec[0,1] to the View
// vector outvec[0,1,2]
const double normL = invec[0]*invec[0] + invec[1]*invec[1];
const double alphL = (1.0 - normL) / (1.0 + normL);
outvec[0] = invec[0] + alphL;
outvec[1] = invec[1] + alphL;
outvec[2] = alphL;
// Project the 2D direction on the surface invec[2,3] to the Light
// vector outvec[3,4,5]
const double normV = invec[2]*invec[2] + invec[3]*invec[3];
const double alphV = (1.0 - normV) / (1.0 + normV);
outvec[3] = invec[2] + alphV;
outvec[4] = invec[3] + alphV;
outvec[5] = alphV;
break;
}
case params::STEREOGRAPHIC:
{
// Project the 2D direction on the surface invec[0,1] to the View
// vector outvec[0,1,2]
const double normL = invec[0]*invec[0] + invec[1]*invec[1];
const double alphL = (1.0 - normL) / (1.0 + normL);
outvec[0] = invec[0] + alphL;
outvec[1] = invec[1] + alphL;
outvec[2] = alphL;
// Project the 2D direction on the surface invec[2,3] to the Light
// vector outvec[3,4,5]
const double normV = invec[2]*invec[2] + invec[3]*invec[3];
const double alphV = (1.0 - normV) / (1.0 + normV);
outvec[3] = invec[2] + alphV;
outvec[4] = invec[3] + alphV;
outvec[5] = alphV;
}
break;
// 6D Parametrization
case params::CARTESIAN:
// 6D Parametrization
case params::CARTESIAN:
memcpy(outvec, invec, 6*sizeof(double));
break;
......@@ -187,12 +210,12 @@ void params::from_cartesian(const double* invec, params::input outtype,
outvec[0] = half[2];
break;
case params::COS_TK:
{
double Kx = invec[0]-invec[3];
double Ky = invec[1]-invec[4];
double Kz = invec[2]+invec[5];
outvec[0] = (invec[2] + invec[5]) / sqrt(Kx*Kx + Ky*Ky + Kz*Kz);
}
{
const double Kx = invec[0]-invec[3];
const double Ky = invec[1]-invec[4];
const double Kz = invec[2]+invec[5];
outvec[0] = (invec[2] + invec[5]) / sqrt(Kx*Kx + Ky*Ky + Kz*Kz);
}
break;
// 2D Parametrizations
......@@ -204,6 +227,14 @@ void params::from_cartesian(const double* invec, params::input outtype,
outvec[0] = acos(half[2]);
outvec[1] = acos(clamp(half[0]*invec[0] + half[1]*invec[1] + half[2]*invec[2], -1.0, 1.0));
break;
case ISOTROPIC_TV_PROJ_DPHI:
{
const double theta = acos(invec[5]);
const double dphi = atan2(invec[1], invec[0]) - atan2(invec[4], invec[3]);
outvec[0] = theta * cos(dphi);
outvec[1] = theta * sin(dphi);
}
break;
// 3D Parametrization
case params::RUSIN_TH_PH_TD:
......@@ -235,27 +266,37 @@ void params::from_cartesian(const double* invec, params::input outtype,
outvec[1] = half[1];
outvec[2] = half[2];
break;
case params::SCHLICK_VK:
{
const double Kx = invec[0]-invec[3];
const double Ky = invec[1]-invec[4];
const double Kz = invec[2]-invec[5];
const double norm = sqrt(Kx*Kx + Ky*Ky + Kz*Kz);
if(norm > 1.0E-10)
{
outvec[0] = Kx / norm;
outvec[1] = Ky / norm;
outvec[2] = Kz / norm;
}
else
{
outvec[0] = 0.0;
outvec[1] = 0.0;
outvec[2] = 1.0;
}
}
break;
case params::SCHLICK_VK:
{
const double Kx = invec[0]-invec[3];
const double Ky = invec[1]-invec[4];
const double Kz = invec[2]-invec[5];
const double norm = sqrt(Kx*Kx + Ky*Ky + Kz*Kz);
if(norm > 1.0E-10)
{
outvec[0] = Kx / norm;
outvec[1] = Ky / norm;
outvec[2] = Kz / norm;
}
else
{
outvec[0] = 0.0;
outvec[1] = 0.0;
outvec[2] = 1.0;
}
}
break;
case ISOTROPIC_TL_TV_PROJ_DPHI:
{
const double theta_l = acos(invec[2]);
const double theta_v = acos(invec[5]);
const double dphi = atan2(invec[1], invec[0]) - atan2(invec[4], invec[3]);
outvec[0] = theta_l;
outvec[1] = theta_v * cos(dphi);
outvec[2] = theta_v * sin(dphi);
}
break;
// 4D Parametrization
case params::RUSIN_TH_PH_TD_PD:
......@@ -283,22 +324,22 @@ void params::from_cartesian(const double* invec, params::input outtype,
#endif
break;
case params::STEREOGRAPHIC:
{
// Project the View vector invec[0,1,2] on a 2D direction on the
// surface outvec[0,1]
double dotVN = invec[2];
outvec[0] = invec[0] / (1.0+dotVN);
outvec[1] = invec[1] / (1.0+dotVN);
case params::STEREOGRAPHIC:
{
// Project the View vector invec[0,1,2] on a 2D direction on the
// surface outvec[0,1]
const double dotVN = invec[2];
outvec[0] = invec[0] / (1.0+dotVN);
outvec[1] = invec[1] / (1.0+dotVN);
// Project the Light vector invec[0,1,2] on a 2D direction on the
// surface outvec[2,3]
double dotLN = invec[5];
outvec[2] = invec[3] / (1.0+dotLN);
outvec[3] = invec[4] / (1.0+dotLN);
// Project the Light vector invec[0,1,2] on a 2D direction on the
// surface outvec[2,3]
const double dotLN = invec[5];
outvec[2] = invec[3] / (1.0+dotLN);
outvec[3] = invec[4] / (1.0+dotLN);
break;
}
}
break;
// 6D Parametrization
case params::CARTESIAN:
......
......@@ -30,17 +30,23 @@ class params
//! \brief list of all supported parametrization for the input space.
//! An unsupported parametrization will go under the name
//! <em>unknown</em>.
//! <em>unknown</em>. We use the following notations:
//! * The view vector is \f$\vec{v}\f$
//! * The light vector is \f$\vec{l}\f$
//! * The normal vector is \f$\vec{n}\f$
//! * The reflected vector is \f$\vec{r} = 2\mbox{dot}(\vec{v}, \vec{n})\vec{n} - \vec{v}\f$
enum input
{
RUSIN_TH_PH_TD_PD, /*!< Half-angle parametrization as described in [Rusinkiewicz'98] */
RUSIN_TH_PH_TD,
RUSIN_TH_TD_PD,
RUSIN_TH_TD, /*!< Half-angle parametrization with no azimutal information */
RUSIN_VH_VD, /*!< Half-angle parametrization with no azimutal information in
vector format */
RUSIN_VH, /*!< Half-angle parametrization with no azimutal information
and no difference direction in vector format */
RUSIN_VH_VD, /*!< Half-angle parametrization in vector format. Coordinates are:
[\f$\vec{h}_x, \vec{h}_y, \vec{h}_z, \vec{d}_x, \vec{d}_y,
\vec{d}_z \f$].*/
RUSIN_VH, /*!< Half-angle parametrization with no difference direction in
vector format. Coordinates are: [\f$\vec{h}_x, \vec{h}_y,
\vec{h}_z\f$]. */
COS_TH_TD,
COS_TH,
......@@ -53,6 +59,12 @@ class params
SPHERICAL_TL_PL_TV_PV, /*!< Light and View vectors represented in spherical coordinates */
ISOTROPIC_TV_TL_DPHI, /*!< Light and View vectors represented in spherical coordinates,
with the difference of azimutal coordinates in the last component */
ISOTROPIC_TV_PROJ_DPHI,/*!< 2D Parametrization where the phi component is projected.
Coordinates are: [\f$\theta_v \cos(\Delta\phi), \theta_v
\sin(\Delta\phi).\f$]*/
ISOTROPIC_TL_TV_PROJ_DPHI,/*!< 3D Parametrization where the phi component is projected.
Coordinates are: [\f$\theta_l, \theta_v \cos(\Delta\phi),
\theta_v \sin(\Delta\phi).\f$]*/
ISOTROPIC_TD_PD, /*!< Difference between two directions such as R and H */
CARTESIAN, /*!< Light and View vectors represented in cartesian coordinates */
......
# Building datas
SConscript('data_merl/SConscript')
SConscript('data_brdf_slice/SConscript')
SConscript('data_interpolant/SConscript')
# Building fitters
SConscript('nonlinear_fitter_ceres/SConscript')
......@@ -9,5 +13,6 @@ SConscript('nonlinear_function_beckmann/SConscript')
SConscript('nonlinear_function_retrobeckmann/SConscript')
SConscript('nonlinear_function_blinn/SConscript')
SConscript('nonlinear_function_retroblinn/SConscript')
SConscript('nonlinear_function_retroyoo/SConscript')
SConscript('rational_function_legendre/SConscript')
SConscript('rational_function_chebychev/SConscript')