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
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
66af095d
Commit
66af095d
authored
Jun 04, 2015
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing Utils
parent
2e16f9c5
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
289 additions
and
106 deletions
+289
-106
Apps/Tests/CMakeLists.txt
Apps/Tests/CMakeLists.txt
+2
-1
Apps/Tests/Utils/CMakeLists.txt
Apps/Tests/Utils/CMakeLists.txt
+18
-0
Apps/Tests/Utils/colorMaps.cpp
Apps/Tests/Utils/colorMaps.cpp
+3
-0
Apps/Tests/Utils/colourConverter.cpp
Apps/Tests/Utils/colourConverter.cpp
+14
-0
Apps/Tests/Utils/qem.cpp
Apps/Tests/Utils/qem.cpp
+19
-0
Apps/Tests/Utils/quadricRGBfunctions.cpp
Apps/Tests/Utils/quadricRGBfunctions.cpp
+11
-0
Apps/Tests/Utils/quantization.cpp
Apps/Tests/Utils/quantization.cpp
+21
-0
Apps/Tests/Utils/shared_mem.cpp
Apps/Tests/Utils/shared_mem.cpp
+17
-0
Apps/Tests/Utils/sphericalHarmonics.cpp
Apps/Tests/Utils/sphericalHarmonics.cpp
+15
-0
Apps/Tests/Utils/test_utils.cpp
Apps/Tests/Utils/test_utils.cpp
+26
-0
Apps/Tests/Utils/textures.cpp
Apps/Tests/Utils/textures.cpp
+25
-0
CGoGN/include/Geometry/frame.h
CGoGN/include/Geometry/frame.h
+1
-1
CGoGN/include/Utils/colourConverter.h
CGoGN/include/Utils/colourConverter.h
+13
-5
CGoGN/include/Utils/colourConverter.hpp
CGoGN/include/Utils/colourConverter.hpp
+68
-51
CGoGN/include/Utils/qem.hpp
CGoGN/include/Utils/qem.hpp
+6
-6
CGoGN/include/Utils/quadricRGBfunctions.h
CGoGN/include/Utils/quadricRGBfunctions.h
+9
-1
CGoGN/include/Utils/quadricRGBfunctions.hpp
CGoGN/include/Utils/quadricRGBfunctions.hpp
+9
-0
CGoGN/include/Utils/quantization.h
CGoGN/include/Utils/quantization.h
+5
-7
CGoGN/include/Utils/quantization.hpp
CGoGN/include/Utils/quantization.hpp
+4
-7
CGoGN/include/Utils/textures.hpp
CGoGN/include/Utils/textures.hpp
+3
-27
No files found.
Apps/Tests/CMakeLists.txt
View file @
66af095d
...
@@ -2,8 +2,9 @@ cmake_minimum_required(VERSION 2.6)
...
@@ -2,8 +2,9 @@ cmake_minimum_required(VERSION 2.6)
project
(
testing
)
project
(
testing
)
add_subdirectory
(
Geometry
)
add_subdirectory
(
Algo
)
add_subdirectory
(
Algo
)
add_subdirectory
(
Geometry
)
add_subdirectory
(
Utils
)
#define exec to compile
#define exec to compile
...
...
Apps/Tests/Utils/CMakeLists.txt
0 → 100644
View file @
66af095d
cmake_minimum_required
(
VERSION 2.6
)
project
(
testing_utils
)
add_executable
(
test_utils
test_utils.cpp
colorMaps.cpp
colourConverter.cpp
qem.cpp
quadricRGBfunctions.cpp
quantization.cpp
# shared_mem.cpp
sphericalHarmonics.cpp
textures.cpp
)
target_link_libraries
(
test_utils
${
CGoGN_LIBS
}
${
CGoGN_EXT_LIBS
}
)
Apps/Tests/Utils/colorMaps.cpp
0 → 100644
View file @
66af095d
//
// TODO template<REAL> instead of float
Apps/Tests/Utils/colourConverter.cpp
0 → 100644
View file @
66af095d
#include "Utils/colourConverter.h"
template
class
CGoGN
::
Utils
::
ColourConverter
<
float
>;
template
class
CGoGN
::
Utils
::
ColourConverter
<
double
>;
int
test_colourConverter
()
{
return
0
;
}
Apps/Tests/Utils/qem.cpp
0 → 100644
View file @
66af095d
#include "Utils/qem.h"
template
class
CGoGN
::
Utils
::
Quadric
<
float
>;
template
class
CGoGN
::
Utils
::
Quadric
<
double
>;
template
class
CGoGN
::
Utils
::
QuadricNd
<
float
,
5
>;
template
class
CGoGN
::
Utils
::
QuadricNd
<
double
,
6
>;
template
class
CGoGN
::
Utils
::
QuadricHF
<
float
>;
template
class
CGoGN
::
Utils
::
QuadricHF
<
double
>;
int
test_qem
()
{
return
0
;
}
Apps/Tests/Utils/quadricRGBfunctions.cpp
0 → 100644
View file @
66af095d
#include "Utils/quadricRGBfunctions.h"
template
class
CGoGN
::
Utils
::
QuadricRGBfunctions
<
float
>;
template
class
CGoGN
::
Utils
::
QuadricRGBfunctions
<
double
>;
int
test_quadricRGBfunctions
()
{
return
0
;
}
\ No newline at end of file
Apps/Tests/Utils/quantization.cpp
0 → 100644
View file @
66af095d
#include "Utils/quantization.h"
#include "Geometry/vector_gen.h"
using
namespace
CGoGN
;
template
struct
Utils
::
CodeVector
<
Geom
::
Vec3f
>;
template
struct
Utils
::
CodeVector
<
Geom
::
Vec3d
>;
template
struct
Utils
::
CodeVector
<
Geom
::
Vec4d
>;
template
class
Utils
::
Quantization
<
Geom
::
Vec3f
>;
template
class
Utils
::
Quantization
<
Geom
::
Vec3d
>;
template
class
Utils
::
Quantization
<
Geom
::
Vec4d
>;
int
test_quantization
()
{
return
0
;
}
Apps/Tests/Utils/shared_mem.cpp
0 → 100644
View file @
66af095d
#include "Utils/shared_mem.h"
#include "Geometry/vector_gen.h"
template
class
CGoGN
::
Utils
::
SharedMemSeg
<
int
>;
template
class
CGoGN
::
Utils
::
SharedMemSeg
<
float
>;
template
class
CGoGN
::
Utils
::
SharedMemSeg
<
double
>;
template
class
CGoGN
::
Utils
::
SharedMemSeg
<
CGoGN
::
Geom
::
Vec4f
>;
int
test_shared_mem
()
{
return
0
;
}
Apps/Tests/Utils/sphericalHarmonics.cpp
0 → 100644
View file @
66af095d
#include "Utils/sphericalHarmonics.h"
template
class
CGoGN
::
Utils
::
SphericalHarmonics
<
float
,
float
>;
template
class
CGoGN
::
Utils
::
SphericalHarmonics
<
double
,
double
>;
template
class
CGoGN
::
Utils
::
SphericalHarmonics
<
float
,
double
>;
template
class
CGoGN
::
Utils
::
SphericalHarmonics
<
double
,
float
>;
int
test_sphericalHarmonics
()
{
return
0
;
}
Apps/Tests/Utils/test_utils.cpp
0 → 100644
View file @
66af095d
#include <iostream>
// no header files test function names from cpp files
//extern int test_colorMaps();
extern
int
test_colourConverter
();
extern
int
test_qem
();
extern
int
test_quadricRGBfunctions
();
extern
int
test_quantization
();
//extern int test_shared_mem();
extern
int
test_sphericalHarmonics
();
extern
int
test_texture
();
int
main
()
{
//test_colorMaps();
test_colourConverter
();
test_qem
();
test_quadricRGBfunctions
();
test_quantization
();
// test_shared_mem();
test_sphericalHarmonics
();
test_texture
();
return
0
;
}
Apps/Tests/Utils/textures.cpp
0 → 100644
View file @
66af095d
#include "Utils/textures.h"
template
class
CGoGN
::
Utils
::
Filter
<
2
>;
template
class
CGoGN
::
Utils
::
Filter
<
3
>;
template
class
CGoGN
::
Utils
::
ImageData
<
2
,
unsigned
char
>;
template
class
CGoGN
::
Utils
::
Image
<
2
,
unsigned
char
>;
template
class
CGoGN
::
Utils
::
Texture
<
2
,
unsigned
char
>;
template
class
CGoGN
::
Utils
::
ImageData
<
2
,
int
>;
template
class
CGoGN
::
Utils
::
Image
<
2
,
int
>;
template
class
CGoGN
::
Utils
::
Texture
<
2
,
int
>;
template
class
CGoGN
::
Utils
::
ImageData
<
2
,
double
>;
template
class
CGoGN
::
Utils
::
Image
<
2
,
double
>;
template
class
CGoGN
::
Utils
::
Texture
<
2
,
double
>;
int
test_texture
()
{
return
0
;
}
\ No newline at end of file
CGoGN/include/Geometry/frame.h
View file @
66af095d
...
@@ -218,7 +218,7 @@ private : // private constants
...
@@ -218,7 +218,7 @@ private : // private constants
//static const REAL Zy = -0.685222 ;
//static const REAL Zy = -0.685222 ;
//static const REAL Zz = 0.339219 ;
//static const REAL Zz = 0.339219 ;
// only integral static const can
a
be init inline in standard C++ (float init is gcc extension)
// only integral static const can be init inline in standard C++ (float init is gcc extension)
static
const
REAL
Xx
;
static
const
REAL
Xx
;
static
const
REAL
Xy
;
static
const
REAL
Xy
;
static
const
REAL
Xz
;
static
const
REAL
Xz
;
...
...
CGoGN/include/Utils/colourConverter.h
View file @
66af095d
...
@@ -167,13 +167,21 @@ private: // private members
...
@@ -167,13 +167,21 @@ private: // private members
private:
// private constants
private:
// private constants
// D65 reference white
// D65 reference white
static
constexpr
REAL
Xn
=
0.950456
;
//
static constexpr REAL Xn = 0.950456 ;
static
constexpr
REAL
Yn
=
1.0
;
//
static constexpr REAL Yn = 1.0 ;
static
constexpr
REAL
Zn
=
1.088754
;
//
static constexpr REAL Zn = 1.088754 ;
static
constexpr
REAL
un
=
0.197832
;
//
static constexpr REAL un = 0.197832 ;
static
constexpr
REAL
vn
=
0.468340
;
//
static constexpr REAL vn = 0.468340 ;
// constexpr not supported in VS2013
static
const
REAL
Xn
;
static
const
REAL
Yn
;
static
const
REAL
Zn
;
static
const
REAL
un
;
static
const
REAL
vn
;
}
;
}
;
}
// namespace Utils
}
// namespace Utils
...
...
CGoGN/include/Utils/colourConverter.hpp
View file @
66af095d
...
@@ -22,12 +22,29 @@
...
@@ -22,12 +22,29 @@
* *
* *
*******************************************************************************/
*******************************************************************************/
#include <algorithm>
namespace
CGoGN
namespace
CGoGN
{
{
namespace
Utils
namespace
Utils
{
{
template
<
typename
REAL
>
const
REAL
ColourConverter
<
REAL
>::
Xn
=
REAL
(
0.950456
);
template
<
typename
REAL
>
const
REAL
ColourConverter
<
REAL
>::
Yn
=
REAL
(
1.0
);
template
<
typename
REAL
>
const
REAL
ColourConverter
<
REAL
>::
Zn
=
REAL
(
1.088754
);
template
<
typename
REAL
>
const
REAL
ColourConverter
<
REAL
>::
un
=
REAL
(
0.197832
);
template
<
typename
REAL
>
const
REAL
ColourConverter
<
REAL
>::
vn
=
REAL
(
0.468340
);
template
<
typename
REAL
>
template
<
typename
REAL
>
ColourConverter
<
REAL
>::
ColourConverter
(
const
VEC3
&
col
,
const
enum
ColourEncoding
&
enc
)
:
ColourConverter
<
REAL
>::
ColourConverter
(
const
VEC3
&
col
,
const
enum
ColourEncoding
&
enc
)
:
RGB
(
NULL
),
RGB
(
NULL
),
...
@@ -209,17 +226,17 @@ ColourConverter<REAL>::convertRGBtoXYZ()
...
@@ -209,17 +226,17 @@ ColourConverter<REAL>::convertRGBtoXYZ()
{
{
Geom
::
Matrix
<
3
,
3
,
REAL
>
M
;
Geom
::
Matrix
<
3
,
3
,
REAL
>
M
;
M
(
0
,
0
)
=
0.412453
;
M
(
0
,
0
)
=
REAL
(
0.412453
)
;
M
(
0
,
1
)
=
0.357580
;
M
(
0
,
1
)
=
REAL
(
0.357580
)
;
M
(
0
,
2
)
=
0.180423
;
M
(
0
,
2
)
=
REAL
(
0.180423
)
;
M
(
1
,
0
)
=
0.212671
;
M
(
1
,
0
)
=
REAL
(
0.212671
)
;
M
(
1
,
1
)
=
0.715160
;
M
(
1
,
1
)
=
REAL
(
0.715160
)
;
M
(
1
,
2
)
=
0.072169
;
M
(
1
,
2
)
=
REAL
(
0.072169
)
;
M
(
2
,
0
)
=
0.019334
;
M
(
2
,
0
)
=
REAL
(
0.019334
)
;
M
(
2
,
1
)
=
0.119193
;
M
(
2
,
1
)
=
REAL
(
0.119193
)
;
M
(
2
,
2
)
=
0.950227
;
M
(
2
,
2
)
=
REAL
(
0.950227
)
;
VEC3
c
=
M
*
(
*
RGB
)
;
VEC3
c
=
M
*
(
*
RGB
)
;
...
@@ -235,17 +252,17 @@ ColourConverter<REAL>::convertXYZtoRGB()
...
@@ -235,17 +252,17 @@ ColourConverter<REAL>::convertXYZtoRGB()
{
{
Geom
::
Matrix
<
3
,
3
,
REAL
>
M
;
Geom
::
Matrix
<
3
,
3
,
REAL
>
M
;
M
(
0
,
0
)
=
3.240479
;
M
(
0
,
0
)
=
REAL
(
3.240479
)
;
M
(
0
,
1
)
=
-
1.537150
;
M
(
0
,
1
)
=
REAL
(
-
1.537150
)
;
M
(
0
,
2
)
=
-
0.498535
;
M
(
0
,
2
)
=
REAL
(
-
0.498535
)
;
M
(
1
,
0
)
=
-
0.969256
;
M
(
1
,
0
)
=
REAL
(
-
0.969256
)
;
M
(
1
,
1
)
=
1.875992
;
M
(
1
,
1
)
=
REAL
(
1.875992
)
;
M
(
1
,
2
)
=
0.041556
;
M
(
1
,
2
)
=
REAL
(
0.041556
)
;
M
(
2
,
0
)
=
0.055648
;
M
(
2
,
0
)
=
REAL
(
0.055648
)
;
M
(
2
,
1
)
=
-
0.204043
;
M
(
2
,
1
)
=
REAL
(
-
0.204043
)
;
M
(
2
,
2
)
=
1.057311
;
M
(
2
,
2
)
=
REAL
(
1.057311
)
;
VEC3
c
=
M
*
(
*
XYZ
)
;
VEC3
c
=
M
*
(
*
XYZ
)
;
...
@@ -274,7 +291,7 @@ ColourConverter<REAL>::convertRGBtoHSV()
...
@@ -274,7 +291,7 @@ ColourConverter<REAL>::convertRGBtoHSV()
const
REAL
diff
=
max
-
min
;
const
REAL
diff
=
max
-
min
;
V
=
max
;
V
=
max
;
S
=
max
==
0.
?
0
:
diff
/
max
;
S
=
max
==
0.
0
f
?
0.0
f
:
diff
/
max
;
if
(
max
==
min
)
if
(
max
==
min
)
...
@@ -312,7 +329,7 @@ ColourConverter<REAL>::convertHSVtoRGB()
...
@@ -312,7 +329,7 @@ ColourConverter<REAL>::convertHSVtoRGB()
const
REAL
&
S
=
(
*
HSV
)[
1
]
;
const
REAL
&
S
=
(
*
HSV
)[
1
]
;
const
REAL
&
V
=
(
*
HSV
)[
2
]
;
const
REAL
&
V
=
(
*
HSV
)[
2
]
;
const
int
i
=
std
::
floor
(
H
*
6
);
const
int
i
=
int
(
std
::
floor
(
H
*
6
)
);
const
REAL
f
=
H
*
6
-
i
;
const
REAL
f
=
H
*
6
-
i
;
const
REAL
p
=
V
*
(
1
-
S
);
const
REAL
p
=
V
*
(
1
-
S
);
const
REAL
q
=
V
*
(
1
-
f
*
S
);
const
REAL
q
=
V
*
(
1
-
f
*
S
);
...
@@ -355,7 +372,7 @@ ColourConverter<REAL>::convertRGBtoHSL()
...
@@ -355,7 +372,7 @@ ColourConverter<REAL>::convertRGBtoHSL()
REAL
&
L
=
c
[
2
]
;
REAL
&
L
=
c
[
2
]
;
const
REAL
sum
=
max
+
min
;
const
REAL
sum
=
max
+
min
;
L
=
sum
/
2.
;
L
=
sum
/
2.
0
f
;
if
(
max
==
min
)
if
(
max
==
min
)
{
{
...
@@ -365,7 +382,7 @@ ColourConverter<REAL>::convertRGBtoHSL()
...
@@ -365,7 +382,7 @@ ColourConverter<REAL>::convertRGBtoHSL()
else
else
{
{
const
REAL
diff
=
max
-
min
;
const
REAL
diff
=
max
-
min
;
S
=
L
>
0.5
?
diff
/
(
2
-
sum
)
:
diff
/
sum
;
S
=
L
>
0.5
f
?
diff
/
(
2
-
sum
)
:
diff
/
sum
;
if
(
max
==
r
)
if
(
max
==
r
)
{
{
...
@@ -401,7 +418,7 @@ ColourConverter<REAL>::hue2rgb(const REAL& p, const REAL& q, REAL t)
...
@@ -401,7 +418,7 @@ ColourConverter<REAL>::hue2rgb(const REAL& p, const REAL& q, REAL t)
if
(
t
<
1
/
2.
)
if
(
t
<
1
/
2.
)
return
q
;
return
q
;
if
(
t
<
2
/
3.
)
if
(
t
<
2
/
3.
)
return
p
+
(
q
-
p
)
*
(
2
/
3.
-
t
)
*
6
;
return
p
+
(
q
-
p
)
*
(
REAL
(
2.0
/
3.0
)
-
t
)
*
6.0
f
;
return
p
;
return
p
;
}
}
...
@@ -429,9 +446,9 @@ ColourConverter<REAL>::convertHSLtoRGB()
...
@@ -429,9 +446,9 @@ ColourConverter<REAL>::convertHSLtoRGB()
{
{
const
REAL
q
=
L
<
0.5
?
L
*
(
1
+
S
)
:
L
+
S
-
L
*
S
;
const
REAL
q
=
L
<
0.5
?
L
*
(
1
+
S
)
:
L
+
S
-
L
*
S
;
const
REAL
p
=
2
*
L
-
q
;
const
REAL
p
=
2
*
L
-
q
;
r
=
hue2rgb
(
p
,
q
,
H
+
1
/
3.
)
;
r
=
hue2rgb
(
p
,
q
,
H
+
REAL
(
1.
/
3.
))
;
g
=
hue2rgb
(
p
,
q
,
H
)
;
g
=
hue2rgb
(
p
,
q
,
H
)
;
b
=
hue2rgb
(
p
,
q
,
H
-
1
/
3.
)
;
b
=
hue2rgb
(
p
,
q
,
H
-
REAL
(
1.
/
3.
)
)
;
}
}
if
(
RGB
!=
NULL
)
if
(
RGB
!=
NULL
)
...
@@ -452,13 +469,13 @@ ColourConverter<REAL>::convertXYZtoLuv()
...
@@ -452,13 +469,13 @@ ColourConverter<REAL>::convertXYZtoLuv()
REAL
Ydiv
=
Y
/
Yn
;
REAL
Ydiv
=
Y
/
Yn
;
if
(
Ydiv
>
0.008856
)
if
(
Ydiv
>
0.008856
)
L
=
116.0
*
pow
(
Ydiv
,
1.0
/
3.0
)
-
16.0
;
L
=
116.0
f
*
pow
(
Ydiv
,
1.0
f
/
3.0
f
)
-
16.0
f
;
else
// near black
else
// near black
L
=
903.3
*
Ydiv
;
L
=
903.3
f
*
Ydiv
;
REAL
den
=
X
+
15.0
*
Y
+
3
*
Z
;
REAL
den
=
X
+
15.0
f
*
Y
+
3
*
Z
;
REAL
u1
=
(
4.0
*
X
)
/
den
;
REAL
u1
=
(
4.0
f
*
X
)
/
den
;
REAL
v1
=
(
9.0
*
Y
)
/
den
;
REAL
v1
=
(
9.0
f
*
Y
)
/
den
;
u
=
13
*
L
*
(
u1
-
un
)
;
u
=
13
*
L
*
(
u1
-
un
)
;
v
=
13
*
L
*
(
v1
-
vn
)
;
v
=
13
*
L
*
(
v1
-
vn
)
;
...
@@ -479,16 +496,16 @@ ColourConverter<REAL>::convertLuvToXYZ()
...
@@ -479,16 +496,16 @@ ColourConverter<REAL>::convertLuvToXYZ()
REAL
&
v
=
(
*
Luv
)[
2
]
;
REAL
&
v
=
(
*
Luv
)[
2
]
;
if
(
L
>
8.0
)
if
(
L
>
8.0
)
Y
=
pow
(((
L
+
16.0
)
/
116.0
),
3
)
;
Y
=
pow
(((
L
+
16.0
f
)
/
116.0
f
),
3
)
;
else
// near black
else
// near black
Y
=
Yn
*
L
/
903.3
;
Y
=
Yn
*
L
/
903.3
f
;
REAL
den
=
13.0
*
L
;
REAL
den
=
13.0
f
*
L
;
REAL
u1
=
u
/
den
+
un
;
REAL
u1
=
u
/
den
+
un
;
REAL
v1
=
v
/
den
+
vn
;
REAL
v1
=
v
/
den
+
vn
;
den
=
4.0
*
v1
;
den
=
4.0
f
*
v1
;
X
=
Y
*
9.0
*
u1
/
den
;
X
=
Y
*
9.0
f
*
u1
/
den
;
Z
=
Y
*
(
12.0
-
3.0
*
u1
-
20.0
*
v1
)
/
den
;
Z
=
Y
*
(
12.0
f
-
3.0
f
*
u1
-
20.0
f
*
v1
)
/
den
;
if
(
XYZ
!=
NULL
)
if
(
XYZ
!=
NULL
)
*
XYZ
=
VEC3
(
X
,
Y
,
Z
)
;
*
XYZ
=
VEC3
(
X
,
Y
,
Z
)
;
...
@@ -511,19 +528,19 @@ ColourConverter<REAL>::convertXYZtoLab()
...
@@ -511,19 +528,19 @@ ColourConverter<REAL>::convertXYZtoLab()
static
REAL
f
(
REAL
x
)
static
REAL
f
(
REAL
x
)
{
{
if
(
x
>
0.008856
)
if
(
x
>
0.008856
)
return
pow
(
x
,
1.0
/
3.0
)
;
return
pow
(
x
,
1.0
f
/
3.0
f
)
;
else
else
return
7.787
*
x
+
16.0
/
116.0
;
return
7.787
f
*
x
+
16.0
f
/
116.0
f
;
}
}
}
;
}
;
if
(
Y
>
0.008856
)
if
(
Y
>
0.008856
)
L
=
116.0
f
*
pow
(
Y
,
1.0
f
/
3.0
)
-
16
;
L
=
116.0
f
*
pow
(
Y
,
1.0
f
/
3.0
f
)
-
16
;
else
// near black
else
// near black
L
=
903.3
*
Y
;
L
=
903.3
f
*
Y
;
a
=
500.0
*
(
Local
::
f
(
X
/
Xn
)
-
Local
::
f
(
Y
/
Yn
))
;
a
=
500.0
f
*
(
Local
::
f
(
X
/
Xn
)
-
Local
::
f
(
Y
/
Yn
))
;
b
=
200.0
*
(
Local
::
f
(
Y
/
Yn
)
-
Local
::
f
(
Z
/
Zn
))
;
b
=
200.0
f
*
(
Local
::
f
(
Y
/
Yn
)
-
Local
::
f
(
Z
/
Zn
))
;
if
(
Lab
!=
NULL
)
if
(
Lab
!=
NULL
)
*
Lab
=
VEC3
(
L
,
a
,
b
)
;
*
Lab
=
VEC3
(
L
,
a
,
b
)
;
...
@@ -545,21 +562,21 @@ ColourConverter<REAL>::convertLabToXYZ()
...
@@ -545,21 +562,21 @@ ColourConverter<REAL>::convertLabToXYZ()
{
{
static
REAL
f
(
REAL
x
)
static
REAL
f
(
REAL
x
)
{
{
if
(
x
>
0.206893
)
if
(
x
>
0.206893
f
)
return
pow
(
x
,
3.0
)
;
return
pow
(
x
,
3.0
f
)
;
else
else
return
x
/
7.787
-
16.0
/
903.3
;
return
x
/
7.787
f
-
REAL
(
16.0
/
903.3
)
;
}
}
}
;
}
;
if
(
L
>
8.0
)
if
(
L
>
8.0
f
)
Y
=
pow
(((
L
+
16.0
)
/
116.0
),
3
)
;
Y
=
pow
(((
L
+
16.0
f
)
/
116.0
f
),
3
)
;
else
// near black
else
// near black
Y
=
L
/
903.3
;
Y
=
L
/
903.3
f
;
REAL
nom
=
(
L
+
16.0
)
/
116.0
;
REAL
nom
=
(
L
+
16.0
f
)
/
116.0
f
;
X
=
Xn
*
Local
::
f
(
nom
+
a
/
500.0
)
;
X
=
Xn
*
Local
::
f
(
nom
+
a
/
500.0
f
)
;
Z
=
Zn
*
Local
::
f
(
nom
-
b
/
200.0
)
;
Z
=
Zn
*
Local
::
f
(
nom
-
b
/
200.0
f
)
;
if
(
XYZ
!=
NULL
)
if
(
XYZ
!=
NULL
)
*
XYZ
=
VEC3
(
X
,
Y
,
Z
)
;
*
XYZ
=
VEC3
(
X
,
Y
,
Z
)
;
...
...
CGoGN/include/Utils/qem.hpp
View file @
66af095d
...
@@ -263,7 +263,7 @@ QuadricNd<REAL,N>::operator() (const VECNp& v) const
...
@@ -263,7 +263,7 @@ QuadricNd<REAL,N>::operator() (const VECNp& v) const
for (unsigned int i = 0 ; i < N ; ++i)
for (unsigned int i = 0 ; i < N ; ++i)
hv[i] = v[i] ;
hv[i] = v[i] ;
return evaluate(
v) ;
return evaluate(
hv) ; // v instead of hv !!!
}
}
template <typename REAL, unsigned int N>
template <typename REAL, unsigned int N>
...
@@ -340,7 +340,7 @@ template <typename REAL>
...
@@ -340,7 +340,7 @@ template <typename REAL>
QuadricHF<REAL>::QuadricHF(const Geom::Tensor3d* T, const REAL& gamma, const REAL& alpha):
QuadricHF<REAL>::QuadricHF(const Geom::Tensor3d* T, const REAL& gamma, const REAL& alpha):
m_noAlphaRot(fabs(alpha) < 1e-13)
m_noAlphaRot(fabs(alpha) < 1e-13)
{
{
const unsigned int nbcoefs =
((T[0].order() + 1) * (T[0].order() + 2)) / 2.
;
const unsigned int nbcoefs =
int(((T[0].order() + 1) * (T[0].order() + 2)) / 2.0f )
;
// 2D rotation
// 2D rotation
const Geom::Matrix33d R = buildRotateMatrix(gamma) ;
const Geom::Matrix33d R = buildRotateMatrix(gamma) ;
...
@@ -469,7 +469,7 @@ QuadricHF<REAL>&
...
@@ -469,7 +469,7 @@ QuadricHF<REAL>&
QuadricHF<REAL>::operator /= (const REAL& v)
QuadricHF<REAL>::operator /= (const REAL& v)
{
{
std::cout << "Warning: QuadricHF<REAL>::operator /= should not be used !" << std::endl ;
std::cout << "Warning: QuadricHF<REAL>::operator /= should not be used !" << std::endl ;
const REAL& inv = 1. / v ;
const REAL& inv = 1.
0f
/ v ;