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
dabfb319
Commit
dabfb319
authored
17 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
add translation along principal axes
parent
03242491
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
Fltk/GUI_Projection.cpp
+42
-10
42 additions, 10 deletions
Fltk/GUI_Projection.cpp
Fltk/GUI_Projection.h
+6
-1
6 additions, 1 deletion
Fltk/GUI_Projection.h
with
48 additions
and
11 deletions
Fltk/GUI_Projection.cpp
+
42
−
10
View file @
dabfb319
...
...
@@ -148,6 +148,21 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i
v
->
label
((
i
==
0
)
?
"X"
:
(
i
==
1
)
?
"Y"
:
"Z"
);
}
ps
->
SetOrigin
(
pc
[
0
],
pc
[
1
],
pc
[
2
]);
Fl_Repeat_Button
*
bm
[
3
],
*
bp
[
3
];
for
(
int
i
=
0
;
i
<
3
;
i
++
){
new
Fl_Box
(
x
+
w
-
BB
/
3
-
BB
/
6
,
y
+
(
1
+
i
)
*
BH
,
BB
/
8
,
BH
,
(
i
==
0
)
?
"E0"
:
(
i
==
1
)
?
"E1"
:
"E2"
);
bp
[
i
]
=
new
Fl_Repeat_Button
(
x
+
w
-
BB
/
3
,
y
+
(
1
+
i
)
*
BH
,
BB
/
8
,
BH
/
2
,
"+"
);
bm
[
i
]
=
new
Fl_Repeat_Button
(
x
+
w
-
BB
/
3
,
y
+
(
1
+
i
)
*
BH
+
BH
/
2
,
BB
/
8
,
BH
/
2
,
"-"
);
}
bp
[
0
]
->
callback
(
translate_p0_cb
,
e
);
bp
[
1
]
->
callback
(
translate_p1_cb
,
e
);
bp
[
2
]
->
callback
(
translate_p2_cb
,
e
);
bm
[
0
]
->
callback
(
translate_m0_cb
,
e
);
bm
[
1
]
->
callback
(
translate_m1_cb
,
e
);
bm
[
2
]
->
callback
(
translate_m2_cb
,
e
);
}
{
// normal is stored in parameters[3,4,5]
Fl_Value_Input
*
v1
=
new
Fl_Value_Input
(
x
,
y
+
4
*
BH
,
BB
/
3
,
BH
);
...
...
@@ -160,7 +175,7 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i
parameters
.
push_back
(
v3
);
v3
->
maximum
(
1.
);
v3
->
minimum
(
-
1.
);
v3
->
step
(
0.01
);
v3
->
value
(
1.
);
v3
->
label
(
"Normal"
);
Fl_Button
*
b
=
new
Fl_Button
(
x
+
w
-
BB
/
3
,
y
+
4
*
BH
,
BB
/
8
,
BH
,
"-"
);
Fl_Button
*
b
=
new
Fl_Button
(
x
+
w
-
BB
/
3
,
y
+
4
*
BH
+
BH
/
4
,
BB
/
8
,
BH
/
2
,
"-"
);
b
->
callback
(
invert_normal_cb
,
e
);
b
->
tooltip
(
"Invert normal"
);
}
...
...
@@ -434,23 +449,40 @@ void invert_normal_cb(Fl_Widget *w, void *data)
}
}
void
translate
_cb
(
Fl_Widget
*
w
,
void
*
data
)
void
translate
(
void
*
data
,
int
axis
,
bool
plus
)
{
projectionEditor
*
e
=
(
projectionEditor
*
)
data
;
projection
*
p
=
e
->
getCurrentProjection
();
if
(
p
){
// add widgets so that we can translate along the principal
// directions, and change the origin's position accordingly
double
x
=
p
->
parameters
[
0
]
->
value
();
double
y
=
p
->
parameters
[
1
]
->
value
();
double
z
=
p
->
parameters
[
2
]
->
value
();
p
->
parameters
[
0
]
->
value
(
x
);
p
->
parameters
[
1
]
->
value
(
y
);
p
->
parameters
[
2
]
->
value
(
z
);
FM
::
ProjectionSurface
*
ps
=
p
->
face
->
GetProjectionSurface
();
SVector3
origin
(
p
->
parameters
[
0
]
->
value
(),
p
->
parameters
[
1
]
->
value
(),
p
->
parameters
[
2
]
->
value
());
SVector3
vec
;
if
(
axis
==
0
)
ps
->
GetE0
(
vec
[
0
],
vec
[
1
],
vec
[
2
]);
else
if
(
axis
==
1
)
ps
->
GetE1
(
vec
[
0
],
vec
[
1
],
vec
[
2
]);
else
ps
->
GetE2
(
vec
[
0
],
vec
[
1
],
vec
[
2
]);
if
(
plus
)
origin
+=
vec
*
(
CTX
.
lc
/
100.
);
else
origin
-=
vec
*
(
CTX
.
lc
/
100.
);
p
->
parameters
[
0
]
->
value
(
origin
[
0
]);
p
->
parameters
[
1
]
->
value
(
origin
[
1
]);
p
->
parameters
[
2
]
->
value
(
origin
[
2
]);
update_cb
(
0
,
data
);
}
}
void
translate_p0_cb
(
Fl_Widget
*
w
,
void
*
data
){
translate
(
data
,
0
,
true
);
}
void
translate_p1_cb
(
Fl_Widget
*
w
,
void
*
data
){
translate
(
data
,
1
,
true
);
}
void
translate_p2_cb
(
Fl_Widget
*
w
,
void
*
data
){
translate
(
data
,
2
,
true
);
}
void
translate_m0_cb
(
Fl_Widget
*
w
,
void
*
data
){
translate
(
data
,
0
,
false
);
}
void
translate_m1_cb
(
Fl_Widget
*
w
,
void
*
data
){
translate
(
data
,
1
,
false
);
}
void
translate_m2_cb
(
Fl_Widget
*
w
,
void
*
data
){
translate
(
data
,
2
,
false
);
}
void
set_position_cb
(
Fl_Widget
*
w
,
void
*
data
)
{
projectionEditor
*
e
=
(
projectionEditor
*
)
data
;
...
...
This diff is collapsed.
Click to expand it.
Fltk/GUI_Projection.h
+
6
−
1
View file @
dabfb319
...
...
@@ -19,7 +19,12 @@ void filter_cb(Fl_Widget *w, void *data);
void
browse_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
set_position_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
invert_normal_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
translate_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
translate_p0_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
translate_p1_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
translate_p2_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
translate_m0_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
translate_m1_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
translate_m2_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
update_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
close_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
hide_cb
(
Fl_Widget
*
w
,
void
*
data
);
...
...
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