Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Cazier
CGoGN
Commits
109259db
Commit
109259db
authored
Apr 26, 2011
by
CGoGN GIT Supervisor
Browse files
Merge branch 'master' of /home/vanhoey/CGoGN
parents
09bf6799
9fa126d1
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/Geometry/matrix.h
View file @
109259db
...
...
@@ -161,11 +161,15 @@ class Matrix
// Vector / Matrix multiplication
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
Vector
<
M
,
T
>
operator
*
(
const
Vector
<
N
,
T
>&
v
,
const
Matrix
<
M
,
N
,
T
>&
m
);
Vector
<
M
,
T
>
operator
*
(
const
Vector
<
N
,
T
>&
v
,
const
Matrix
<
M
,
N
,
T
>&
m
)
;
// Scalar / Matrix multiplication
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
Matrix
<
M
,
N
,
T
>
operator
*
(
T
s
,
const
Matrix
<
M
,
N
,
T
>&
m
);
Matrix
<
M
,
N
,
T
>
operator
*
(
T
s
,
const
Matrix
<
M
,
N
,
T
>&
m
)
;
// Vector / Transposed vector multiplication
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
Matrix
<
M
,
N
,
T
>
transposed_vectors_mult
(
const
Vector
<
M
,
T
>&
v1
,
const
Vector
<
N
,
T
>&
v2
)
;
/**********************************************/
...
...
include/Geometry/matrix.hpp
View file @
109259db
...
...
@@ -405,9 +405,11 @@ bool Matrix<M,N,T>::operator==(const Matrix<M,N,T>& m) const {
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
Matrix
<
M
,
N
,
T
>&
m
)
{
for
(
unsigned
int
i
=
0
;
i
<
M
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
M
;
++
i
)
{
for
(
unsigned
int
j
=
0
;
j
<
N
;
++
j
)
out
<<
m
(
i
,
j
)
<<
" "
;
std
::
cout
<<
std
::
endl
;
}
return
out
;
}
...
...
@@ -446,6 +448,15 @@ Matrix<M,N,T> operator*(T s, const Matrix<M,N,T>& m)
return
res
;
}
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
Matrix
<
M
,
N
,
T
>
transposed_vectors_mult
(
const
Vector
<
M
,
T
>&
v1
,
const
Vector
<
N
,
T
>&
v2
)
{
Matrix
<
M
,
N
,
T
>
res
;
for
(
unsigned
int
i
=
0
;
i
<
M
;
++
i
)
for
(
unsigned
int
j
=
0
;
j
<
N
;
++
j
)
res
(
i
,
j
)
=
v1
[
i
]
*
v2
[
j
]
;
return
res
;
}
}
// namespace Geom
}
// namespace CGoGN
include/Utils/colourConverter.h
View file @
109259db
...
...
@@ -71,6 +71,16 @@ public: // methods
*/
~
ColourConverter
()
{}
;
/**
* getR
* @return original value (in its original space)
*/
VEC3
getOriginal
()
;
/**
* getR
* @return enc value of provided colour
*/
VEC3
getColour
(
enum
ColourEncoding
enc
)
;
/**
* getR
* @return RGB value of provided colour
...
...
include/Utils/colourConverter.hpp
View file @
109259db
...
...
@@ -65,6 +65,36 @@ ColourConverter<REAL>::ColourConverter(VEC3 col, enum ColourEncoding enc) :
}
}
template
<
typename
REAL
>
Geom
::
Vector
<
3
,
REAL
>
ColourConverter
<
REAL
>::
getColour
(
enum
ColourEncoding
enc
)
{
switch
(
enc
)
{
case
(
C_RGB
)
:
return
getRGB
()
;
break
;
case
(
C_XYZ
)
:
return
getXYZ
()
;
break
;
case
(
C_Luv
)
:
return
getLuv
()
;
break
;
case
(
C_Lab
)
:
return
getLab
()
;
break
;
default
:
assert
(
!
"Should never arrive here : ColourConverter::getColour default case"
)
;
return
getOriginal
()
;
}
}
template
<
typename
REAL
>
Geom
::
Vector
<
3
,
REAL
>
ColourConverter
<
REAL
>::
getOriginal
()
{
return
getColour
(
this
->
originalEnc
)
;
}
template
<
typename
REAL
>
Geom
::
Vector
<
3
,
REAL
>
ColourConverter
<
REAL
>::
getRGB
()
{
if
(
RGB
==
NULL
)
...
...
@@ -150,7 +180,7 @@ void ColourConverter<REAL>::convertXYZtoLuv() {
REAL
Ydiv
=
Y
/
Yn
;
if
(
Ydiv
>
0.008856
)
L
=
116.0
*
pow
(
Ydiv
,
1.0
f
/
3.0
)
-
16.0
;
L
=
116.0
*
pow
(
Ydiv
,
1.0
/
3.0
)
-
16.0
;
else
// near black
L
=
903.3
*
Ydiv
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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