# Visualize the Leaning Tower of Pisa (or San Francisco's Millennium Tower)

**URL:** https://discourse.vtk.org/t/visualize-the-leaning-tower-of-pisa-or-san-franciscos-millennium-tower/9665
**Category:** Support
**Created:** [October 24, 2022, 9:29pm UTC](https://discourse.vtk.org/t/visualize-the-leaning-tower-of-pisa-or-san-franciscos-millennium-tower/9665 "2022-10-24T21:29:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![SpareSimian](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@SpareSimian](https://discourse.vtk.org/u/SpareSimian)
#### Post date: [October 24, 2022, 9:29pm UTC](https://discourse.vtk.org/t/visualize-the-leaning-tower-of-pisa-or-san-franciscos-millennium-tower/9665/1 "2022-10-24T21:29:14Z")

</div>

I’m looking for inspiration on how to present my data. I can do the math part. What I’m looking for is how to present it.

Imagine a multistory building of equally-spaced floors, either cylindrical (like a grain silo) or square (like a skyscraper) in cross-section. Each floor has a sensor on the corners (for square) or compass points (for cylinder) that measures the distance to the ground and the “cross-wise” distance (eg. horizontal rotation) from where that corner should be. I want to visualize how much each floor is tipping or twisting and on what axis based on the coordinates of its four sensors.

For a 10+1 floor building, I’d have 40 sensors with 2 readings each, vertical and sideways.

---

<div class="post-metadata">

### Author: ![DStranz](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@DStranz](https://discourse.vtk.org/u/DStranz)
#### Post date: [October 24, 2022, 10:09pm UTC](https://discourse.vtk.org/t/visualize-the-leaning-tower-of-pisa-or-san-franciscos-millennium-tower/9665/2 "2022-10-24T22:09:47Z")

</div>

I can think of a few ways you might visualize the deformation:

1 - Represent the building in wireframe. At each vertex where you have a sensor, display the sensor’s Cartesian orientation with a small set of x-y-z axes. An undeformed sensor will align with the rectilinear axes of the wireframe, a deformed sensor will have an x-y-z twist.

2 - Create two wireframe representations of the building, one undeformed, the other with vertexes in their deformed positions and overlay them.

3 - As in (1), but omit the building wireframe (just show the sets of axes).

4 - Animate (2) by alternately displaying the deformed / undeformed wireframes.

It would be nice to incorporate color, but I can’t think of a way to use a single color to represent a multidimensional change. There are probably abstract ways to represent your data, but it is probably more important to set the context by overlaying the data on a model of the building.

---

<div class="post-metadata">

### Author: ![SpareSimian](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@SpareSimian](https://discourse.vtk.org/u/SpareSimian)
#### Post date: [October 24, 2022, 10:26pm UTC](https://discourse.vtk.org/t/visualize-the-leaning-tower-of-pisa-or-san-franciscos-millennium-tower/9665/3 "2022-10-24T22:26:21Z")

</div>

Thanks, those sound great. Can you point me in the direction of suitable VTK classes to represent that?

I’ve used VTK a few years ago to display a heat map to represent deformities in a surface that’s ideally flat, so I’m familiar with VTK’s architecture and how to build it and incorporate it into my wxWidgets-based GUI. But VTK is so feature-rich that it’s hard to find the right trees for an application in the forest.

For color, I could probably display each sensor in a spectrum based on the degree of total rotation, to indicate a degree of “badness”.

Since the distortion is likely to be small, I might add a scaling slider to exaggerate the error for greater visibility.

---

<div class="post-metadata">

### Author: ![DStranz](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@DStranz](https://discourse.vtk.org/u/DStranz)
#### Post date: [October 24, 2022, 10:38pm UTC](https://discourse.vtk.org/t/visualize-the-leaning-tower-of-pisa-or-san-franciscos-millennium-tower/9665/4 "2022-10-24T22:38:43Z")

</div>

I am a real newbie with VTK, and as you say, it is overwhelmingly feature-rich.

There is the [wireframe](https://kitware.github.io/vtk-examples/site/Cxx/Visualization/Wireframe/) example for starters. That can represent the undeformed wireframe, and by a different choice of data element (other than image data) like possibly polydata, the deformed wireframe as well.

For axes, there is [vtkAxesActor](https://kitware.github.io/vtk-examples/site/Cxx/GeometricObjects/Axes/) using which you would create one actor per vertex, translating, rotating, and scaling according to location and deformation.

---

<div class="post-metadata">

### Author: ![SpareSimian](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@SpareSimian](https://discourse.vtk.org/u/SpareSimian)
#### Post date: [October 24, 2022, 10:45pm UTC](https://discourse.vtk.org/t/visualize-the-leaning-tower-of-pisa-or-san-franciscos-millennium-tower/9665/5 "2022-10-24T22:45:18Z")

</div>

Perfect! That gives me plenty of hints to put this together. From other reading, it sounds like I can attach those to an “assembly” actor for easy interaction.
