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
927fc518
Commit
927fc518
authored
May 10, 2013
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multi-attributes algorithms comeback
parent
5502db65
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
930 additions
and
180 deletions
+930
-180
include/Algo/Geometry/centroid.hpp
include/Algo/Geometry/centroid.hpp
+13
-6
include/Algo/Modelisation/subdivision.hpp
include/Algo/Modelisation/subdivision.hpp
+16
-8
include/Topology/generic/multi3Attribs.h
include/Topology/generic/multi3Attribs.h
+357
-0
include/Topology/generic/multi4Attribs.h
include/Topology/generic/multi4Attribs.h
+383
-0
include/Topology/generic/multiAttribs.h
include/Topology/generic/multiAttribs.h
+161
-166
No files found.
include/Algo/Geometry/centroid.hpp
View file @
927fc518
...
...
@@ -45,7 +45,9 @@ namespace Geometry
template
<
typename
PFP
,
typename
EMBV
,
typename
EMB
>
EMB
volumeCentroidGen
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
EMBV
&
attributs
,
unsigned
int
thread
)
{
EMB
center
=
AttribOps
::
zero
<
EMB
,
PFP
>
()
;
// EMB center = AttribOps::zero<EMB,PFP>() ;
EMB
center
(
0.0
);
unsigned
int
count
=
0
;
Traversor3WV
<
typename
PFP
::
MAP
>
tra
(
map
,
d
,
false
,
thread
);
...
...
@@ -62,7 +64,8 @@ EMB volumeCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs, uns
template
<
typename
PFP
,
typename
EMBV
,
typename
EMB
>
EMB
volumeCentroidELWGen
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
EMBV
&
attributs
,
unsigned
int
thread
)
{
EMB
center
=
AttribOps
::
zero
<
EMB
,
PFP
>
();
// EMB center = AttribOps::zero<EMB,PFP>();
EMB
center
(
0.0
);
double
count
=
0.0
;
Traversor3WE
<
typename
PFP
::
MAP
>
t
(
map
,
d
,
false
,
thread
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
...
...
@@ -81,7 +84,8 @@ EMB volumeCentroidELWGen(typename PFP::MAP& map, Dart d, const EMBV& attributs,
template
<
typename
PFP
,
typename
EMBV
,
typename
EMB
>
EMB
faceCentroidGen
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
EMBV
&
attributs
)
{
EMB
center
=
AttribOps
::
zero
<
EMB
,
PFP
>
();
// EMB center = AttribOps::zero<EMB,PFP>();
EMB
center
(
0.0
);
unsigned
int
count
=
0
;
Traversor2FV
<
typename
PFP
::
MAP
>
t
(
map
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
...
...
@@ -97,7 +101,8 @@ EMB faceCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs)
template
<
typename
PFP
,
typename
EMBV
,
typename
EMB
>
EMB
faceCentroidELWGen
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
EMBV
&
attributs
)
{
EMB
center
=
AttribOps
::
zero
<
EMB
,
PFP
>
();
// EMB center = AttribOps::zero<EMB,PFP>();
EMB
center
(
0.0
);
double
count
=
0.0
;
Traversor2FE
<
typename
PFP
::
MAP
>
t
(
map
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
...
...
@@ -116,7 +121,8 @@ EMB faceCentroidELWGen(typename PFP::MAP& map, Dart d, const EMBV& attributs)
template
<
typename
PFP
,
typename
EMBV
,
typename
EMB
>
EMB
vertexNeighborhoodCentroidGen
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
EMBV
&
attributs
)
{
EMB
center
=
AttribOps
::
zero
<
EMB
,
PFP
>
();
// EMB center = AttribOps::zero<EMB,PFP>();
EMB
center
(
0.0
);
unsigned
int
count
=
0
;
Traversor2VVaE
<
typename
PFP
::
MAP
>
t
(
map
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
...
...
@@ -248,7 +254,8 @@ namespace Geometry
template
<
typename
PFP
,
typename
EMBV
,
typename
EMB
>
EMB
vertexNeighborhoodCentroidGen
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
EMBV
&
attributs
)
{
EMB
center
=
AttribOps
::
zero
<
EMB
,
PFP
>
();
// EMB center = AttribOps::zero<EMB,PFP>();
EMB
center
(
0.0
);
unsigned
int
count
=
0
;
Traversor3VVaE
<
typename
PFP
::
MAP
>
t
(
map
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
...
...
include/Algo/Modelisation/subdivision.hpp
View file @
927fc518
...
...
@@ -225,7 +225,8 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs)
if
(
!
map
.
isBoundaryMarked2
(
d
)
&&
mf
.
isMarked
(
d
))
// for each face not subdivided
{
// compute center skip darts of new vertices non embedded
EMB
center
=
AttribOps
::
zero
<
EMB
,
PFP
>
();
// EMB center = AttribOps::zero<EMB,PFP>();
EMB
center
(
0.0
);
unsigned
int
count
=
0
;
mf
.
unmarkOrbit
<
FACE
>
(
d
)
;
Dart
it
=
d
;
...
...
@@ -254,8 +255,9 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs)
{
Dart
f1
=
map
.
phi_1
(
x
);
Dart
f2
=
map
.
phi2
(
map
.
phi1
(
map
.
phi2
(
x
)));
EMB
temp
=
AttribOps
::
zero
<
EMB
,
PFP
>
();
temp
=
attributs
[
f1
];
// EMB temp = AttribOps::zero<EMB,PFP>();
// temp = attributs[f1];
EMB
temp
=
attributs
[
f1
];
temp
+=
attributs
[
f2
];
// E' = (V0+V1+F1+F2)/4
temp
*=
0.25
;
attributs
[
x
]
*=
0.5
;
...
...
@@ -269,8 +271,10 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs)
{
m0
.
unmark
(
*
vert
);
EMB
temp
=
AttribOps
::
zero
<
EMB
,
PFP
>
();
EMB
temp2
=
AttribOps
::
zero
<
EMB
,
PFP
>
();
// EMB temp = AttribOps::zero<EMB,PFP>();
// EMB temp2 = AttribOps::zero<EMB,PFP>();
EMB
temp
(
0.0
);
EMB
temp2
(
0.0
);
unsigned
int
n
=
0
;
Dart
x
=
*
vert
;
...
...
@@ -378,8 +382,11 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs)
Dart
dd
=
map
.
phi2
(
d
);
attributs
[
d
]
*=
0.75
;
Dart
e1
=
map
.
template
phi
<
111
>(
d
);
EMB
temp
=
AttribOps
::
zero
<
EMB
,
PFP
>
();
temp
=
attributs
[
e1
];
// EMB temp(0.0);
// temp += attributs[e1];
EMB
temp
=
attributs
[
e1
];
e1
=
map
.
phi_1
(
map
.
phi_1
(
dd
));
temp
+=
attributs
[
e1
];
temp
*=
1.0
/
8.0
;
...
...
@@ -393,7 +400,8 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs)
{
m0
.
unmark
(
*
vert
);
EMB
temp
=
AttribOps
::
zero
<
EMB
,
PFP
>
();
// EMB temp = AttribOps::zero<EMB,PFP>();
EMB
temp
(
0.0
);
int
n
=
0
;
Dart
x
=
*
vert
;
do
...
...
include/Topology/generic/multi3Attribs.h
0 → 100644
View file @
927fc518
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library 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 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library 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 Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __MULTI3ATTRIBS_H_
#define __MULTI3ATTRIBS_H_
namespace
CGoGN
{
//forward
template
<
typename
T1
,
typename
T2
,
typename
T3
>
struct
RefCompo3Type
;
template
<
typename
T1
,
typename
T2
,
typename
T3
>
struct
Compo3Type
{
T1
m_v1
;
T2
m_v2
;
T3
m_v3
;
Compo3Type
(){}
Compo3Type
(
double
z
)
:
m_v1
(
z
),
m_v2
(
z
),
m_v3
(
z
)
{}
Compo3Type
(
const
RefCompo3Type
<
T1
,
T2
,
T3
>&
v
);
Compo3Type
<
T1
,
T2
,
T3
>&
operator
=
(
const
Compo3Type
<
T1
,
T2
,
T3
>&
comp
);
Compo3Type
<
T1
,
T2
,
T3
>
operator
+
(
const
Compo3Type
<
T1
,
T2
,
T3
>&
v
)
const
;
Compo3Type
<
T1
,
T2
,
T3
>
operator
-
(
const
Compo3Type
<
T1
,
T2
,
T3
>&
v
)
const
;
Compo3Type
<
T1
,
T2
,
T3
>
operator
/
(
double
d
)
const
;
Compo3Type
<
T1
,
T2
,
T3
>
operator
*
(
double
d
)
const
;
Compo3Type
<
T1
,
T2
,
T3
>&
operator
+=
(
const
Compo3Type
<
T1
,
T2
,
T3
>&
v
);
Compo3Type
<
T1
,
T2
,
T3
>&
operator
-=
(
const
Compo3Type
<
T1
,
T2
,
T3
>&
v
);
Compo3Type
<
T1
,
T2
,
T3
>&
operator
*=
(
double
d
);
Compo3Type
<
T1
,
T2
,
T3
>&
operator
/=
(
double
d
);
};
template
<
typename
T1
,
typename
T2
,
typename
T3
>
struct
RefCompo3Type
{
T1
&
m_v1
;
T2
&
m_v2
;
T3
&
m_v3
;
RefCompo3Type
(
T1
&
v1
,
T2
&
v2
,
T3
&
v3
)
:
m_v1
(
v1
),
m_v2
(
v2
),
m_v3
(
v3
)
{}
RefCompo3Type
(
Compo3Type
<
T1
,
T2
,
T3
>&
comp
);
RefCompo3Type
<
T1
,
T2
,
T3
>&
operator
=
(
const
RefCompo3Type
<
T1
,
T2
,
T3
>&
v
);
Compo3Type
<
T1
,
T2
,
T3
>
operator
+
(
const
RefCompo3Type
<
T1
,
T2
,
T3
>&
v
)
const
;
Compo3Type
<
T1
,
T2
,
T3
>
operator
-
(
const
RefCompo3Type
<
T1
,
T2
,
T3
>&
v
)
const
;
Compo3Type
<
T1
,
T2
,
T3
>
operator
/
(
double
d
)
const
;
Compo3Type
<
T1
,
T2
,
T3
>
operator
*
(
double
d
)
const
;
RefCompo3Type
<
T1
,
T2
,
T3
>&
operator
+=
(
const
RefCompo3Type
<
T1
,
T2
,
T3
>&
v
);
RefCompo3Type
<
T1
,
T2
,
T3
>&
operator
-=
(
const
RefCompo3Type
<
T1
,
T2
,
T3
>&
v
);
RefCompo3Type
<
T1
,
T2
,
T3
>&
operator
*=
(
double
d
);
RefCompo3Type
<
T1
,
T2
,
T3
>&
operator
/=
(
double
d
);
};
template
<
typename
T1
,
typename
T2
,
typename
T3
>
class
Vertex3Attributes
{
VertexAttribute
<
T1
>&
m_h1
;
VertexAttribute
<
T2
>&
m_h2
;
VertexAttribute
<
T3
>&
m_h3
;
public:
typedef
Compo3Type
<
T1
,
T2
,
T3
>
VALUE
;
typedef
RefCompo3Type
<
T1
,
T2
,
T3
>
REF
;
Vertex3Attributes
(
VertexAttribute
<
T1
>&
h1
,
VertexAttribute
<
T2
>&
h2
,
VertexAttribute
<
T3
>&
h3
)
:
m_h1
(
h1
),
m_h2
(
h2
),
m_h3
(
h3
)
{}
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
unsigned
int
a
)
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
a
],
m_h2
[
a
],
m_h3
[
a
]);
}
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
Dart
d
)
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
d
],
m_h2
[
d
],
m_h3
[
d
]);
}
};
template
<
typename
T1
,
typename
T2
,
typename
T3
>
class
Face3Attributes
{
FaceAttribute
<
T1
>&
m_h1
;
FaceAttribute
<
T2
>&
m_h2
;
FaceAttribute
<
T3
>&
m_h3
;
public:
typedef
Compo3Type
<
T1
,
T2
,
T3
>
VALUE
;
typedef
RefCompo3Type
<
T1
,
T2
,
T3
>
REF
;
Face3Attributes
(
FaceAttribute
<
T1
>&
h1
,
FaceAttribute
<
T2
>&
h2
,
FaceAttribute
<
T3
>&
h3
)
:
m_h1
(
h1
),
m_h2
(
h2
),
m_h3
(
h3
)
{}
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
unsigned
int
a
)
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
a
],
m_h2
[
a
],
m_h3
[
a
]);
}
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
Dart
d
)
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
d
],
m_h2
[
d
],
m_h3
[
d
]);
}
};
template
<
typename
T1
,
typename
T2
,
typename
T3
>
class
Volume3Attributes
{
VolumeAttribute
<
T1
>&
m_h1
;
VolumeAttribute
<
T2
>&
m_h2
;
VolumeAttribute
<
T3
>&
m_h3
;
public:
typedef
Compo3Type
<
T1
,
T2
,
T3
>
VALUE
;
typedef
RefCompo3Type
<
T1
,
T2
,
T3
>
REF
;
Volume3Attributes
(
VolumeAttribute
<
T1
>&
h1
,
VolumeAttribute
<
T2
>&
h2
,
VolumeAttribute
<
T2
>&
h3
)
:
m_h1
(
h1
),
m_h2
(
h2
),
m_h3
(
h3
)
{}
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
unsigned
int
a
)
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
a
],
m_h2
[
a
],
m_h3
[
a
]);
}
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
Dart
d
)
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
d
],
m_h2
[
d
],
m_h3
[
d
]);
}
};
/// implementation
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>&
Compo3Type
<
T1
,
T2
,
T3
>::
operator
=
(
const
Compo3Type
<
T1
,
T2
,
T3
>&
comp
)
{
m_v1
=
comp
.
m_v1
;
m_v2
=
comp
.
m_v2
;
m_v3
=
comp
.
m_v3
;
return
*
this
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>::
Compo3Type
(
const
RefCompo3Type
<
T1
,
T2
,
T3
>
&
v
)
{
m_v1
=
v
.
m_v1
;
m_v2
=
v
.
m_v2
;
m_v3
=
v
.
m_v3
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>
Compo3Type
<
T1
,
T2
,
T3
>::
operator
+
(
const
Compo3Type
<
T1
,
T2
,
T3
>&
v
)
const
{
Compo3Type
<
T1
,
T2
,
T3
>
res
;
res
.
m_v1
=
this
->
m_v1
+
v
.
m_v1
;
res
.
m_v2
=
this
->
m_v2
+
v
.
m_v2
;
res
.
m_v3
=
this
->
m_v3
+
v
.
m_v3
;
return
res
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>
Compo3Type
<
T1
,
T2
,
T3
>::
operator
-
(
const
Compo3Type
<
T1
,
T2
,
T3
>&
v
)
const
{
Compo3Type
<
T1
,
T2
,
T3
>
res
;
res
.
m_v1
=
this
->
m_v1
-
v
.
m_v1
;
res
.
m_v2
=
this
->
m_v2
-
v
.
m_v2
;
res
.
m_v3
=
this
->
m_v3
-
v
.
m_v3
;
return
res
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>
Compo3Type
<
T1
,
T2
,
T3
>::
operator
/
(
double
d
)
const
{
Compo3Type
<
T1
,
T2
,
T3
>
res
;
res
.
m_v1
=
this
->
m_v1
/
d
;
res
.
m_v2
=
this
->
m_v2
/
d
;
res
.
m_v3
=
this
->
m_v3
/
d
;
return
res
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>
Compo3Type
<
T1
,
T2
,
T3
>::
operator
*
(
double
d
)
const
{
Compo3Type
<
T1
,
T2
,
T3
>
res
;
res
.
m_v1
=
this
->
m_v1
*
d
;
res
.
m_v2
=
this
->
m_v2
*
d
;
res
.
m_v3
=
this
->
m_v3
*
d
;
return
res
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>&
Compo3Type
<
T1
,
T2
,
T3
>::
operator
+=
(
const
Compo3Type
<
T1
,
T2
,
T3
>&
v
)
{
m_v1
+=
v
.
m_v1
;
m_v2
+=
v
.
m_v2
;
m_v3
+=
v
.
m_v3
;
return
*
this
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>&
Compo3Type
<
T1
,
T2
,
T3
>::
operator
-=
(
const
Compo3Type
<
T1
,
T2
,
T3
>&
v
)
{
m_v1
+=
v
.
m_v1
;
m_v2
-=
v
.
m_v2
;
m_v3
-=
v
.
m_v3
;
return
*
this
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>&
Compo3Type
<
T1
,
T2
,
T3
>::
operator
*=
(
double
d
)
{
m_v1
*=
d
;
m_v2
*=
d
;
m_v3
*=
d
;
return
*
this
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>&
Compo3Type
<
T1
,
T2
,
T3
>::
operator
/=
(
double
d
)
{
m_v1
/=
d
;
m_v2
/=
d
;
m_v3
/=
d
;
return
*
this
;
}
/// Ref version
template
<
typename
T1
,
typename
T2
,
typename
T3
>
RefCompo3Type
<
T1
,
T2
,
T3
>::
RefCompo3Type
(
Compo3Type
<
T1
,
T2
,
T3
>&
comp
)
:
m_v1
(
comp
.
m_v1
),
m_v2
(
comp
.
m_v2
),
m_v3
(
comp
.
m_v3
)
{
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
RefCompo3Type
<
T1
,
T2
,
T3
>&
RefCompo3Type
<
T1
,
T2
,
T3
>::
operator
=
(
const
RefCompo3Type
<
T1
,
T2
,
T3
>&
v
)
{
m_v1
=
v
.
m_v1
;
m_v2
=
v
.
m_v2
;
m_v3
=
v
.
m_v3
;
return
*
this
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>
RefCompo3Type
<
T1
,
T2
,
T3
>::
operator
+
(
const
RefCompo3Type
<
T1
,
T2
,
T3
>&
v
)
const
{
Compo3Type
<
T1
,
T2
,
T3
>
res
;
res
.
m_v1
=
this
->
m_v1
+
v
.
m_v1
;
res
.
m_v2
=
this
->
m_v2
+
v
.
m_v2
;
res
.
m_v3
=
this
->
m_v3
+
v
.
m_v3
;
return
res
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>
RefCompo3Type
<
T1
,
T2
,
T3
>::
operator
-
(
const
RefCompo3Type
<
T1
,
T2
,
T3
>&
v
)
const
{
Compo3Type
<
T1
,
T2
,
T3
>
res
;
res
.
m_v1
=
this
->
m_v1
-
v
.
m_v1
;
res
.
m_v2
=
this
->
m_v2
-
v
.
m_v2
;
res
.
m_v3
=
this
->
m_v3
-
v
.
m_v3
;
return
res
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>
RefCompo3Type
<
T1
,
T2
,
T3
>::
operator
/
(
double
d
)
const
{
Compo3Type
<
T1
,
T2
,
T3
>
res
;
res
.
m_v1
=
this
->
m_v1
/
d
;
res
.
m_v2
=
this
->
m_v2
/
d
;
res
.
m_v3
=
this
->
m_v3
/
d
;
return
res
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
Compo3Type
<
T1
,
T2
,
T3
>
RefCompo3Type
<
T1
,
T2
,
T3
>::
operator
*
(
double
d
)
const
{
Compo3Type
<
T1
,
T2
,
T3
>
res
;
res
.
m_v1
=
this
->
m_v1
*
d
;
res
.
m_v2
=
this
->
m_v2
*
d
;
res
.
m_v3
=
this
->
m_v3
*
d
;
return
res
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
RefCompo3Type
<
T1
,
T2
,
T3
>&
RefCompo3Type
<
T1
,
T2
,
T3
>::
operator
+=
(
const
RefCompo3Type
<
T1
,
T2
,
T3
>&
v
)
{
m_v1
+=
v
.
m_v1
;
m_v2
+=
v
.
m_v2
;
m_v3
+=
v
.
m_v3
;
return
*
this
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
RefCompo3Type
<
T1
,
T2
,
T3
>&
RefCompo3Type
<
T1
,
T2
,
T3
>::
operator
-=
(
const
RefCompo3Type
<
T1
,
T2
,
T3
>&
v
)
{
m_v1
-=
v
.
m_v1
;
m_v2
-=
v
.
m_v2
;
m_v3
-=
v
.
m_v3
;
return
*
this
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
RefCompo3Type
<
T1
,
T2
,
T3
>&
RefCompo3Type
<
T1
,
T2
,
T3
>::
operator
*=
(
double
d
)
{
m_v1
*=
d
;
m_v2
*=
d
;
m_v3
*=
d
;
return
*
this
;
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
RefCompo3Type
<
T1
,
T2
,
T3
>&
RefCompo3Type
<
T1
,
T2
,
T3
>::
operator
/=
(
double
d
)
{
m_v1
/=
d
;
m_v2
/=
d
;
m_v3
/=
d
;
return
*
this
;
}
}
// namespace CGoGN
#endif
/* MULTIATTRIBS_H_ */
include/Topology/generic/multi4Attribs.h
0 → 100644
View file @
927fc518
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library 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 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library 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 Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __MULTI4ATTRIBS_H_
#define __MULTI4ATTRIBS_H_
namespace
CGoGN
{
//forward
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
>
struct
RefCompo4Type
;
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
>
struct
Compo4Type
{
T1
m_v1
;
T2
m_v2
;
T3
m_v3
;
T4
m_v4
;
Compo4Type
(){}
Compo4Type
(
double
z
)
:
m_v1
(
z
),
m_v2
(
z
),
m_v3
(
z
),
m_v4
(
z
)
{}
Compo4Type
(
const
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>&
v
);
Compo4Type
<
T1
,
T2
,
T3
,
T4
>&
operator
=
(
const
Compo4Type
<
T1
,
T2
,
T3
,
T4
>&
comp
);
Compo4Type
<
T1
,
T2
,
T3
,
T4
>
operator
+
(
const
Compo4Type
<
T1
,
T2
,
T3
,
T4
>&
v
)
const
;
Compo4Type
<
T1
,
T2
,
T3
,
T4
>
operator
-
(
const
Compo4Type
<
T1
,
T2
,
T3
,
T4
>&
v
)
const
;
Compo4Type
<
T1
,
T2
,
T3
,
T4
>
operator
/
(
double
d
)
const
;
Compo4Type
<
T1
,
T2
,
T3
,
T4
>
operator
*
(
double
d
)
const
;
Compo4Type
<
T1
,
T2
,
T3
,
T4
>&
operator
+=
(
const
Compo4Type
<
T1
,
T2
,
T3
,
T4
>&
v
);
Compo4Type
<
T1
,
T2
,
T3
,
T4
>&
operator
-=
(
const
Compo4Type
<
T1
,
T2
,
T3
,
T4
>&
v
);
Compo4Type
<
T1
,
T2
,
T3
,
T4
>&
operator
*=
(
double
d
);
Compo4Type
<
T1
,
T2
,
T3
,
T4
>&
operator
/=
(
double
d
);
};
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
>
struct
RefCompo4Type
{
T1
&
m_v1
;
T2
&
m_v2
;
T3
&
m_v3
;
T4
&
m_v4
;
RefCompo4Type
(
T1
&
v1
,
T2
&
v2
,
T3
&
v3
,
T4
&
v4
)
:
m_v1
(
v1
),
m_v2
(
v2
),
m_v3
(
v3
),
m_v4
(
v4
)
{}
RefCompo4Type
(
Compo4Type
<
T1
,
T2
,
T3
,
T4
>&
comp
);
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>&
operator
=
(
const
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>&
v
);
Compo4Type
<
T1
,
T2
,
T3
,
T4
>
operator
+
(
const
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>&
v
)
const
;
Compo4Type
<
T1
,
T2
,
T3
,
T4
>
operator
-
(
const
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>&
v
)
const
;
Compo4Type
<
T1
,
T2
,
T3
,
T4
>
operator
/
(
double
d
)
const
;
Compo4Type
<
T1
,
T2
,
T3
,
T4
>
operator
*
(
double
d
)
const
;
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>&
operator
+=
(
const
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>&
v
);
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>&
operator
-=
(
const
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>&
v
);
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>&
operator
*=
(
double
d
);
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>&
operator
/=
(
double
d
);
};
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
>
class
Vertex4Attributes
{
VertexAttribute
<
T1
>&
m_h1
;
VertexAttribute
<
T2
>&
m_h2
;
VertexAttribute
<
T3
>&
m_h3
;
VertexAttribute
<
T4
>&
m_h4
;
public:
typedef
Compo4Type
<
T1
,
T2
,
T3
,
T4
>
VALUE
;
typedef
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>
REF
;
Vertex4Attributes
(
VertexAttribute
<
T1
>&
h1
,
VertexAttribute
<
T2
>&
h2
,
VertexAttribute
<
T3
>&
h3
,
VertexAttribute
<
T4
>&
h4
)
:
m_h1
(
h1
),
m_h2
(
h2
),
m_h3
(
h3
),
m_h4
(
h4
)
{}
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>
operator
[](
unsigned
int
a
)
{
return
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>
(
m_h1
[
a
],
m_h2
[
a
],
m_h3
[
a
],
m_h4
[
a
]);
}
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>
operator
[](
Dart
d
)
{
return
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>
(
m_h1
[
d
],
m_h2
[
d
],
m_h3
[
d
],
m_h4
[
d
]);
}
};
template
<
typename
T1
,
typename
T2
,
typename
T3
,
typename
T4
>
class
Face4Attributes
{
FaceAttribute
<
T1
>&
m_h1
;
FaceAttribute
<
T2
>&
m_h2
;
FaceAttribute
<
T3
>&
m_h3
;
FaceAttribute
<
T4
>&
m_h4
;
public:
typedef
Compo4Type
<
T1
,
T2
,
T3
,
T4
>
VALUE
;
typedef
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>
REF
;
Face4Attributes
(
FaceAttribute
<
T1
>&
h1
,
FaceAttribute
<
T2
>&
h2
,
FaceAttribute
<
T3
>&
h3
,
FaceAttribute
<
T4
>&
h4
)
:
m_h1
(
h1
),
m_h2
(
h2
),
m_h3
(
h3
),
m_h4
(
h4
)
{}
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>
operator
[](
unsigned
int
a
)
{
return
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>
(
m_h1
[
a
],
m_h2
[
a
],
m_h3
[
a
],
m_h4
[
a
]);
}
RefCompo4Type
<
T1
,
T2
,
T3
,
T4
>
operator
[](
Dart
d
)
{