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
e89bd857
Commit
e89bd857
authored
17 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
prettify
parent
89c01b31
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
Fltk/GUI_Projection.cpp
+52
-42
52 additions, 42 deletions
Fltk/GUI_Projection.cpp
Fltk/GUI_Projection.h
+1
-0
1 addition, 0 deletions
Fltk/GUI_Projection.h
with
53 additions
and
42 deletions
Fltk/GUI_Projection.cpp
+
52
−
42
View file @
e89bd857
...
@@ -19,30 +19,37 @@ uvPlot::uvPlot(int x, int y, int w, int h, const char *l)
...
@@ -19,30 +19,37 @@ uvPlot::uvPlot(int x, int y, int w, int h, const char *l)
void
uvPlot
::
fill
(
std
::
vector
<
double
>
&
u
,
std
::
vector
<
double
>
&
v
,
void
uvPlot
::
fill
(
std
::
vector
<
double
>
&
u
,
std
::
vector
<
double
>
&
v
,
std
::
vector
<
double
>
&
f
)
std
::
vector
<
double
>
&
f
)
{
{
_u
=
u
;
_v
=
v
;
_f
=
f
;
_u
.
clear
();
// compute min/max distance
_v
.
clear
();
if
(
_f
.
size
()){
_f
.
clear
();
if
(
u
.
empty
()
||
u
.
size
()
!=
v
.
size
()
||
u
.
size
()
!=
f
.
size
())
return
;
_dmin
=
1.e200
;
_dmax
=
0.
;
_dmin
=
1.e200
;
_dmax
=
0.
;
for
(
unsigned
int
i
=
0
;
i
<
_f
.
size
();
i
++
){
// only compute min/max for valid projections
for
(
unsigned
int
i
=
0
;
i
<
u
.
size
();
i
++
){
if
(
_u
[
i
]
>=
0.
&&
_u
[
i
]
<=
1.
&&
// only store valid points
_v
[
i
]
>=
0.
&&
_v
[
i
]
<=
1.
){
if
(
u
[
i
]
>=
0.
&&
u
[
i
]
<=
1.
&&
v
[
i
]
>=
0.
&&
v
[
i
]
<=
1.
){
_dmin
=
std
::
min
(
_dmin
,
_f
[
i
]);
_u
.
push_back
(
u
[
i
]);
_dmax
=
std
::
max
(
_dmax
,
_f
[
i
]);
_v
.
push_back
(
v
[
i
]);
}
_f
.
push_back
(
f
[
i
]);
_dmin
=
std
::
min
(
_dmin
,
f
[
i
]);
_dmax
=
std
::
max
(
_dmax
,
f
[
i
]);
}
}
}
}
if
(
_u
.
empty
())
_dmin
=
_dmax
=
0.
;
redraw
();
redraw
();
}
}
void
uvPlot
::
color
(
double
d
)
void
uvPlot
::
color
(
double
d
)
{
{
int
numcol
=
_colorTable
.
size
;
int
index
;
int
index
;
if
(
_dmin
==
_dmax
)
if
(
_dmin
==
_dmax
)
index
=
numcol
/
2
;
index
=
_colorTable
.
size
/
2
;
else
else
index
=
(
int
)((
d
-
_dmin
)
*
(
numcol
-
1
)
/
(
_dmax
-
_dmin
));
index
=
(
int
)((
d
-
_dmin
)
*
(
_colorTable
.
size
-
1
)
/
(
_dmax
-
_dmin
));
unsigned
int
color
=
_colorTable
.
table
[
index
];
unsigned
int
color
=
_colorTable
.
table
[
index
];
int
r
=
CTX
.
UNPACK_RED
(
color
);
int
r
=
CTX
.
UNPACK_RED
(
color
);
int
g
=
CTX
.
UNPACK_GREEN
(
color
);
int
g
=
CTX
.
UNPACK_GREEN
(
color
);
...
@@ -56,22 +63,18 @@ void uvPlot::draw()
...
@@ -56,22 +63,18 @@ void uvPlot::draw()
fl_color
(
FL_WHITE
);
fl_color
(
FL_WHITE
);
fl_rectf
(
0
,
0
,
w
(),
h
());
fl_rectf
(
0
,
0
,
w
(),
h
());
// draw points
// draw points in u,v space, colored by their distance to the
if
(
_u
.
size
()
!=
_v
.
size
())
return
;
// projection surface
int
pw
=
w
();
int
pw
=
w
();
int
ph
=
h
()
-
30
;
int
ph
=
h
()
-
(
2
*
GetFontSize
()
+
5
);
for
(
unsigned
int
i
=
0
;
i
<
_u
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
_u
.
size
();
i
++
){
if
(
_u
[
i
]
>=
0.
&&
_u
[
i
]
<=
1.
&&
_v
[
i
]
>=
0.
&&
_v
[
i
]
<=
1.
){
int
x
=
(
int
)(
_u
[
i
]
*
pw
);
int
x
=
(
int
)(
_u
[
i
]
*
pw
);
int
y
=
(
int
)(
_v
[
i
]
*
ph
);
int
y
=
(
int
)(
_v
[
i
]
*
ph
);
color
(
_f
[
i
]);
color
(
_f
[
i
]);
fl_rect
(
x
,
y
,
3
,
3
);
fl_rect
(
x
,
y
,
3
,
3
);
}
}
}
// draw color bar
for
(
int
i
=
0
;
i
<
w
();
i
++
){
for
(
int
i
=
0
;
i
<
w
();
i
++
){
int
index
=
(
int
)(
i
*
(
_colorTable
.
size
-
1
)
/
w
());
int
index
=
(
int
)(
i
*
(
_colorTable
.
size
-
1
)
/
w
());
unsigned
int
color
=
_colorTable
.
table
[
index
];
unsigned
int
color
=
_colorTable
.
table
[
index
];
...
@@ -82,12 +85,15 @@ void uvPlot::draw()
...
@@ -82,12 +85,15 @@ void uvPlot::draw()
fl_line
(
i
,
ph
,
i
,
ph
+
10
);
fl_line
(
i
,
ph
,
i
,
ph
+
10
);
}
}
// draw labels
fl_color
(
FL_BLACK
);
fl_color
(
FL_BLACK
);
fl_font
(
FL_HELVETICA
,
13
);
fl_font
(
FL_HELVETICA
,
GetFontSize
()
);
static
char
min
[
256
],
max
[
256
];
static
char
min
[
256
],
max
[
256
]
,
pts
[
256
]
;
sprintf
(
min
,
"%g"
,
_dmin
);
sprintf
(
min
,
"%g"
,
_dmin
);
sprintf
(
max
,
"%g"
,
_dmax
);
sprintf
(
max
,
"%g"
,
_dmax
);
sprintf
(
pts
,
"[%d pts]"
,
_f
.
size
());
fl_draw
(
min
,
5
,
h
()
-
5
);
fl_draw
(
min
,
5
,
h
()
-
5
);
fl_draw
(
pts
,
pw
/
2
-
fl_width
(
pts
)
/
2
,
h
()
-
5
);
fl_draw
(
max
,
pw
-
fl_width
(
max
)
-
5
,
h
()
-
5
);
fl_draw
(
max
,
pw
-
fl_width
(
max
)
-
5
,
h
()
-
5
);
}
}
...
@@ -190,25 +196,28 @@ projectionEditor::projectionEditor(std::vector<FProjectionFace*> &faces)
...
@@ -190,25 +196,28 @@ projectionEditor::projectionEditor(std::vector<FProjectionFace*> &faces)
}
}
int
hard
=
8
;
int
hard
=
8
;
new
Fl_Toggle_Button
(
WB
,
3
*
WB
+
8
*
BH
+
hard
,
hardEdges
[
0
]
=
new
Fl_Toggle_Button
(
WB
,
3
*
WB
+
8
*
BH
+
hard
,
hard
,
height
-
5
*
WB
-
1
2
*
BH
-
2
*
hard
);
hard
,
height
-
7
*
WB
-
1
1
*
BH
-
2
*
hard
);
new
Fl_Toggle_Button
(
width
-
WB
-
hard
,
3
*
WB
+
8
*
BH
+
hard
,
hardEdges
[
1
]
=
new
Fl_Toggle_Button
(
width
-
WB
-
hard
,
3
*
WB
+
8
*
BH
+
hard
,
hard
,
height
-
5
*
WB
-
1
2
*
BH
-
2
*
hard
);
hard
,
height
-
7
*
WB
-
1
1
*
BH
-
2
*
hard
);
new
Fl_Toggle_Button
(
WB
+
hard
,
3
*
WB
+
8
*
BH
,
hardEdges
[
2
]
=
new
Fl_Toggle_Button
(
WB
+
hard
,
3
*
WB
+
8
*
BH
,
width
-
2
*
WB
-
2
*
hard
,
hard
);
width
-
2
*
WB
-
2
*
hard
,
hard
);
new
Fl_Toggle_Button
(
WB
+
hard
,
3
*
WB
+
8
*
BH
+
height
-
5
*
WB
-
12
*
BH
-
hard
,
hardEdges
[
3
]
=
new
Fl_Toggle_Button
(
WB
+
hard
,
-
4
*
WB
-
3
*
BH
+
height
-
hard
,
width
-
2
*
WB
-
2
*
hard
,
hard
);
width
-
2
*
WB
-
2
*
hard
,
hard
);
for
(
int
i
=
0
;
i
<
4
;
i
++
){
hardEdges
[
i
]
->
tooltip
(
"Push to mark edge as `hard'"
);
}
_uvPlot
=
_uvPlot
=
new
uvPlot
(
WB
+
hard
,
3
*
WB
+
8
*
BH
+
hard
,
new
uvPlot
(
WB
+
hard
,
3
*
WB
+
8
*
BH
+
hard
,
width
-
2
*
WB
-
2
*
hard
,
height
-
5
*
WB
-
1
2
*
BH
-
2
*
hard
);
width
-
2
*
WB
-
2
*
hard
,
height
-
7
*
WB
-
1
1
*
BH
-
2
*
hard
);
_uvPlot
->
end
();
_uvPlot
->
end
();
modes
[
0
]
=
new
Fl_Value_Input
(
WB
,
height
-
WB
-
4
*
BH
,
BB
/
2
,
BH
);
modes
[
0
]
=
new
Fl_Value_Input
(
WB
,
height
-
3
*
WB
-
3
*
BH
,
BB
/
2
,
BH
);
modes
[
1
]
=
new
Fl_Value_Input
(
WB
+
BB
/
2
,
height
-
WB
-
4
*
BH
,
BB
/
2
,
BH
,
modes
[
1
]
=
new
Fl_Value_Input
(
WB
+
BB
/
2
,
height
-
3
*
WB
-
3
*
BH
,
BB
/
2
,
BH
,
"Fourier modes along u and v"
);
"Fourier modes along u and v"
);
modes
[
2
]
=
new
Fl_Value_Input
(
WB
,
height
-
WB
-
3
*
BH
,
BB
/
2
,
BH
);
modes
[
2
]
=
new
Fl_Value_Input
(
WB
,
height
-
3
*
WB
-
2
*
BH
,
BB
/
2
,
BH
);
modes
[
3
]
=
new
Fl_Value_Input
(
WB
+
BB
/
2
,
height
-
WB
-
3
*
BH
,
BB
/
2
,
BH
,
modes
[
3
]
=
new
Fl_Value_Input
(
WB
+
BB
/
2
,
height
-
3
*
WB
-
2
*
BH
,
BB
/
2
,
BH
,
"Chebychev modes along u and v"
);
"Chebychev modes along u and v"
);
for
(
int
i
=
0
;
i
<
4
;
i
++
){
for
(
int
i
=
0
;
i
<
4
;
i
++
){
modes
[
i
]
->
maximum
(
128
);
modes
[
i
]
->
maximum
(
128
);
...
@@ -560,7 +569,8 @@ void compute_cb(Fl_Widget *w, void *data)
...
@@ -560,7 +569,8 @@ void compute_cb(Fl_Widget *w, void *data)
color
[
0
]
=
0
;
color
[
1
]
=
0
;
color
[
2
]
=
1
;
color
[
0
]
=
0
;
color
[
1
]
=
0
;
color
[
2
]
=
1
;
plotSceneViewer
(
0
,
"patch.iv"
,
color
,
x
,
y
,
z
,
nU
,
nV
,
mask
);
plotSceneViewer
(
0
,
"patch.iv"
,
color
,
x
,
y
,
z
,
nU
,
nV
,
mask
);
}
}
//Msg(GERROR, "Compute!");
Draw
();
}
}
void
mesh_parameterize_cb
(
Fl_Widget
*
w
,
void
*
data
)
void
mesh_parameterize_cb
(
Fl_Widget
*
w
,
void
*
data
)
...
...
This diff is collapsed.
Click to expand it.
Fltk/GUI_Projection.h
+
1
−
0
View file @
e89bd857
...
@@ -71,6 +71,7 @@ class projectionEditor {
...
@@ -71,6 +71,7 @@ class projectionEditor {
void
show
(){
_window
->
show
();
select_cb
(
0
,
this
);
}
void
show
(){
_window
->
show
();
select_cb
(
0
,
this
);
}
uvPlot
*
uv
()
{
return
_uvPlot
;
}
uvPlot
*
uv
()
{
return
_uvPlot
;
}
Fl_Value_Input
*
modes
[
4
];
Fl_Value_Input
*
modes
[
4
];
Fl_Toggle_Button
*
hardEdges
[
4
];
std
::
vector
<
MElement
*>
&
getElements
()
{
return
_elements
;
}
std
::
vector
<
MElement
*>
&
getElements
()
{
return
_elements
;
}
std
::
vector
<
GEntity
*>
&
getEntities
()
{
return
_entities
;
}
std
::
vector
<
GEntity
*>
&
getEntities
()
{
return
_entities
;
}
std
::
vector
<
projection
*>
&
getProjections
()
{
return
_projections
;
}
std
::
vector
<
projection
*>
&
getProjections
()
{
return
_projections
;
}
...
...
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