Moka kernel
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
gmv-materialization.cc
Go to the documentation of this file.
1
/*
2
* lib-gmapkernel : Un noyau de 3-G-cartes et des opérations.
3
* Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4
* http://www.sic.sp2mi.univ-poitiers.fr/
5
* Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6
* guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7
*
8
* This file is part of lib-gmapkernel
9
*
10
* This program is free software: you can redistribute it and/or modify
11
* it under the terms of the GNU Lesser General Public License as published by
12
* the Free Software Foundation, either version 3 of the License, or
13
* (at your option) any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Lesser General Public License for more details.
19
*
20
* You should have received a copy of the GNU Lesser General Public License
21
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
*/
23
24
//******************************************************************************
25
#include "
g-map-vertex.hh
"
26
#include "
geometry.hh
"
27
using namespace
GMap3d;
28
//******************************************************************************
29
CDart
*
CGMapVertex::materializeBarycenter
(
int
AMarkNumber)
30
{
31
return
addMapDart
(
barycenter
(AMarkNumber));
32
}
33
//******************************************************************************
34
CDart
*
CGMapVertex::materializeAxe
(
CDart
* ADart1,
CDart
* ADart2)
35
{
36
assert(ADart1!=NULL && ADart2!=NULL);
37
assert(!
isSameOrbit
(ADart1,ADart2,
ORBIT_VERTEX
));
38
39
ADart1=
addMapDart
(*
findVertex
(ADart1));
40
ADart2=
addMapDart
(*
findVertex
(ADart2));
41
linkAlpha0
(ADart1,ADart2);
42
return
ADart2;
43
}
44
//******************************************************************************
45
CDart
*
CGMapVertex::materializePlane
(
CDart
* ADart1,
CDart
* ADart2,
CDart
* ADart3)
46
{
47
assert(ADart1!=NULL && ADart2!=NULL && ADart3!=NULL);
48
assert(!
isSameOrbit
(ADart1,ADart2,
ORBIT_VERTEX
) &&
49
!
isSameOrbit
(ADart1,ADart3,
ORBIT_VERTEX
) &&
50
!
isSameOrbit
(ADart2,ADart3,
ORBIT_VERTEX
));
51
52
CDart
* d=
createTopoTriangle
();
53
54
setVertex
( d , *
findVertex
(ADart3));
55
setVertex
(
alpha01
(d), *
findVertex
(ADart2));
56
setVertex
(
alpha0101
(d), *
findVertex
(ADart1));
57
return
d;
58
}
59
//******************************************************************************
60
CDart
*
CGMapVertex::materializeNormalVector
(
CDart
* ADart)
61
{
62
assert(ADart!=NULL);
63
64
CVertex
b=
barycenter
(ADart,
ORBIT_FACE
);
65
CVertex
n=
faceNormalVector
(ADart);
66
assert(!n.
isNull
());
67
n/= n.
norm
();
68
69
CDart
*
B
=
addMapDart
(b );
70
CDart
* N=
addMapDart
(b+n);
71
linkAlpha0
(B,N);
72
return
N;
73
}
74
//******************************************************************************
75
CDart
*
CGMapVertex::materializeNormalPlane
(
CDart
* ADart1,
CDart
* ADart2)
76
{
77
assert(ADart1!=NULL && ADart2!=NULL);
78
assert(!
isSameOrbit
(ADart1,ADart2,
ORBIT_VERTEX
));
79
80
CTransformationMatrix
rotationMatrix(
CTransformationMatrix::IdentityMatrix
);
81
82
const
CVertex
& S1= *
findVertex
(ADart1);
83
const
CVertex
& S2= *
findVertex
(ADart2);
84
85
rotationMatrix.
rotate
(S2-S1, 120);
86
87
CVertex
V1=
CGeometry::getNormalVector
(S2-S1);
88
CVertex
V2= V1; rotationMatrix.
applyOn
(V2);
89
CVertex
V3= V2; rotationMatrix.
applyOn
(V3);
90
91
CDart
* d=
createTopoTriangle
();
92
93
setVertex
( d , S1+V1);
94
setVertex
(
alpha01
(d), S1+V2);
95
setVertex
(
alpha0101
(d), S1+V3);
96
return
d;
97
}
98
//******************************************************************************
99
CDart
*
CGMapVertex::materializeReferential
()
100
{
101
CDart
* dart[12];
102
103
int
i;
104
105
for
(i=0; i<12; ++i)
106
dart[i]=
addMapDart
();
107
108
for
(i=0; i<6; ++i)
109
linkAlpha0
(dart[2*i], dart[2*i+1]);
110
111
for
(i=0; i<3; ++i)
112
{
113
linkAlpha1
(dart[4*i],dart[(4*i+11)%12]);
114
topoSew2
(dart[4*i], dart[4*i+3]);
115
}
116
117
setVertex
(dart[ 0], ORIGIN);
118
setVertex
(dart[ 2], OX);
119
setVertex
(dart[ 6], OY);
120
setVertex
(dart[10], OZ);
121
122
return
dart[0];
123
}
124
//******************************************************************************
lib-gmapkernel
g-map-vertex
gmv-materialization.cc
Generated on Tue Apr 9 2013 09:51:35 for Moka kernel by
1.8.2