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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
ca6d50e0
Commit
ca6d50e0
authored
16 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
6581e72e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Geo/OCCRegion.cpp
+1
-1
1 addition, 1 deletion
Geo/OCCRegion.cpp
Graphics/Geom.cpp
+121
-37
121 additions, 37 deletions
Graphics/Geom.cpp
with
122 additions
and
38 deletions
Geo/OCCRegion.cpp
+
1
−
1
View file @
ca6d50e0
...
...
@@ -31,7 +31,7 @@ OCCRegion::OCCRegion(GModel *m, TopoDS_Solid _s, int num, TopTools_IndexedMapOfS
Msg
::
Error
(
"Unknown face %d in region %d"
,
index
,
num
);
}
}
Msg
::
Info
(
"OCC Region %d with %d
edg
es"
,
num
,
l_faces
.
size
());
Msg
::
Info
(
"OCC Region %d with %d
fac
es"
,
num
,
l_faces
.
size
());
}
GEntity
::
GeomType
OCCRegion
::
geomType
()
const
...
...
This diff is collapsed.
Click to expand it.
Graphics/Geom.cpp
+
121
−
37
View file @
ca6d50e0
...
...
@@ -13,6 +13,42 @@
extern
Context_T
CTX
;
class
visContext
{
public:
visContext
(){}
virtual
void
transform
(
double
&
x
,
double
&
y
,
double
&
z
){}
};
class
visContextScaled
:
public
visContext
{
private:
bool
_identityTransform
;
double
_mat
[
3
][
3
];
public:
visContextScaled
(
double
mat
[
3
][
3
])
:
visContext
()
{
if
(
mat
[
0
][
0
]
!=
1.
||
mat
[
0
][
1
]
!=
0.
||
mat
[
0
][
2
]
!=
0.
||
mat
[
1
][
0
]
!=
0.
||
mat
[
1
][
1
]
!=
1.
||
mat
[
1
][
2
]
!=
0.
||
mat
[
2
][
0
]
!=
0.
||
mat
[
2
][
1
]
!=
0.
||
mat
[
2
][
2
]
!=
1.
)
_identityTransform
=
false
;
else
_identityTransform
=
true
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
for
(
int
j
=
0
;
j
<
3
;
j
++
)
_mat
[
i
][
j
]
=
mat
[
i
][
j
];
}
virtual
void
transform
(
double
&
x
,
double
&
y
,
double
&
z
)
{
if
(
_identityTransform
)
return
;
double
xyz
[
3
]
=
{
x
,
y
,
z
};
x
=
y
=
z
=
0.
;
for
(
int
k
=
0
;
k
<
3
;
k
++
){
x
+=
_mat
[
0
][
k
]
*
xyz
[
k
];
y
+=
_mat
[
1
][
k
]
*
xyz
[
k
];
z
+=
_mat
[
2
][
k
]
*
xyz
[
k
];
}
}
};
static
void
drawBBox
(
GEntity
*
e
)
{
return
;
...
...
@@ -25,7 +61,10 @@ static void drawBBox(GEntity *e)
}
class
drawGVertex
{
private
:
visContext
*
_ctx
;
public
:
drawGVertex
(
visContext
*
ctx
)
:
_ctx
(
ctx
){}
void
operator
()
(
GVertex
*
v
)
{
if
(
!
v
->
getVisibility
())
return
;
...
...
@@ -55,18 +94,19 @@ class drawGVertex {
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
geom
.
highlight
[
1
]);
}
double
x
=
v
->
x
(),
y
=
v
->
y
(),
z
=
v
->
z
();
_ctx
->
transform
(
x
,
y
,
z
);
if
(
CTX
.
geom
.
points
)
{
if
(
CTX
.
geom
.
point_type
>
0
)
{
if
(
v
->
getSelection
())
Draw_Sphere
(
CTX
.
geom
.
point_sel_size
,
v
->
x
(),
v
->
y
(),
v
->
z
(),
CTX
.
geom
.
light
);
Draw_Sphere
(
CTX
.
geom
.
point_sel_size
,
x
,
y
,
z
,
CTX
.
geom
.
light
);
else
Draw_Sphere
(
CTX
.
geom
.
point_size
,
v
->
x
(),
v
->
y
(),
v
->
z
(),
CTX
.
geom
.
light
);
Draw_Sphere
(
CTX
.
geom
.
point_size
,
x
,
y
,
z
,
CTX
.
geom
.
light
);
}
else
{
glBegin
(
GL_POINTS
);
glVertex3d
(
v
->
x
(),
v
->
y
(),
v
->
z
()
);
glVertex3d
(
x
,
y
,
z
);
glEnd
();
}
}
...
...
@@ -76,9 +116,9 @@ class drawGVertex {
sprintf
(
Num
,
"%d"
,
v
->
tag
());
double
offset
=
(
0.5
*
CTX
.
geom
.
point_size
+
0.3
*
CTX
.
gl_fontsize
)
*
CTX
.
pixel_equiv_x
;
glRasterPos3d
(
v
->
x
()
+
offset
/
CTX
.
s
[
0
],
v
->
y
()
+
offset
/
CTX
.
s
[
1
],
v
->
z
()
+
offset
/
CTX
.
s
[
2
]);
glRasterPos3d
(
x
+
offset
/
CTX
.
s
[
0
],
y
+
offset
/
CTX
.
s
[
1
],
z
+
offset
/
CTX
.
s
[
2
]);
Draw_String
(
Num
);
}
...
...
@@ -90,7 +130,10 @@ class drawGVertex {
};
class
drawGEdge
{
private
:
visContext
*
_ctx
;
public
:
drawGEdge
(
visContext
*
ctx
)
:
_ctx
(
ctx
){}
void
operator
()
(
GEdge
*
e
)
{
if
(
!
e
->
getVisibility
())
return
;
...
...
@@ -136,6 +179,8 @@ class drawGEdge {
double
x
[
2
]
=
{
p1
.
x
(),
p2
.
x
()};
double
y
[
2
]
=
{
p1
.
y
(),
p2
.
y
()};
double
z
[
2
]
=
{
p1
.
z
(),
p2
.
z
()};
_ctx
->
transform
(
x
[
0
],
y
[
0
],
z
[
0
]);
_ctx
->
transform
(
x
[
1
],
y
[
1
],
z
[
1
]);
Draw_Cylinder
(
e
->
getSelection
()
?
CTX
.
geom
.
line_sel_width
:
CTX
.
geom
.
line_width
,
x
,
y
,
z
,
CTX
.
geom
.
light
);
}
...
...
@@ -145,7 +190,9 @@ class drawGEdge {
for
(
int
i
=
0
;
i
<
N
;
i
++
)
{
double
t
=
t_min
+
(
double
)
i
/
(
double
)(
N
-
1
)
*
(
t_max
-
t_min
);
GPoint
p
=
e
->
point
(
t
);
glVertex3d
(
p
.
x
(),
p
.
y
(),
p
.
z
());
double
x
=
p
.
x
(),
y
=
p
.
y
(),
z
=
p
.
z
();
_ctx
->
transform
(
x
,
y
,
z
);
glVertex3d
(
x
,
y
,
z
);
}
glEnd
();
}
...
...
@@ -157,9 +204,11 @@ class drawGEdge {
sprintf
(
Num
,
"%d"
,
e
->
tag
());
double
offset
=
(
0.5
*
CTX
.
geom
.
line_width
+
0.3
*
CTX
.
gl_fontsize
)
*
CTX
.
pixel_equiv_x
;
glRasterPos3d
(
p
.
x
()
+
offset
/
CTX
.
s
[
0
],
p
.
y
()
+
offset
/
CTX
.
s
[
1
],
p
.
z
()
+
offset
/
CTX
.
s
[
2
]);
double
x
=
p
.
x
(),
y
=
p
.
y
(),
z
=
p
.
z
();
_ctx
->
transform
(
x
,
y
,
z
);
glRasterPos3d
(
x
+
offset
/
CTX
.
s
[
0
],
y
+
offset
/
CTX
.
s
[
1
],
z
+
offset
/
CTX
.
s
[
2
]);
Draw_String
(
Num
);
}
...
...
@@ -171,9 +220,12 @@ class drawGEdge {
for
(
int
i
=
0
;
i
<
3
;
i
++
)
der
[
i
]
*=
CTX
.
geom
.
tangents
*
CTX
.
pixel_equiv_x
/
CTX
.
s
[
i
];
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
geom
.
tangents
);
double
x
=
p
.
x
(),
y
=
p
.
y
(),
z
=
p
.
z
();
_ctx
->
transform
(
x
,
y
,
z
);
// FIXME: transform the tangent
Draw_Vector
(
CTX
.
vector_type
,
0
,
CTX
.
arrow_rel_head_radius
,
CTX
.
arrow_rel_stem_length
,
CTX
.
arrow_rel_stem_radius
,
p
.
x
(),
p
.
y
(),
p
.
z
()
,
der
[
0
],
der
[
1
],
der
[
2
],
CTX
.
geom
.
light
);
x
,
y
,
z
,
der
[
0
],
der
[
1
],
der
[
2
],
CTX
.
geom
.
light
);
}
if
(
CTX
.
draw_bbox
)
drawBBox
(
e
);
...
...
@@ -187,6 +239,7 @@ class drawGEdge {
class
drawGFace
{
private:
visContext
*
_ctx
;
void
_drawVertexArray
(
VertexArray
*
va
,
bool
useNormalArray
,
int
forceColor
=
0
,
unsigned
int
color
=
0
)
{
...
...
@@ -246,13 +299,17 @@ class drawGFace {
glBegin
(
GL_LINE_STRIP
);
for
(
int
i
=
0
;
i
<
N
;
i
++
)
{
GPoint
p
=
f
->
point
(
ubounds
.
low
()
+
ud
*
(
double
)
i
/
(
double
)(
N
-
1
),
vav
);
glVertex3d
(
p
.
x
(),
p
.
y
(),
p
.
z
());
double
x
=
p
.
x
(),
y
=
p
.
y
(),
z
=
p
.
z
();
_ctx
->
transform
(
x
,
y
,
z
);
glVertex3d
(
x
,
y
,
z
);
}
glEnd
();
glBegin
(
GL_LINE_STRIP
);
for
(
int
i
=
0
;
i
<
N
;
i
++
)
{
GPoint
p
=
f
->
point
(
uav
,
vbounds
.
low
()
+
vd
*
(
double
)
i
/
(
double
)(
N
-
1
));
glVertex3d
(
p
.
x
(),
p
.
y
(),
p
.
z
());
double
x
=
p
.
x
(),
y
=
p
.
y
(),
z
=
p
.
z
();
_ctx
->
transform
(
x
,
y
,
z
);
glVertex3d
(
x
,
y
,
z
);
}
glEnd
();
glDisable
(
GL_LINE_STIPPLE
);
...
...
@@ -265,9 +322,11 @@ class drawGFace {
char
Num
[
100
];
sprintf
(
Num
,
"%d"
,
f
->
tag
());
double
offset
=
0.3
*
CTX
.
gl_fontsize
*
CTX
.
pixel_equiv_x
;
glRasterPos3d
(
p
.
x
()
+
offset
/
CTX
.
s
[
0
],
p
.
y
()
+
offset
/
CTX
.
s
[
1
],
p
.
z
()
+
offset
/
CTX
.
s
[
2
]);
double
x
=
p
.
x
(),
y
=
p
.
y
(),
z
=
p
.
z
();
_ctx
->
transform
(
x
,
y
,
z
);
glRasterPos3d
(
x
+
offset
/
CTX
.
s
[
0
],
y
+
offset
/
CTX
.
s
[
1
],
z
+
offset
/
CTX
.
s
[
2
]);
Draw_String
(
Num
);
}
...
...
@@ -277,9 +336,12 @@ class drawGFace {
for
(
int
i
=
0
;
i
<
3
;
i
++
)
n
[
i
]
*=
CTX
.
geom
.
normals
*
CTX
.
pixel_equiv_x
/
CTX
.
s
[
i
];
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
geom
.
normals
);
double
x
=
p
.
x
(),
y
=
p
.
y
(),
z
=
p
.
z
();
_ctx
->
transform
(
x
,
y
,
z
);
// FIXME: transform the normal
Draw_Vector
(
CTX
.
vector_type
,
0
,
CTX
.
arrow_rel_head_radius
,
CTX
.
arrow_rel_stem_length
,
CTX
.
arrow_rel_stem_radius
,
p
.
x
(),
p
.
y
(),
p
.
z
()
,
n
[
0
],
n
[
1
],
n
[
2
],
CTX
.
geom
.
light
);
x
,
y
,
z
,
n
[
0
],
n
[
1
],
n
[
2
],
CTX
.
geom
.
light
);
}
}
void
_drawPlaneGFace
(
GFace
*
f
)
...
...
@@ -290,13 +352,14 @@ class drawGFace {
// reentrant, so we must lock it to avoid race conditions when
// redraw events are fired in rapid succession
static
bool
busy
=
false
;
if
(
!
f
->
cross
.
size
()
&&
!
busy
)
{
if
(
f
->
cross
.
empty
()
&&
!
busy
)
{
busy
=
true
;
f
->
buildRepresentationCross
();
busy
=
false
;
}
}
//FIXME: cleanup buildGraphicsRep
if
(
CTX
.
geom
.
surfaces
)
{
if
(
CTX
.
geom
.
surface_type
>
0
&&
f
->
va_geom_triangles
){
_drawVertexArray
(
f
->
va_geom_triangles
,
CTX
.
geom
.
light
,
...
...
@@ -307,8 +370,11 @@ class drawGFace {
glLineStipple
(
1
,
0x1F1F
);
gl2psEnable
(
GL2PS_LINE_STIPPLE
);
glBegin
(
GL_LINES
);
for
(
unsigned
int
i
=
0
;
i
<
f
->
cross
.
size
();
i
++
)
glVertex3d
(
f
->
cross
[
i
].
x
(),
f
->
cross
[
i
].
y
(),
f
->
cross
[
i
].
z
());
for
(
unsigned
int
i
=
0
;
i
<
f
->
cross
.
size
();
i
++
){
double
x
=
f
->
cross
[
i
].
x
(),
y
=
f
->
cross
[
i
].
y
(),
z
=
f
->
cross
[
i
].
z
();
_ctx
->
transform
(
x
,
y
,
z
);
glVertex3d
(
x
,
y
,
z
);
}
glEnd
();
glDisable
(
GL_LINE_STIPPLE
);
gl2psDisable
(
GL2PS_LINE_STIPPLE
);
...
...
@@ -321,9 +387,13 @@ class drawGFace {
char
Num
[
100
];
sprintf
(
Num
,
"%d"
,
f
->
tag
());
double
offset
=
0.3
*
CTX
.
gl_fontsize
*
CTX
.
pixel_equiv_x
;
glRasterPos3d
(
0.5
*
(
f
->
cross
[
0
].
x
()
+
f
->
cross
[
1
].
x
())
+
offset
/
CTX
.
s
[
0
],
0.5
*
(
f
->
cross
[
0
].
y
()
+
f
->
cross
[
1
].
y
())
+
offset
/
CTX
.
s
[
0
],
0.5
*
(
f
->
cross
[
0
].
z
()
+
f
->
cross
[
1
].
z
())
+
offset
/
CTX
.
s
[
0
]);
double
x
=
0.5
*
(
f
->
cross
[
0
].
x
()
+
f
->
cross
[
1
].
x
());
double
y
=
0.5
*
(
f
->
cross
[
0
].
y
()
+
f
->
cross
[
1
].
y
());
double
z
=
0.5
*
(
f
->
cross
[
0
].
z
()
+
f
->
cross
[
1
].
z
());
_ctx
->
transform
(
x
,
y
,
z
);
glRasterPos3d
(
x
+
offset
/
CTX
.
s
[
0
],
y
+
offset
/
CTX
.
s
[
0
],
z
+
offset
/
CTX
.
s
[
0
]);
Draw_String
(
Num
);
}
...
...
@@ -336,13 +406,17 @@ class drawGFace {
for
(
int
i
=
0
;
i
<
3
;
i
++
)
n
[
i
]
*=
CTX
.
geom
.
normals
*
CTX
.
pixel_equiv_x
/
CTX
.
s
[
i
];
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
geom
.
normals
);
double
x
=
p
.
x
(),
y
=
p
.
y
(),
z
=
p
.
z
();
_ctx
->
transform
(
x
,
y
,
z
);
// FIXME: transform the normal
Draw_Vector
(
CTX
.
vector_type
,
0
,
CTX
.
arrow_rel_head_radius
,
CTX
.
arrow_rel_stem_length
,
CTX
.
arrow_rel_stem_radius
,
p
.
x
(),
p
.
y
(),
p
.
z
()
,
n
[
0
],
n
[
1
],
n
[
2
],
CTX
.
geom
.
light
);
x
,
y
,
z
,
n
[
0
],
n
[
1
],
n
[
2
],
CTX
.
geom
.
light
);
}
}
public
:
drawGFace
(
visContext
*
ctx
)
:
_ctx
(
ctx
)
{}
void
operator
()
(
GFace
*
f
)
{
if
(
!
f
->
getVisibility
())
return
;
...
...
@@ -381,7 +455,10 @@ public :
};
class
drawGRegion
{
private
:
visContext
*
_ctx
;
public
:
drawGRegion
(
visContext
*
ctx
)
:
_ctx
(
ctx
){}
void
operator
()
(
GRegion
*
r
)
{
if
(
!
r
->
getVisibility
())
return
;
...
...
@@ -400,16 +477,19 @@ class drawGRegion {
SPoint3
p
=
r
->
bounds
().
center
();
const
double
size
=
8.
;
double
x
=
p
.
x
(),
y
=
p
.
y
(),
z
=
p
.
z
();
_ctx
->
transform
(
x
,
y
,
z
);
if
(
CTX
.
geom
.
volumes
)
Draw_Sphere
(
size
,
p
.
x
(),
p
.
y
(),
p
.
z
()
,
CTX
.
geom
.
light
);
Draw_Sphere
(
size
,
x
,
y
,
z
,
CTX
.
geom
.
light
);
if
(
CTX
.
geom
.
volumes_num
){
char
Num
[
100
];
sprintf
(
Num
,
"%d"
,
r
->
tag
());
double
offset
=
(
0.5
*
size
+
0.3
*
CTX
.
gl_fontsize
)
*
CTX
.
pixel_equiv_x
;
glRasterPos3d
(
p
.
x
()
+
offset
/
CTX
.
s
[
0
],
p
.
y
()
+
offset
/
CTX
.
s
[
1
],
p
.
z
()
+
offset
/
CTX
.
s
[
2
]);
glRasterPos3d
(
x
+
offset
/
CTX
.
s
[
0
],
y
+
offset
/
CTX
.
s
[
1
],
z
+
offset
/
CTX
.
s
[
2
]);
Draw_String
(
Num
);
}
...
...
@@ -439,17 +519,21 @@ void Draw_Geom()
GModel
*
m
=
GModel
::
current
();
visContext
ctx
;
//double mat[3][3] = {{2, 0, 0}, {0, 1, 0}, {0, 0, 1}};
//visContextScaled ctx(mat);
if
(
CTX
.
geom
.
points
||
CTX
.
geom
.
points_num
)
std
::
for_each
(
m
->
firstVertex
(),
m
->
lastVertex
(),
drawGVertex
());
std
::
for_each
(
m
->
firstVertex
(),
m
->
lastVertex
(),
drawGVertex
(
&
ctx
));
if
(
CTX
.
geom
.
lines
||
CTX
.
geom
.
lines_num
||
CTX
.
geom
.
tangents
)
std
::
for_each
(
m
->
firstEdge
(),
m
->
lastEdge
(),
drawGEdge
());
std
::
for_each
(
m
->
firstEdge
(),
m
->
lastEdge
(),
drawGEdge
(
&
ctx
));
if
(
CTX
.
geom
.
surfaces
||
CTX
.
geom
.
surfaces_num
||
CTX
.
geom
.
normals
)
std
::
for_each
(
m
->
firstFace
(),
m
->
lastFace
(),
drawGFace
());
std
::
for_each
(
m
->
firstFace
(),
m
->
lastFace
(),
drawGFace
(
&
ctx
));
if
(
CTX
.
geom
.
volumes
||
CTX
.
geom
.
volumes_num
)
std
::
for_each
(
m
->
firstRegion
(),
m
->
lastRegion
(),
drawGRegion
());
std
::
for_each
(
m
->
firstRegion
(),
m
->
lastRegion
(),
drawGRegion
(
&
ctx
));
for
(
int
i
=
0
;
i
<
6
;
i
++
)
glDisable
((
GLenum
)(
GL_CLIP_PLANE0
+
i
));
...
...
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