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
59b40e99
Commit
59b40e99
authored
14 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
enable 3D points in 2D graphs
parent
a247bf82
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
Graphics/drawContext.cpp
+2
-1
2 additions, 1 deletion
Graphics/drawContext.cpp
Graphics/drawGraph2d.cpp
+23
-20
23 additions, 20 deletions
Graphics/drawGraph2d.cpp
with
25 additions
and
21 deletions
Graphics/drawContext.cpp
+
2
−
1
View file @
59b40e99
...
@@ -265,7 +265,8 @@ void drawContext::draw2d()
...
@@ -265,7 +265,8 @@ void drawContext::draw2d()
glMatrixMode
(
GL_PROJECTION
);
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
glLoadIdentity
();
glOrtho
((
double
)
viewport
[
0
],
(
double
)
viewport
[
2
],
glOrtho
((
double
)
viewport
[
0
],
(
double
)
viewport
[
2
],
(
double
)
viewport
[
1
],
(
double
)
viewport
[
3
],
-
1.
,
1.
);
(
double
)
viewport
[
1
],
(
double
)
viewport
[
3
],
-
100.
,
100.
);
// in pixels, so we can draw some 3D glyphs
// hack to make the 2D primitives appear "in front" in GL2PS
// hack to make the 2D primitives appear "in front" in GL2PS
glTranslated
(
0.
,
0.
,
CTX
::
instance
()
->
clipFactor
>
1.
?
glTranslated
(
0.
,
0.
,
CTX
::
instance
()
->
clipFactor
>
1.
?
...
...
This diff is collapsed.
Click to expand it.
Graphics/drawGraph2d.cpp
+
23
−
20
View file @
59b40e99
...
@@ -310,7 +310,7 @@ static void drawGraphAxes(drawContext *ctx, PView *p, double xleft, double ytop,
...
@@ -310,7 +310,7 @@ static void drawGraphAxes(drawContext *ctx, PView *p, double xleft, double ytop,
static
void
addGraphPoint
(
drawContext
*
ctx
,
PView
*
p
,
double
xleft
,
double
ytop
,
static
void
addGraphPoint
(
drawContext
*
ctx
,
PView
*
p
,
double
xleft
,
double
ytop
,
double
width
,
double
height
,
double
x
,
double
y
,
double
width
,
double
height
,
double
x
,
double
y
,
double
xmin
,
double
xmax
,
double
ymin
,
double
ymax
,
double
xmin
,
double
xmax
,
double
ymin
,
double
ymax
,
bool
numeric
)
bool
numeric
,
bool
sphere
)
{
{
PViewOptions
*
opt
=
p
->
getOptions
();
PViewOptions
*
opt
=
p
->
getOptions
();
...
@@ -337,6 +337,8 @@ static void addGraphPoint(drawContext *ctx, PView *p, double xleft, double ytop,
...
@@ -337,6 +337,8 @@ static void addGraphPoint(drawContext *ctx, PView *p, double xleft, double ytop,
sprintf
(
label
,
opt
->
format
.
c_str
(),
y
);
sprintf
(
label
,
opt
->
format
.
c_str
(),
y
);
ctx
->
drawString
(
label
);
ctx
->
drawString
(
label
);
}
}
else
if
(
sphere
)
ctx
->
drawSphere
(
opt
->
pointSize
,
px
,
py
,
0
,
10
,
10
,
opt
->
light
);
else
else
glVertex2d
(
px
,
py
);
glVertex2d
(
px
,
py
);
}
}
...
@@ -355,24 +357,6 @@ static void drawGraphCurves(drawContext *ctx, PView *p, double xleft, double yto
...
@@ -355,24 +357,6 @@ static void drawGraphCurves(drawContext *ctx, PView *p, double xleft, double yto
glLineWidth
((
float
)
opt
->
lineWidth
);
glLineWidth
((
float
)
opt
->
lineWidth
);
gl2psLineWidth
((
float
)(
opt
->
lineWidth
*
CTX
::
instance
()
->
print
.
epsLineWidthFactor
));
gl2psLineWidth
((
float
)(
opt
->
lineWidth
*
CTX
::
instance
()
->
print
.
epsLineWidthFactor
));
if
(
opt
->
intervalsType
==
PViewOptions
::
Numeric
){
for
(
unsigned
int
i
=
0
;
i
<
y
.
size
();
i
++
)
for
(
unsigned
int
j
=
0
;
j
<
x
.
size
();
j
++
)
addGraphPoint
(
ctx
,
p
,
xleft
,
ytop
,
width
,
height
,
x
[
j
],
y
[
i
][
j
],
xmin
,
xmax
,
opt
->
tmpMin
,
opt
->
tmpMax
,
true
);
}
if
(
opt
->
intervalsType
==
PViewOptions
::
Iso
||
opt
->
intervalsType
==
PViewOptions
::
Discrete
||
opt
->
intervalsType
==
PViewOptions
::
Numeric
){
glBegin
(
GL_POINTS
);
for
(
unsigned
int
i
=
0
;
i
<
y
.
size
();
i
++
)
for
(
unsigned
int
j
=
0
;
j
<
x
.
size
();
j
++
)
addGraphPoint
(
ctx
,
p
,
xleft
,
ytop
,
width
,
height
,
x
[
j
],
y
[
i
][
j
],
xmin
,
xmax
,
opt
->
tmpMin
,
opt
->
tmpMax
,
false
);
glEnd
();
}
if
(
opt
->
intervalsType
==
PViewOptions
::
Discrete
||
if
(
opt
->
intervalsType
==
PViewOptions
::
Discrete
||
opt
->
intervalsType
==
PViewOptions
::
Continuous
){
opt
->
intervalsType
==
PViewOptions
::
Continuous
){
for
(
unsigned
int
i
=
0
;
i
<
y
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
y
.
size
();
i
++
){
...
@@ -384,7 +368,7 @@ static void drawGraphCurves(drawContext *ctx, PView *p, double xleft, double yto
...
@@ -384,7 +368,7 @@ static void drawGraphCurves(drawContext *ctx, PView *p, double xleft, double yto
glBegin
(
GL_LINE_STRIP
);
glBegin
(
GL_LINE_STRIP
);
for
(
unsigned
int
j
=
0
;
j
<
x
.
size
();
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
x
.
size
();
j
++
)
addGraphPoint
(
ctx
,
p
,
xleft
,
ytop
,
width
,
height
,
x
[
j
],
y
[
i
][
j
],
addGraphPoint
(
ctx
,
p
,
xleft
,
ytop
,
width
,
height
,
x
[
j
],
y
[
i
][
j
],
xmin
,
xmax
,
opt
->
tmpMin
,
opt
->
tmpMax
,
false
);
xmin
,
xmax
,
opt
->
tmpMin
,
opt
->
tmpMax
,
false
,
false
);
glEnd
();
glEnd
();
if
(
opt
->
useStipple
){
if
(
opt
->
useStipple
){
glDisable
(
GL_LINE_STIPPLE
);
glDisable
(
GL_LINE_STIPPLE
);
...
@@ -392,6 +376,25 @@ static void drawGraphCurves(drawContext *ctx, PView *p, double xleft, double yto
...
@@ -392,6 +376,25 @@ static void drawGraphCurves(drawContext *ctx, PView *p, double xleft, double yto
}
}
}
}
}
}
if
(
opt
->
intervalsType
==
PViewOptions
::
Iso
||
opt
->
intervalsType
==
PViewOptions
::
Discrete
||
opt
->
intervalsType
==
PViewOptions
::
Numeric
){
bool
sphere
=
(
opt
->
pointType
==
1
||
opt
->
pointType
==
3
);
if
(
!
sphere
)
glBegin
(
GL_POINTS
);
for
(
unsigned
int
i
=
0
;
i
<
y
.
size
();
i
++
)
for
(
unsigned
int
j
=
0
;
j
<
x
.
size
();
j
++
)
addGraphPoint
(
ctx
,
p
,
xleft
,
ytop
,
width
,
height
,
x
[
j
],
y
[
i
][
j
],
xmin
,
xmax
,
opt
->
tmpMin
,
opt
->
tmpMax
,
false
,
sphere
);
if
(
!
sphere
)
glEnd
();
}
if
(
opt
->
intervalsType
==
PViewOptions
::
Numeric
){
for
(
unsigned
int
i
=
0
;
i
<
y
.
size
();
i
++
)
for
(
unsigned
int
j
=
0
;
j
<
x
.
size
();
j
++
)
addGraphPoint
(
ctx
,
p
,
xleft
,
ytop
,
width
,
height
,
x
[
j
],
y
[
i
][
j
],
xmin
,
xmax
,
opt
->
tmpMin
,
opt
->
tmpMax
,
true
,
false
);
}
}
}
static
void
drawGraph
(
drawContext
*
ctx
,
PView
*
p
,
double
xleft
,
double
ytop
,
static
void
drawGraph
(
drawContext
*
ctx
,
PView
*
p
,
double
xleft
,
double
ytop
,
...
...
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