Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
dac27c99
Commit
dac27c99
authored
Jan 11, 2014
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored arrow
parent
1449823b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
13 deletions
+15
-13
shapes.cpp
modules/viz/src/shapes.cpp
+4
-13
tests_simple.cpp
modules/viz/test/tests_simple.cpp
+11
-0
No files found.
modules/viz/src/shapes.cpp
View file @
dac27c99
...
...
@@ -192,22 +192,13 @@ cv::viz::WArrow::WArrow(const Point3d& pt1, const Point3d& pt2, double thickness
Vec3d
zvec
=
normalized
(
xvec
.
cross
(
arbitrary
));
Vec3d
yvec
=
zvec
.
cross
(
xvec
);
Affine3d
pose
=
makeTransformToGlobal
(
xvec
,
yvec
,
zvec
);
Matx33d
R
=
makeTransformToGlobal
(
xvec
,
yvec
,
zvec
).
rotation
();
Affine3d
transform_with_scale
(
R
*
length
,
startPoint
);
// Apply the transforms
vtkSmartPointer
<
vtkTransform
>
transform
=
vtkSmartPointer
<
vtkTransform
>::
New
();
transform
->
Translate
(
startPoint
.
val
);
transform
->
Concatenate
(
vtkmatrix
(
pose
.
matrix
));
transform
->
Scale
(
length
,
length
,
length
);
// Transform the polydata
vtkSmartPointer
<
vtkTransformPolyDataFilter
>
transformPD
=
vtkSmartPointer
<
vtkTransformPolyDataFilter
>::
New
();
transformPD
->
SetTransform
(
transform
);
transformPD
->
SetInputConnection
(
arrow_source
->
GetOutputPort
());
transformPD
->
Update
();
vtkSmartPointer
<
vtkPolyData
>
polydata
=
VtkUtils
::
TransformPolydata
(
arrow_source
->
GetOutputPort
(),
transform_with_scale
);
vtkSmartPointer
<
vtkPolyDataMapper
>
mapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>::
New
();
VtkUtils
::
SetInputData
(
mapper
,
transformPD
->
GetOutput
()
);
VtkUtils
::
SetInputData
(
mapper
,
polydata
);
vtkSmartPointer
<
vtkActor
>
actor
=
vtkSmartPointer
<
vtkActor
>::
New
();
actor
->
SetMapper
(
mapper
);
...
...
modules/viz/test/tests_simple.cpp
View file @
dac27c99
...
...
@@ -277,6 +277,8 @@ TEST(Viz, DISABLED_show_image_3d)
viz
.
showWidget
(
"arr1"
,
WArrow
(
Vec3d
(
-
0.5
,
-
0.5
,
0.0
),
Vec3d
(
0.2
,
0.2
,
0.0
),
0.009
,
Color
::
raspberry
()));
viz
.
showWidget
(
"img1"
,
WImage3D
(
gray
,
Size2d
(
1.0
,
1.0
),
Vec3d
(
-
0.5
,
-
0.5
,
0.0
),
Vec3d
(
1.0
,
1.0
,
0.0
),
Vec3d
(
0.0
,
1.0
,
0.0
)));
viz
.
showWidget
(
"arr3"
,
WArrow
(
Vec3d
::
all
(
-
0.5
),
Vec3d
::
all
(
0.5
),
0.009
,
Color
::
raspberry
()));
int
i
=
0
;
while
(
!
viz
.
wasStopped
())
{
...
...
@@ -286,6 +288,15 @@ TEST(Viz, DISABLED_show_image_3d)
//viz.spin();
}
TEST
(
Viz
,
show_simple_widgets
)
{
Viz3d
viz
(
"show_simple_widgets"
);
viz
.
showWidget
(
"coos"
,
WCoordinateSystem
());
viz
.
showWidget
(
"cube"
,
WCube
());
viz
.
showWidget
(
"arr3"
,
WArrow
(
Vec3d
::
all
(
-
0.5
),
Vec3d
::
all
(
0.5
),
0.009
,
Color
::
raspberry
()));
viz
.
spin
();
}
TEST
(
Viz
,
DISABLED_spin_twice_____________________________TODO_UI_BUG
)
{
Mesh
mesh
=
Mesh
::
load
(
get_dragon_ply_file_path
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment