Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ISBI2016-filaSimu-TM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vladimír Ulman
ISBI2016-filaSimu-TM
Commits
9189cf69
There was an error fetching the commit references. Please try again later.
Commit
9189cf69
authored
8 years ago
by
Vladimír Ulman
Browse files
Options
Downloads
Patches
Plain Diff
Added various surface visualizations, keys M,V,Q...
parent
f7676595
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/graphics.cpp
+80
-28
80 additions, 28 deletions
src/graphics.cpp
src/main.cpp
+2
-2
2 additions, 2 deletions
src/main.cpp
with
82 additions
and
30 deletions
src/graphics.cpp
+
80
−
28
View file @
9189cf69
...
...
@@ -46,6 +46,10 @@ float zoom = 1.0;
bool
MouseActive
=
false
;
int
last_x
=
0
,
last_y
=
0
;
bool
showWholeMesh
=
true
;
bool
showVertexSurface
=
false
;
bool
showQuadricSurface
=
false
;
///manage \e count steps of the simulation and then print and draw
void
step
(
int
count
)
...
...
@@ -107,24 +111,73 @@ void displayAxes(void)
int
VertexID
=
10
;
void
ActiveMesh
::
displayMesh
(
void
)
int
vertexLevels
=
5
;
void
ActiveMesh
::
displayVertexAndNeigs
(
void
)
{
glColor3f
(
0.8
f
,
0.8
f
,
0.8
f
);
//determine some reasonable number of nearest neighbors
std
::
vector
<
std
::
vector
<
size_t
>
>
neigsLeveled
;
ulm
::
getVertexNeighbours
(
*
this
,
VertexID
,
vertexLevels
,
neigsLeveled
);
//make it flat...
std
::
vector
<
size_t
>
neigs
;
for
(
unsigned
int
l
=
0
;
l
<
neigsLeveled
.
size
();
++
l
)
for
(
unsigned
int
i
=
0
;
i
<
neigsLeveled
[
l
].
size
();
++
i
)
neigs
.
push_back
(
neigsLeveled
[
l
][
i
]);
neigsLeveled
.
clear
();
/*
for (unsigned int i=0; i < ID.size(); i+=3)
{
//glBegin(GL_TRIANGLES);
glBegin(GL_LINE_LOOP);
glNormal3f(norm[i/3].x,norm[i/3].y,norm[i/3].z);
glVertex3f(Pos[ID[i+0]].x,Pos[ID[i+0]].y,Pos[ID[i+0]].z);
glVertex3f(Pos[ID[i+1]].x,Pos[ID[i+1]].y,Pos[ID[i+1]].z);
glVertex3f(Pos[ID[i+2]].x,Pos[ID[i+2]].y,Pos[ID[i+2]].z);
glEnd();
}
std::vector<size_t> neigs;
ulm::getVertexImmediateNeighbours(*this,VertexID,neigs);
*/
//long unsigned int* id=&ID.front();
glPointSize
(
3.0
f
);
glBegin
(
GL_POINTS
);
// centre vertex:
glColor3f
(
0.0
f
,
0.0
f
,
1.0
f
);
glVertex3f
(
Pos
[
VertexID
].
x
,
Pos
[
VertexID
].
y
,
Pos
[
VertexID
].
z
);
// neigs:
glColor3f
(
1.0
f
,
0.0
f
,
0.0
f
);
for
(
unsigned
int
i
=
1
;
i
<
neigs
.
size
();
++
i
)
glVertex3f
(
Pos
[
neigs
[
i
]].
x
,
Pos
[
neigs
[
i
]].
y
,
Pos
[
neigs
[
i
]].
z
);
glEnd
();
}
void
ActiveMesh
::
displayQuadricSurface
(
void
)
{
//get surface params
float
surf_coeff
[
10
];
CalcQuadricSurface_Taubin
(
VertexID
,
surf_coeff
);
glPointSize
(
2.0
f
);
glBegin
(
GL_POINTS
);
glColor3f
(
0.0
f
,
1.0
f
,
0.0
f
);
//do the rendering
//hmm... figure out some iteration model..
//perhaps from surrounding points some interpolation
//FOR CYCLE BEGIN
Vector3F
point
;
//say we have x,y,z -> point
//adapt the point
GetClosestPointOnQuadricSurface
(
point
,
surf_coeff
);
//display the point
glVertex3f
(
point
.
x
,
point
.
y
,
point
.
z
);
//FOR CYCLE END
glEnd
();
}
void
ActiveMesh
::
displayMesh
(
void
)
{
glColor3f
(
0.8
f
,
0.8
f
,
0.8
f
);
long
unsigned
int
*
id
=
ID
.
data
();
for
(
unsigned
int
i
=
0
;
i
<
ID
.
size
();
i
+=
3
)
{
...
...
@@ -136,20 +189,6 @@ void ActiveMesh::displayMesh(void)
glVertex3f
(
Pos
[
*
id
].
x
,
Pos
[
*
id
].
y
,
Pos
[
*
id
].
z
);
++
id
;
glEnd
();
}
std
::
vector
<
size_t
>
neigs
;
ulm
::
getVertexImmediateNeighbours
(
*
this
,
VertexID
,
neigs
);
glPointSize
(
4.0
f
);
glBegin
(
GL_POINTS
);
// centre vertex:
glColor3f
(
0.0
f
,
0.0
f
,
1.0
f
);
glVertex3f
(
Pos
[
VertexID
].
x
,
Pos
[
VertexID
].
y
,
Pos
[
VertexID
].
z
);
// neigs:
glColor3f
(
1.0
f
,
0.0
f
,
0.0
f
);
for
(
unsigned
int
i
=
0
;
i
<
neigs
.
size
();
++
i
)
glVertex3f
(
Pos
[
neigs
[
i
]].
x
,
Pos
[
neigs
[
i
]].
y
,
Pos
[
neigs
[
i
]].
z
);
glEnd
();
}
...
...
@@ -170,7 +209,10 @@ void display(void)
displayFrame
();
displayAxes
();
mesh
.
displayMesh
();
if
(
showWholeMesh
)
mesh
.
displayMesh
();
if
(
showVertexSurface
)
mesh
.
displayVertexAndNeigs
();
if
(
showQuadricSurface
)
mesh
.
displayQuadricSurface
();
glFlush
();
glutSwapBuffers
();
...
...
@@ -303,6 +345,16 @@ void keyboard(unsigned char key, int mx, int my)
glutPostRedisplay
();
break
;
case
'M'
:
showWholeMesh
^=
true
;
break
;
case
'V'
:
showVertexSurface
^=
true
;
break
;
case
'Q'
:
showQuadricSurface
^=
true
;
break
;
case
'i'
:
//inspect a cell
GetSceneViewSize
(
windowSizeX
,
windowSizeY
,
xVisF
,
xVisT
,
yVisF
,
yVisT
);
sx
=
(
float
)
mx
/
(
float
)
windowSizeX
*
(
xVisT
-
xVisF
)
+
xVisF
;
...
...
This diff is collapsed.
Click to expand it.
src/main.cpp
+
2
−
2
View file @
9189cf69
...
...
@@ -34,8 +34,10 @@ int main(void)
mesh
.
CenterMesh
(
params
.
sceneCentre
);
//work with mesh
/*
float surf_coeff[10];
mesh.CalcQuadricSurface_Taubin(10,surf_coeff);
*/
/*
//render mesh
...
...
@@ -50,11 +52,9 @@ int main(void)
mask.SaveImage("mesh.ics");
*/
/*
initializeGL
();
loopGL
();
closeGL
();
*/
return
(
0
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment