# 2D pointcloud plot using vtkActor

**URL:** https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502
**Category:** Support
**Created:** [March 15, 2019, 10:25pm UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502 "2019-03-15T22:25:25Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![thully](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@thully](https://discourse.vtk.org/u/thully)
#### Post date: [March 15, 2019, 10:25pm UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502/1 "2019-03-15T22:25:25Z")

</div>

In my application, I am displaying a 3D pointcloud view alongside a 2D overhead view of the same thing. For the 3D pointcloud, I am using a vtkActor and vtkPolyDataMapper with vtkTableToPolyData as input (I opted not to use vtkChartXYZ as I don’t want axes or a bounding box).

What would be the best way to display a 2D overhead view of the same pointcloud (ignoring the Z values)? I previously tried using vtkActor2D, but it seems to expect pixel coordinates from vtkPolyDataMapper2D. The best I’ve managed so far is to do a 3D view with vtkActor and disable all interaction, though that seems kind of hackish…

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [March 15, 2019, 11:29pm UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502/2 "2019-03-15T23:29:11Z")

</div>

Your current approach is good. There is nothing hackish about it. It is a 3D data set that you want to show from a specific viewing angle. No need to disable all interactions, just disable rotation.

You can project all the points using transform polydata filter by setting a projection transform (e.g., set third column to zeros to project all points to z=0 plane). However, this is completely unnecessary and may make display worse, since you lose z ordering.

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [March 15, 2019, 11:39pm UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502/3 "2019-03-15T23:39:24Z")

</div>

1. DeepCopy the vrkPoints from the 3D polydata.
2. Loop through the new points and set the z component to a fixed value e.g. 0.0
3. Create a new polydata and display it.

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [March 17, 2019, 5:08am UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502/4 "2019-03-17T05:08:50Z")

</div>

> [@lassoan](#):
>
> No need to disable all interactions, just disable rotation

@lassoan: Is there a way to simply disable the rotation? I’ve tried using the `vtkInteractorStyleImage` but it doesn’t let me pan around (I’m trying to zoom into the top right corner):

![com-video-to-gif](https://discourse.vtk.org/uploads/default/original/1X/76fbe8e241dd2ffae95eb35fe0cc1a5eff053506.gif)

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [March 17, 2019, 8:19pm UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502/5 "2019-03-17T20:19:23Z")

</div>

You can override actions by adding observers to GUI events. You can also implement your own interactor style class, derived from any existing style.

---

<div class="post-metadata">

### Author: ![thully](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@thully](https://discourse.vtk.org/u/thully)
#### Post date: [March 18, 2019, 3:03pm UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502/6 "2019-03-18T15:03:51Z")

</div>

That does seem unnecessary, though I figured there may be some kind of 2D plot mechanism using simple actors that would use less resources than a 3D plot. I had previously tried vtkChartXY for this and the plot looked fine, though I don’t really want/need the axes and other special features of that (and would prefersomething with an API similar to using a vtkActor for 3D plotting, just in 2D).

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [March 18, 2019, 3:46pm UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502/7 "2019-03-18T15:46:55Z")

</div>

> [@thully](#):
>
> That does seem unnecessary, though I figured there may be some kind of 2D plot mechanism using simple actors that would use less resources than a 3D plot

2D plots still use 3D rendering under the hood because you still need 3D for example to manage z order of overlapping objects, be able to show widgets and handles with smooth 3D shaded surface, etc.

---

<div class="post-metadata">

### Author: ![thully](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@thully](https://discourse.vtk.org/u/thully)
#### Post date: [March 20, 2019, 4:12pm UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502/8 "2019-03-20T16:12:02Z")

</div>

It still seems a bit wasteful to basically create a pair of renderers and actors that do the exact same thing, with the only difference being that one has a smaller window size and has interaction disabled. Is there something I’m missing?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [March 21, 2019, 1:09am UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502/9 "2019-03-21T01:09:13Z")

</div>

I’m not sure what pair of renderers you are referring to. Normally you create a renderer for each view. Usually you cannot share mappers and actors between views, but they may share processing pipeline and data objects.

---

<div class="post-metadata">

### Author: ![thully](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@thully](https://discourse.vtk.org/u/thully)
#### Post date: [March 21, 2019, 3:09pm UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502/10 "2019-03-21T15:09:35Z")

</div>

I’m talking about the renderer, actors, and mappers I’m creating for each view.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [March 21, 2019, 3:24pm UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502/11 "2019-03-21T15:24:15Z")

</div>

You need to duplicate renderer, actor, mapper for each view, regardless of 2D or 3D.

---

<div class="post-metadata">

### Author: ![thully](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@thully](https://discourse.vtk.org/u/thully)
#### Post date: [March 23, 2019, 12:23am UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502/12 "2019-03-23T00:23:36Z")

</div>

Given that, what would be the best way to implement multiple views of the same data that are updated in sync with the least duplication of resources?

---

<div class="post-metadata">

### Author: ![ran](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/r/a9adbd/32.png) [@ran](https://discourse.vtk.org/u/ran)
#### Post date: [June 15, 2020, 1:00pm UTC](https://discourse.vtk.org/t/2d-pointcloud-plot-using-vtkactor/502/13 "2020-06-15T13:00:42Z")

</div>

Hi @thully, I am actually trying to do exactly what you did about disabling Pan Zoom and Tilt of a vtkActor.  
can you please share how you did that?  
Thanks!
