Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
b091dc4f
Commit
b091dc4f
authored
21 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
cleaner cut plane tests
parent
6859c8cd
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Graphics/Mesh.cpp
+58
-62
58 additions, 62 deletions
Graphics/Mesh.cpp
with
58 additions
and
62 deletions
Graphics/Mesh.cpp
+
58
−
62
View file @
b091dc4f
// $Id: Mesh.cpp,v 1.7
6
2004-04-21 0
4:26:45
geuzaine Exp $
// $Id: Mesh.cpp,v 1.7
7
2004-04-21 0
6:31:23
geuzaine Exp $
//
//
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -255,6 +255,31 @@ void Draw_Mesh_Curves(void *a, void *b)
...
@@ -255,6 +255,31 @@ void Draw_Mesh_Curves(void *a, void *b)
Tree_Action
(
c
->
Simplexes
,
Draw_Simplex_Curves
);
Tree_Action
(
c
->
Simplexes
,
Draw_Simplex_Curves
);
}
}
double
intersectCutPlane
(
int
num
,
Vertex
**
v
,
int
*
edges
,
int
*
faces
)
{
if
(
!
CTX
.
mesh
.
use_cut_plane
)
return
0
;
double
val
=
CTX
.
mesh
.
evalCutPlane
(
v
[
0
]
->
Pos
.
X
,
v
[
0
]
->
Pos
.
Y
,
v
[
0
]
->
Pos
.
Z
);
for
(
int
i
=
1
;
i
<
num
;
i
++
){
if
(
val
*
CTX
.
mesh
.
evalCutPlane
(
v
[
i
]
->
Pos
.
X
,
v
[
i
]
->
Pos
.
Y
,
v
[
i
]
->
Pos
.
Z
)
<=
0
){
// the element intersects the cut plane
if
(
CTX
.
mesh
.
cut_plane_as_surface
){
*
edges
=
CTX
.
mesh
.
surfaces_edges
;
*
faces
=
CTX
.
mesh
.
surfaces_faces
;
}
return
1.
;
}
}
return
val
;
}
double
intersectCutPlane
(
int
num
,
Vertex
**
v
)
{
int
dummy
;
return
intersectCutPlane
(
num
,
v
,
&
dummy
,
&
dummy
);
}
void
Draw_Mesh_Points
(
void
*
a
,
void
*
b
)
void
Draw_Mesh_Points
(
void
*
a
,
void
*
b
)
{
{
Vertex
*
v
;
Vertex
*
v
;
...
@@ -265,10 +290,8 @@ void Draw_Mesh_Points(void *a, void *b)
...
@@ -265,10 +290,8 @@ void Draw_Mesh_Points(void *a, void *b)
if
(
!
(
v
->
Visible
&
VIS_MESH
))
if
(
!
(
v
->
Visible
&
VIS_MESH
))
return
;
return
;
if
(
CTX
.
mesh
.
use_cut_plane
)
{
if
(
intersectCutPlane
(
1
,
&
v
)
<
0
)
if
(
CTX
.
mesh
.
evalCutPlane
(
v
->
Pos
.
X
,
v
->
Pos
.
Y
,
v
->
Pos
.
Z
)
<
0
)
return
;
return
;
}
if
(
CTX
.
render_mode
==
GMSH_SELECT
)
{
if
(
CTX
.
render_mode
==
GMSH_SELECT
)
{
glLoadName
(
0
);
glLoadName
(
0
);
...
@@ -321,6 +344,9 @@ void Draw_Simplex_Curves(void *a, void *b)
...
@@ -321,6 +344,9 @@ void Draw_Simplex_Curves(void *a, void *b)
if
(
part
&&
!
(
*
part
)
->
Visible
)
if
(
part
&&
!
(
*
part
)
->
Visible
)
return
;
return
;
if
(
intersectCutPlane
(
2
,
s
->
V
)
<
0
)
return
;
Xc
=
0.5
*
(
s
->
V
[
0
]
->
Pos
.
X
+
s
->
V
[
1
]
->
Pos
.
X
);
Xc
=
0.5
*
(
s
->
V
[
0
]
->
Pos
.
X
+
s
->
V
[
1
]
->
Pos
.
X
);
Yc
=
0.5
*
(
s
->
V
[
0
]
->
Pos
.
Y
+
s
->
V
[
1
]
->
Pos
.
Y
);
Yc
=
0.5
*
(
s
->
V
[
0
]
->
Pos
.
Y
+
s
->
V
[
1
]
->
Pos
.
Y
);
Zc
=
0.5
*
(
s
->
V
[
0
]
->
Pos
.
Z
+
s
->
V
[
1
]
->
Pos
.
Z
);
Zc
=
0.5
*
(
s
->
V
[
0
]
->
Pos
.
Z
+
s
->
V
[
1
]
->
Pos
.
Z
);
...
@@ -560,6 +586,9 @@ void Draw_Simplex_Surface(void *a, void *b)
...
@@ -560,6 +586,9 @@ void Draw_Simplex_Surface(void *a, void *b)
if
(
part
&&
!
(
*
part
)
->
Visible
)
if
(
part
&&
!
(
*
part
)
->
Visible
)
return
;
return
;
if
(
intersectCutPlane
(
3
,
s
->
V
)
<
0
)
return
;
L
=
(
s
->
VSUP
)
?
1
:
0
;
L
=
(
s
->
VSUP
)
?
1
:
0
;
K
=
(
s
->
V
[
3
])
?
4
:
3
;
K
=
(
s
->
V
[
3
])
?
4
:
3
;
...
@@ -577,11 +606,6 @@ void Draw_Simplex_Surface(void *a, void *b)
...
@@ -577,11 +606,6 @@ void Draw_Simplex_Surface(void *a, void *b)
Zc
=
(
s
->
V
[
0
]
->
Pos
.
Z
+
s
->
V
[
1
]
->
Pos
.
Z
+
s
->
V
[
2
]
->
Pos
.
Z
)
/
3.
;
Zc
=
(
s
->
V
[
0
]
->
Pos
.
Z
+
s
->
V
[
1
]
->
Pos
.
Z
+
s
->
V
[
2
]
->
Pos
.
Z
)
/
3.
;
}
}
if
(
CTX
.
mesh
.
use_cut_plane
)
{
if
(
CTX
.
mesh
.
evalCutPlane
(
Xc
,
Yc
,
Zc
)
<
0
)
return
;
}
k
=
0
;
k
=
0
;
for
(
i
=
0
;
i
<
K
;
i
++
)
{
for
(
i
=
0
;
i
<
K
;
i
++
)
{
pX
[
k
]
=
Xc
+
CTX
.
mesh
.
explode
*
(
s
->
V
[
i
]
->
Pos
.
X
-
Xc
);
pX
[
k
]
=
Xc
+
CTX
.
mesh
.
explode
*
(
s
->
V
[
i
]
->
Pos
.
X
-
Xc
);
...
@@ -639,22 +663,6 @@ void Draw_Simplex_Surface(void *a, void *b)
...
@@ -639,22 +663,6 @@ void Draw_Simplex_Surface(void *a, void *b)
}
}
}
}
int
intersectCutPlane
(
int
num
,
Vertex
**
v
,
int
*
edges
,
int
*
faces
)
{
if
(
CTX
.
mesh
.
cut_plane_as_surface
&&
(
CTX
.
mesh
.
surfaces_edges
||
CTX
.
mesh
.
surfaces_faces
)){
double
val
=
CTX
.
mesh
.
evalCutPlane
(
v
[
0
]
->
Pos
.
X
,
v
[
0
]
->
Pos
.
Y
,
v
[
0
]
->
Pos
.
Z
);
for
(
int
i
=
1
;
i
<
num
;
i
++
){
if
(
val
*
CTX
.
mesh
.
evalCutPlane
(
v
[
i
]
->
Pos
.
X
,
v
[
i
]
->
Pos
.
Y
,
v
[
i
]
->
Pos
.
Z
)
<
0
){
*
edges
=
CTX
.
mesh
.
surfaces_edges
;
*
faces
=
CTX
.
mesh
.
surfaces_faces
;
return
1
;
}
}
}
return
0
;
}
void
Draw_Simplex_Volume
(
void
*
a
,
void
*
b
)
void
Draw_Simplex_Volume
(
void
*
a
,
void
*
b
)
{
{
Simplex
*
s
;
Simplex
*
s
;
...
@@ -692,6 +700,12 @@ void Draw_Simplex_Volume(void *a, void *b)
...
@@ -692,6 +700,12 @@ void Draw_Simplex_Volume(void *a, void *b)
return
;
return
;
}
}
int
edges
=
CTX
.
mesh
.
volumes_edges
;
int
faces
=
CTX
.
mesh
.
volumes_faces
;
if
(
intersectCutPlane
(
3
,
s
->
V
,
&
edges
,
&
faces
)
<
0
)
return
;
double
Xc
=
.25
*
(
s
->
V
[
0
]
->
Pos
.
X
+
s
->
V
[
1
]
->
Pos
.
X
+
double
Xc
=
.25
*
(
s
->
V
[
0
]
->
Pos
.
X
+
s
->
V
[
1
]
->
Pos
.
X
+
s
->
V
[
2
]
->
Pos
.
X
+
s
->
V
[
3
]
->
Pos
.
X
);
s
->
V
[
2
]
->
Pos
.
X
+
s
->
V
[
3
]
->
Pos
.
X
);
double
Yc
=
.25
*
(
s
->
V
[
0
]
->
Pos
.
Y
+
s
->
V
[
1
]
->
Pos
.
Y
+
double
Yc
=
.25
*
(
s
->
V
[
0
]
->
Pos
.
Y
+
s
->
V
[
1
]
->
Pos
.
Y
+
...
@@ -699,15 +713,6 @@ void Draw_Simplex_Volume(void *a, void *b)
...
@@ -699,15 +713,6 @@ void Draw_Simplex_Volume(void *a, void *b)
double
Zc
=
.25
*
(
s
->
V
[
0
]
->
Pos
.
Z
+
s
->
V
[
1
]
->
Pos
.
Z
+
double
Zc
=
.25
*
(
s
->
V
[
0
]
->
Pos
.
Z
+
s
->
V
[
1
]
->
Pos
.
Z
+
s
->
V
[
2
]
->
Pos
.
Z
+
s
->
V
[
3
]
->
Pos
.
Z
);
s
->
V
[
2
]
->
Pos
.
Z
+
s
->
V
[
3
]
->
Pos
.
Z
);
int
edges
=
CTX
.
mesh
.
volumes_edges
;
int
faces
=
CTX
.
mesh
.
volumes_faces
;
if
(
CTX
.
mesh
.
use_cut_plane
)
{
if
(
!
intersectCutPlane
(
3
,
s
->
V
,
&
edges
,
&
faces
))
if
(
CTX
.
mesh
.
evalCutPlane
(
Xc
,
Yc
,
Zc
)
<
0
)
return
;
}
if
(
CTX
.
mesh
.
surfaces_faces
||
faces
){
if
(
CTX
.
mesh
.
surfaces_faces
||
faces
){
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
mesh
.
line
);
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
mesh
.
line
);
}
}
...
@@ -939,6 +944,12 @@ void Draw_Hexahedron_Volume(void *a, void *b)
...
@@ -939,6 +944,12 @@ void Draw_Hexahedron_Volume(void *a, void *b)
if
(
CTX
.
mesh
.
color_carousel
==
2
)
if
(
CTX
.
mesh
.
color_carousel
==
2
)
thePhysical
=
getFirstPhysical
(
MSH_PHYSICAL_VOLUME
,
h
->
iEnt
);
thePhysical
=
getFirstPhysical
(
MSH_PHYSICAL_VOLUME
,
h
->
iEnt
);
int
edges
=
CTX
.
mesh
.
volumes_edges
;
int
faces
=
CTX
.
mesh
.
volumes_faces
;
if
(
intersectCutPlane
(
8
,
h
->
V
,
&
edges
,
&
faces
)
<
0
)
return
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
for
(
i
=
0
;
i
<
8
;
i
++
)
{
Xc
+=
h
->
V
[
i
]
->
Pos
.
X
;
Xc
+=
h
->
V
[
i
]
->
Pos
.
X
;
Yc
+=
h
->
V
[
i
]
->
Pos
.
Y
;
Yc
+=
h
->
V
[
i
]
->
Pos
.
Y
;
...
@@ -948,15 +959,6 @@ void Draw_Hexahedron_Volume(void *a, void *b)
...
@@ -948,15 +959,6 @@ void Draw_Hexahedron_Volume(void *a, void *b)
Zc
*=
.125
;
Zc
*=
.125
;
Yc
*=
.125
;
Yc
*=
.125
;
int
edges
=
CTX
.
mesh
.
volumes_edges
;
int
faces
=
CTX
.
mesh
.
volumes_faces
;
if
(
CTX
.
mesh
.
use_cut_plane
)
{
if
(
!
intersectCutPlane
(
8
,
h
->
V
,
&
edges
,
&
faces
))
if
(
CTX
.
mesh
.
evalCutPlane
(
Xc
,
Yc
,
Zc
)
<
0
)
return
;
}
if
(
CTX
.
mesh
.
surfaces_faces
||
faces
){
if
(
CTX
.
mesh
.
surfaces_faces
||
faces
){
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
mesh
.
line
);
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
mesh
.
line
);
}
}
...
@@ -1131,6 +1133,12 @@ void Draw_Prism_Volume(void *a, void *b)
...
@@ -1131,6 +1133,12 @@ void Draw_Prism_Volume(void *a, void *b)
if
(
CTX
.
mesh
.
color_carousel
==
2
)
if
(
CTX
.
mesh
.
color_carousel
==
2
)
thePhysical
=
getFirstPhysical
(
MSH_PHYSICAL_VOLUME
,
p
->
iEnt
);
thePhysical
=
getFirstPhysical
(
MSH_PHYSICAL_VOLUME
,
p
->
iEnt
);
int
edges
=
CTX
.
mesh
.
volumes_edges
;
int
faces
=
CTX
.
mesh
.
volumes_faces
;
if
(
intersectCutPlane
(
6
,
p
->
V
,
&
edges
,
&
faces
)
<
0
)
return
;
for
(
i
=
0
;
i
<
6
;
i
++
)
{
for
(
i
=
0
;
i
<
6
;
i
++
)
{
Xc
+=
p
->
V
[
i
]
->
Pos
.
X
;
Xc
+=
p
->
V
[
i
]
->
Pos
.
X
;
Yc
+=
p
->
V
[
i
]
->
Pos
.
Y
;
Yc
+=
p
->
V
[
i
]
->
Pos
.
Y
;
...
@@ -1140,15 +1148,6 @@ void Draw_Prism_Volume(void *a, void *b)
...
@@ -1140,15 +1148,6 @@ void Draw_Prism_Volume(void *a, void *b)
Zc
/=
6.
;
Zc
/=
6.
;
Yc
/=
6.
;
Yc
/=
6.
;
int
edges
=
CTX
.
mesh
.
volumes_edges
;
int
faces
=
CTX
.
mesh
.
volumes_faces
;
if
(
CTX
.
mesh
.
use_cut_plane
)
{
if
(
!
intersectCutPlane
(
6
,
p
->
V
,
&
edges
,
&
faces
))
if
(
CTX
.
mesh
.
evalCutPlane
(
Xc
,
Yc
,
Zc
)
<
0
)
return
;
}
if
(
CTX
.
mesh
.
surfaces_faces
||
faces
){
if
(
CTX
.
mesh
.
surfaces_faces
||
faces
){
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
mesh
.
line
);
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
mesh
.
line
);
}
}
...
@@ -1308,6 +1307,12 @@ void Draw_Pyramid_Volume(void *a, void *b)
...
@@ -1308,6 +1307,12 @@ void Draw_Pyramid_Volume(void *a, void *b)
if
(
CTX
.
mesh
.
color_carousel
==
2
)
if
(
CTX
.
mesh
.
color_carousel
==
2
)
thePhysical
=
getFirstPhysical
(
MSH_PHYSICAL_VOLUME
,
p
->
iEnt
);
thePhysical
=
getFirstPhysical
(
MSH_PHYSICAL_VOLUME
,
p
->
iEnt
);
int
edges
=
CTX
.
mesh
.
volumes_edges
;
int
faces
=
CTX
.
mesh
.
volumes_faces
;
if
(
intersectCutPlane
(
5
,
p
->
V
,
&
edges
,
&
faces
)
<
0
)
return
;
for
(
i
=
0
;
i
<
5
;
i
++
)
{
for
(
i
=
0
;
i
<
5
;
i
++
)
{
Xc
+=
p
->
V
[
i
]
->
Pos
.
X
;
Xc
+=
p
->
V
[
i
]
->
Pos
.
X
;
Yc
+=
p
->
V
[
i
]
->
Pos
.
Y
;
Yc
+=
p
->
V
[
i
]
->
Pos
.
Y
;
...
@@ -1317,15 +1322,6 @@ void Draw_Pyramid_Volume(void *a, void *b)
...
@@ -1317,15 +1322,6 @@ void Draw_Pyramid_Volume(void *a, void *b)
Zc
/=
5.
;
Zc
/=
5.
;
Yc
/=
5.
;
Yc
/=
5.
;
int
edges
=
CTX
.
mesh
.
volumes_edges
;
int
faces
=
CTX
.
mesh
.
volumes_faces
;
if
(
CTX
.
mesh
.
use_cut_plane
)
{
if
(
!
intersectCutPlane
(
5
,
p
->
V
,
&
edges
,
&
faces
))
if
(
CTX
.
mesh
.
evalCutPlane
(
Xc
,
Yc
,
Zc
)
<
0
)
return
;
}
if
(
CTX
.
mesh
.
surfaces_faces
||
faces
){
if
(
CTX
.
mesh
.
surfaces_faces
||
faces
){
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
mesh
.
line
);
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
mesh
.
line
);
}
}
...
...
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