Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
iMSTK
iMSTK
Commits
114d5624
Commit
114d5624
authored
Jun 22, 2019
by
Sreekanth Arikatla
Browse files
BUG: Use vtkPolyDatainstead of vtkPolyLine for VTKdbgLinesRenderDelegate
parent
4ece7524
Changes
2
Hide whitespace changes
Inline
Side-by-side
Examples/DebugRendering/DebugRenderingExample.cpp
View file @
114d5624
...
...
@@ -64,11 +64,17 @@ int main()
scene
->
addDebugGeometry
(
debugTriangleGeo
);
// Create debug Lines
auto
debugLinesGeo
=
std
::
make_shared
<
DebugRenderLines
>
(
"debugLines"
,
2
);
auto
debugLinesGeo
=
std
::
make_shared
<
DebugRenderLines
>
(
"debugLines"
);
StdVectorOfVec3d
linesVerts
;
linesVerts
.
push_back
(
Vec3d
(
0
,
0
,
0
));
linesVerts
.
push_back
(
Vec3d
(
100
,
100
,
100
));
linesVerts
.
push_back
(
Vec3d
(
15
,
0
,
0
));
linesVerts
.
push_back
(
Vec3d
(
100
,
0
,
0
));
linesVerts
.
push_back
(
Vec3d
(
0
,
15
,
0
));
linesVerts
.
push_back
(
Vec3d
(
0
,
100
,
0
));
linesVerts
.
push_back
(
Vec3d
(
0
,
0
,
15
));
linesVerts
.
push_back
(
Vec3d
(
0
,
0
,
100
));
debugLinesGeo
->
setVertexData
(
linesVerts
);
...
...
Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKdebugLinesRenderDelegate.cpp
View file @
114d5624
...
...
@@ -30,10 +30,10 @@ limitations under the License.
#include
<vtkCellArray.h>
#include
<vtkFloatArray.h>
#include
<vtkPointData.h>
#include
<vtkPolyLine.h>
#include
<vtkProperty.h>
#include
<vtkOpenGLPolyDataMapper.h>
#include
<vtkTrivialProducer.h>
#include
<vtkLine.h>
namespace
imstk
{
...
...
@@ -47,29 +47,30 @@ VTKdbgLinesRenderDelegate::VTKdbgLinesRenderDelegate(std::shared_ptr<DebugRender
double
*
vertData
=
reinterpret_cast
<
double
*>
(
triVertData
.
data
());
m_mappedVertexArray
->
SetArray
(
vertData
,
triVertData
.
size
()
*
3
,
1
);
// Create lines polydata
auto
linesPolyData
=
vtkSmartPointer
<
vtkPolyData
>::
New
();
// Create points
auto
points
=
vtkSmartPointer
<
vtkPoints
>::
New
();
points
->
SetNumberOfPoints
(
triVertData
.
size
());
points
->
SetData
(
m_mappedVertexArray
);
linesPolyData
->
SetPoints
(
points
);
// Create cells
auto
polyLine
=
vtkSmartPointer
<
vtkPolyLine
>::
New
();
polyLine
->
GetPointIds
()
->
SetNumberOfIds
(
triVertData
.
size
());
for
(
unsigned
int
i
=
0
;
i
<
triVertData
.
size
();
++
i
)
auto
lines
=
vtkSmartPointer
<
vtkCellArray
>::
New
();
for
(
unsigned
int
i
=
0
;
i
<
triVertData
.
size
()
-
1
;
i
+=
2
)
{
polyLine
->
GetPointIds
()
->
SetId
(
i
,
i
);
}
auto
cells
=
vtkSmartPointer
<
vtkCellArray
>::
New
();
cells
->
InsertNextCell
(
polyLine
);
auto
l
=
vtkSmartPointer
<
vtkLine
>::
New
();
l
->
GetPointIds
()
->
SetId
(
0
,
i
);
l
->
GetPointIds
()
->
SetId
(
1
,
i
+
1
);
// Create PolyData
auto
polydata
=
vtkSmartPointer
<
vtkPolyData
>::
New
();
polydata
->
SetPoints
(
points
);
polydata
->
SetLines
(
cells
);
lines
->
InsertNextCell
(
l
);
}
linesPolyData
->
SetLines
(
lines
);
// Create connection source
auto
source
=
vtkSmartPointer
<
vtkTrivialProducer
>::
New
();
source
->
SetOutput
(
p
oly
d
ata
);
source
->
SetOutput
(
linesP
oly
D
ata
);
m_Lines
->
setDataModifiedFlag
(
false
);
// Update Transform, Render Properties
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment