Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Plugin-Plane
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenFlipper-Free
Plugin-Plane
Commits
9b99187f
Commit
9b99187f
authored
4 years ago
by
Zain Selman
Browse files
Options
Downloads
Patches
Plain Diff
it does not work
parent
6d76c689
No related branches found
No related tags found
1 merge request
!2
Plane interaction
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
PlanePlugin.cc
+26
-15
26 additions, 15 deletions
PlanePlugin.cc
with
26 additions
and
15 deletions
PlanePlugin.cc
+
26
−
15
View file @
9b99187f
...
...
@@ -265,6 +265,9 @@ void PlanePlugin::slotMouseEvent(QMouseEvent *_event) {
/// matrix to transform points from image plane to curPlane_
auto
plane
=
origPlane_
;
/// remeber position to do translation by hand
const
auto
initPos
=
plane
.
position
;
/// get the world position of the projected cursor by intersecting plane
/// equation with ray
{
...
...
@@ -300,38 +303,46 @@ void PlanePlugin::slotMouseEvent(QMouseEvent *_event) {
const
auto
worldSpaceUpdate
=
(
currWorldPos_
-
result_
)
/
2.
;
/// vector to clicked corner. update to corresponding corner later
const
auto
distClickOrigin
=
plane
.
position
+
(
.5
f
*
plane
.
xDirection
)
+
(
.5
f
*
plane
.
yDirection
);
// const auto distClickOrigin = plane.position + (.5f *
// plane.xDirection) +
// (.5f * plane.yDirection);
const
auto
distClickOrigin
=
result_
;
/// 1. transform to origin
auto
transformation
=
ACG
::
GLMatrixf
(
ACG
::
Matrix4x4f
());
transformation
.
identity
();
// init
transformation
.
translate
(
ACG
::
Vec3f
{
-
plane
.
position
});
/// 2. rotate to be planar
/// 1. translate to origin
plane
.
position
-=
initPos
;
/*/// 2. rotate to be planar
// const auto n0 = ACG::Vec3f{plane.normal};
// const auto x = n0.dot(viewDirection_);
// const auto y = std::sqrt(1 - (x * x));
// const auto angle = std::atan2(y,x);
// std::cerr << "angle: " << angle << std::endl;
// if(angle != 0.)
// transform.rotate(angle, n0.cross(n1));
// transform.rotate(angle, n0.cross(n1));
*/
/// 3. scale by half updates length
auto
transformation
=
ACG
::
GLMatrixf
(
ACG
::
Matrix4x4f
());
transformation
.
identity
();
// init
auto
scale
=
ACG
::
Vec3f
{(
worldSpaceUpdate
+
distClickOrigin
)
/
distClickOrigin
};
scale
[
2
]
=
1
;
/// we dont do anything in z-dir
transformation
.
scale
(
scale
);
// const auto xscale = scale[0] * plane.xDirection.length();
// const auto yscale = scale[1] * plane.yDirection.length();
// plane.setSize(xscale, yscale);
// std::cerr << "xdir: " << plane.xDirection
// << " ydir: " << plane.yDirection << std::endl;
// std::cerr << "initial click pos: " << distClickOrigin <<
// std::endl; std::cerr << "current click pos: " << currWorldPos_
// << std::endl; std::cerr << "scale: " << scale << std::endl;
std
::
cerr
<<
"update: "
<<
worldSpaceUpdate
<<
std
::
endl
;
transformation
.
translate
(
ACG
::
Vec3f
{
plane
.
position
});
plane
.
transform
(
transformation
);
plane
.
position
+=
initPos
;
plane
.
position
+=
worldSpaceUpdate
;
std
::
cerr
<<
"[world] start pos: "
<<
result_
<<
std
::
endl
;
std
::
cerr
<<
"[world] curr pos: "
<<
currWorldPos_
<<
std
::
endl
;
std
::
cerr
<<
"scale: "
<<
scale
<<
std
::
endl
;
std
::
cerr
<<
"new plane pos: "
<<
plane
.
position
<<
std
::
endl
;
std
::
cerr
<<
"delta: "
<<
worldSpaceUpdate
<<
"
\n\n\n\n\n
"
<<
std
::
endl
;
curPlane_
->
plane
()
=
plane
;
/// overwrite plane
/// 0 corner
...
...
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