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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
327c437b
Commit
327c437b
authored
Oct 05, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of cgogn:~vanhoey/CGoGN
parents
a14c6c9e
686246fe
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
39 deletions
+28
-39
README.TXT
README.TXT
+1
-1
include/Utils/qem.h
include/Utils/qem.h
+27
-38
No files found.
README.TXT
View file @
327c437b
Dépendences Linux:
installer les paquets suivants:
cmake libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev
cmake libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev
libgsl0-dev
Pour compiler CGoGN:
- aller dans ThirdParty, cd build, taper "cmake .", puis make ( avec -j x si vous avez x core sur votre machine)
...
...
include/Utils/qem.h
View file @
327c437b
...
...
@@ -32,9 +32,8 @@
#include "Geometry/matrix.h"
#include "Geometry/plane_3d.h"
// GSL includes
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
// Eigen includes
#include <Eigen/Dense>
namespace
CGoGN
{
...
...
@@ -326,51 +325,41 @@ public:
QuadricHF
()
{
m_A
=
gsl_matrix_alloc
(
0
,
0
)
;
m_b
=
gsl_vector_alloc
(
0
)
;
m_A
.
resize
(
0
,
0
)
;
m_b
.
resize
(
0
)
;
m_c
=
0
;
}
QuadricHF
(
int
i
)
:
m_A
(
NULL
),
m_b
(
NULL
),
m_c
(
0
)
QuadricHF
(
int
i
)
{
m_A
=
gsl_matrix_calloc
(
i
,
i
)
;
m_b
=
gsl_vector_calloc
(
i
)
;
m_A
.
resize
(
i
,
i
)
;
m_b
.
resize
(
i
)
;
m_c
=
0
;
}
QuadricHF
(
const
std
::
vector
<
VEC3
>&
coefs
,
const
REAL
&
gamma
,
const
REAL
&
alpha
)
{
m_A
=
gsl_matrix_calloc
(
coefs
.
size
(),
coefs
.
size
())
;
m_b
=
gsl_vector_calloc
(
coefs
.
size
())
;
m_A
.
resize
(
coefs
.
size
(),
coefs
.
size
())
;
m_b
.
resize
(
coefs
.
size
())
;
m_c
=
0
;
// TODO : build A, b and c
assert
(
false
||
!
"todo"
)
;
}
~
QuadricHF
()
{
gsl_matrix_free
(
m_A
)
;
gsl_vector_free
(
m_b
)
;
}
{}
void
zero
()
{
gsl_matrix_set_zero
(
m_A
)
;
gsl_vector_set_zero
(
m_b
)
;
m_A
.
setZero
(
)
;
m_b
.
setZero
(
)
;
m_c
=
0
;
}
QuadricHF
&
operator
=
(
const
QuadricHF
<
REAL
>&
q
)
{
m_A
=
gsl_matrix_alloc
(
q
.
m_A
->
size1
,
q
.
m_A
->
size1
)
;
gsl_matrix_memcpy
(
m_A
,
q
.
m_A
)
;
m_b
=
gsl_vector_alloc
(
m_b
->
size
)
;
gsl_vector_memcpy
(
m_b
,
q
.
m_b
)
;
m_A
=
q
.
m_A
;
m_b
=
q
.
m_b
;
m_c
=
q
.
m_c
;
return
*
this
;
...
...
@@ -378,12 +367,12 @@ public:
QuadricHF
&
operator
+=
(
const
QuadricHF
<
REAL
>&
q
)
{
assert
(((
m_A
->
size1
==
q
.
m_A
->
size1
)
&&
(
m_A
->
size2
==
q
.
m_A
->
size2
)
&&
m_b
->
size
==
q
.
m_b
->
size
)
||
!
"Incompatible add of matrices"
)
;
if
((
m_A
->
size1
==
q
.
m_A
->
size1
)
&&
(
m_A
->
size2
==
q
.
m_A
->
size2
)
&&
(
m_b
->
size
==
q
.
m_b
->
size
))
assert
(((
m_A
.
cols
()
==
q
.
m_A
.
cols
())
&&
(
m_A
.
rows
()
==
q
.
m_A
.
rows
())
&&
m_b
.
size
()
==
q
.
m_b
.
size
()
)
||
!
"Incompatible add of matrices"
)
;
if
((
m_A
.
cols
()
==
q
.
m_A
.
cols
())
&&
(
m_A
.
rows
()
==
q
.
m_A
.
rows
())
&&
(
m_b
.
size
()
==
q
.
m_b
.
size
()
))
return
*
this
;
gsl_matrix_add
(
m_A
,
q
.
m_A
)
;
gsl_vector_add
(
m_b
,
q
.
m_b
)
;
m_A
+=
q
.
m_A
;
m_b
+=
q
.
m_b
;
m_c
+=
q
.
m_c
;
return
*
this
;
...
...
@@ -391,12 +380,12 @@ public:
QuadricHF
&
operator
-=
(
const
QuadricHF
<
REAL
>&
q
)
{
assert
(((
m_A
->
size1
==
q
.
m_A
->
size1
)
&&
(
m_A
->
size2
==
q
.
m_A
->
size2
)
&&
m_b
->
size
==
q
.
m_b
->
size
)
||
!
"Incompatible add of matrices"
)
;
if
((
m_A
->
size1
==
q
.
m_A
->
size1
)
&&
(
m_A
->
size2
==
q
.
m_A
->
size2
)
&&
(
m_b
->
size
==
q
.
m_b
->
size
))
assert
(((
m_A
.
cols
()
==
q
.
m_A
.
cols
())
&&
(
m_A
.
rows
()
==
q
.
m_A
.
rows
())
&&
m_b
.
size
()
==
q
.
m_b
.
size
()
)
||
!
"Incompatible add of matrices"
)
;
if
((
m_A
.
cols
()
==
q
.
m_A
.
cols
())
&&
(
m_A
.
rows
()
==
q
.
m_A
.
rows
())
&&
(
m_b
.
size
()
==
q
.
m_b
.
size
()
))
return
*
this
;
gsl_matrix_sub
(
m_A
,
q
.
m_A
)
;
gsl_vector_sub
(
m_b
,
q
.
m_b
)
;
m_A
-=
q
.
m_A
;
m_b
-=
q
.
m_b
;
m_c
-=
q
.
m_c
;
return
*
this
;
...
...
@@ -404,8 +393,8 @@ public:
QuadricHF
&
operator
*=
(
const
REAL
&
v
)
{
gsl_matrix_scale
(
m_A
,
v
)
;
gsl_vector_scale
(
m_b
,
v
)
;
m_A
*=
v
;
m_b
*=
v
;
m_c
*=
v
;
return
*
this
;
...
...
@@ -455,8 +444,8 @@ public:
private:
// Double computation is crucial for stability
gsl_matrix
*
m_A
;
gsl_vector
*
m_b
;
Eigen
::
MatrixXd
m_A
;
Eigen
::
VectorXd
m_b
;
double
m_c
;
REAL
evaluate
(
const
std
::
vector
<
VEC3
>&
coefs
)
const
...
...
@@ -468,7 +457,7 @@ private:
bool
optimize
(
std
::
vector
<
VEC3
>&
coefs
)
const
{
coefs
.
reserve
(
m_b
->
size
)
;
coefs
.
reserve
(
m_b
.
size
()
)
;
// TODO
/* if (std::isnan(A(0,0)))
...
...
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