Skip to content

Commit e449ca8

Browse files
Improved documentation: Added image captions, formatted keystroke letters using :kbd:.
1 parent bed2701 commit e449ca8

11 files changed

Lines changed: 245 additions & 49 deletions

File tree

docs/source/_static/css/custom.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,36 @@ div.bottomnav p {
1313
text-align: left;
1414
font-size: 0.8em;
1515
}
16+
17+
table.image-grid,
18+
table.image-grid tr,
19+
table.image-grid col {
20+
border: hidden;
21+
}
22+
23+
table.caption,
24+
table.caption tr,
25+
table.caption col {
26+
border: hidden;
27+
}
28+
29+
table.caption {
30+
margin-left: 5%;
31+
margin-right: 5%;
32+
width: 90%;
33+
}
34+
35+
table.caption td {
36+
text-align: center;
37+
font-size: smaller;
38+
font-style: italic;
39+
}
40+
41+
.kbd.docutils.literal {
42+
border: solid #CCCCCC 1px;
43+
font-family: Arial, Helvetica, sans-serif;
44+
font-size: 90%;
45+
font-weight: normal;
46+
padding: 1px 5px 3px;
47+
white-space: nowrap;
48+
}

docs/source/quickstart.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ Install pptk.
66
>>> pip install pptk
77

88
.. note::
9-
pptk requires 64-bit Python and is currently only :code:`pip install`-able on Python 3.6 and Python 2.7.
10-
9+
pptk requires 64-bit Python and is only :code:`pip install`-able on versions of Python
10+
that have a corresponding pptk wheel file on PyPI.
11+
1112
In Python, generate 100 random 3-d points, and
1213

1314
.. code-block:: python

docs/source/tutorial.rst

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,53 @@ Tutorials
66
Visualizing 2-d and 3-d point data
77
----------------------------------
88

9-
:py:func:`pptk.viewer` is able to visualize any point data that can be represented as a 3-column numpy array.
9+
.. |semantic3d_small_i| image:: tutorials/viewer/images/semantic3d_small_i.jpg
10+
:height: 200
11+
:width: 275
12+
:scale: 80%
13+
:align: middle
14+
15+
.. |geolife_utm| image:: tutorials/viewer/images/geolife_utm.png
16+
:height: 200
17+
:width: 289
18+
:scale: 80%
19+
:align: middle
20+
21+
.. |footprints_dc| image:: tutorials/viewer/images/footprints_dc.png
22+
:height: 200
23+
:width: 275
24+
:scale: 80%
25+
:align: middle
26+
27+
.. |mobius| image:: tutorials/viewer/images/mobius.png
28+
:height: 200
29+
:width: 200
30+
:scale: 80%
31+
:align: middle
32+
33+
.. rst-class:: image-grid
34+
.. table::
35+
:widths: 280 294 280 205
36+
:align: center
37+
38+
==================== ============= =============== ========
39+
|semantic3d_small_i| |geolife_utm| |footprints_dc| |mobius|
40+
==================== ============= =============== ========
41+
42+
.. rst-class:: caption
43+
44+
+---------------------------------------------------------------------------------------------------------------+
45+
| Point datasets visualized using :py:meth:`pptk.viewer`. |
46+
| The :file:`bildstein1` Lidar point cloud from `Semantic3D <http://semantic3d.net>`__ (left). |
47+
| Beijing GPS trajectories from |
48+
| `Geolife <https://www.microsoft.com/en-us/research/publication/geolife-gps-trajectory-dataset-user-guide/>`__ |
49+
| (middle left). |
50+
| :file:`DistrictofColumbia.geojson` 2-d polygons from |
51+
| `US building footprints <https://github.com/Microsoft/USBuildingFootprints>`__ (middle right). |
52+
| A Mobius strip (right). |
53+
+---------------------------------------------------------------------------------------------------------------+
54+
55+
:py:func:`pptk.viewer` allows interactive visualization of any point data that can be represented as a 3-column numpy array.
1056
This includes Lidar point clouds, GPS trajectories, points on a 3-d parametric surface, or even point samplings of 2-d polygons.
1157
The viewer is not tied to a specific file format.
1258
As shown in these tutorials,

docs/source/tutorials/viewer/building_footprints.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Visualize.
8383
:width: 375px
8484
:align: middle
8585

86+
.. rst-class:: image-grid
8687
.. table::
8788
:widths: 390 390
8889
:align: center
@@ -91,6 +92,14 @@ Visualize.
9192
|footprints_dc| |footprints_dc_zoom|
9293
=============== ====================
9394

95+
.. rst-class:: caption
96+
97+
+----------------------------------------------------------------------------------------+
98+
| :file:`DistrictofColumbia.geojson` polygons from Microsoft's |
99+
| `US building footprints dataset <https://github.com/Microsoft/USBuildingFootprints>`__ |
100+
| converted into a point set and viewed using :py:meth:`pptk.viewer()` |
101+
+----------------------------------------------------------------------------------------+
102+
94103
The above procedure can be repeated for other .geojson files in the dataset.
95104
But note that converting polygons into a point set can become memory intensive.
96105
By the above procedure, the District of Columbia's 58,329 polygons yields 18,465,292 points.

docs/source/tutorials/viewer/geolife.rst

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Geolife dataset
44
===============
55

66
Download the dataset from the
7-
`project website <https://www.microsoft.com/en-us/research/publication/geolife-gps-trajectory-dataset-user-guide/>`_
7+
`Geolife <https://www.microsoft.com/en-us/research/publication/geolife-gps-trajectory-dataset-user-guide/>`_ project website
88

99
Extract the zip file and observe the following directory structure.
1010

@@ -224,15 +224,25 @@ Visualize and color each point based on its altitude.
224224
.. image:: images/geolife_latlon_default.png
225225
:align: center
226226
:width: 900px
227-
227+
228+
.. rst-class:: caption
229+
230+
+-----------------------------------------------------------------------------+
231+
| Full view of `Geolife`_ dataset in lat-lon with points colored by altitude. |
232+
+-----------------------------------------------------------------------------+
233+
228234
Since we are interested only in the spatial arrangements of points on the x-y plane,
229-
Press 5 to toggle to an orthographic view, and press 7 to go to a top-down view.
230-
Pan the viewpoint by pressing the left mouse button while holding the shift key.
231-
Double click on a point to recenter the view on the point.
235+
Press :kbd:`5` to toggle to an orthographic view, and press :kbd:`7` to go to a top-down view.
236+
Pan the viewpoint by pressing the :kbd:`LMB` while holding the :kbd:`Shift` key.
237+
Double click with the :kbd:`LMB` on a point to recenter the view on that point.
232238
And use the mouse wheel to zoom in/out.
233239
To inspect the attribute of a point, which here is altitude,
234-
left click the point while holding the Ctrl key.
240+
left click the point while holding the :kbd:`Ctrl` key.
235241
Deselect by right clicking anywhere.
242+
See the :doc:`viewer page <../../viewer>` for the full instructions on using the viewer.
243+
244+
.. note::
245+
On Mac, use :kbd:`` instead of :kbd:`Ctrl`
236246

237247
The mapping from per-point attribute value to per-point color is determined automatically based on the range of attribute values.
238248
But the presence of bad attribute values (e.g. unreasonably large or small altitude values) may result in a poor color mapping,
@@ -255,17 +265,43 @@ Improve the color map by manually setting the mapping domain using :py:meth:`vie
255265
:align: center
256266
:width: 900px
257267

268+
.. rst-class:: caption
269+
270+
+----------------------------------------------------------------------------------------------------+
271+
| Full view of `Geolife`_ dataset in lat-lon with an improved color map |
272+
| (i.e. the greater range of colors allows one to better see the changes in altitude across points). |
273+
+----------------------------------------------------------------------------------------------------+
274+
258275
Observe that point coverage is world wide,
259276
as there are points not just in Beijing but also in faraway cities such as Rome and Seattle.
260277
Observe also the high altitude points (i.e. airplane trajectories) that connect some of these cities.
261278
A future release of the pptk viewer may include support for overlaying points on map tiles
262279
(e.g. `HERE Map Tile <https://developer.here.com/documentation/map-tile/topics/introduction.html>`__)
263280
for better supporting such visualizations.
264281

282+
.. note::
283+
You may notice that you cannot zoom in as close as you would like.
284+
This is because there is currently a hardcoded limit on zooming in,
285+
which a future release of pptk will fix.
286+
This is not an issue when viewing data such as Lidar point clouds that are typically specified in meters,
287+
but becomes a limitation when viewing lat-lon points
288+
(i.e. two points 1m apart translates to a very small difference in lat/lon).
289+
Meanwhile, to zoom in further, consider scaling up the lat-lon values,
290+
or converting the points to UTM coordinates, as described in the next section.
291+
265292
Visualize using UTM coordinates
266293
-------------------------------
267294

268-
Remove points that are outside the UTM zone 50 (Beijing's UTM zone).
295+
Directly mapping lon-lat to x-y (i.e. x <- lon, y <- lat),
296+
as in the previous section,
297+
causes points to appear stretched apart near the north and south poles.
298+
Alternatively, the `UTM projection <https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system>`__
299+
is able to convert lat-lon coordinates into units of meters
300+
while only introducing a relatively small amount of stretching/shrinking between points in the same UTM zone.
301+
In this section, we show how to apply the UTM projection on GPS points in UTM zone 50 (Beijing's UTM zone),
302+
which we then visualize using :py:meth:`pptk.viewer`.
303+
304+
First remove points that are outside the UTM zone 50.
269305
This is to remove any invalid points that may later convert to unreasonably large UTM coordinates
270306
(the dataset contains a point with invalid latitude of 400.17)
271307

@@ -296,7 +332,7 @@ Optionally, one may use :py:meth:`viewer.color_map <pptk.viewer.color_map>` to m
296332
>>> v = pptk.viewer(p[mask_labelled])
297333
>>> v.attributes(df_50[mask_labelled]['label'])
298334

299-
Again Ctrl + left click on a point to examine its mode of transportation attribute.
335+
Again :kbd:`Ctrl` + left click on a point to examine its mode of transportation attribute.
300336

301337
.. |geolife_utm| image:: images/geolife_utm.png
302338
:width: 390px
@@ -310,10 +346,18 @@ Again Ctrl + left click on a point to examine its mode of transportation attribu
310346
:width: 110px
311347
:align: middle
312348

349+
.. rst-class:: image-grid
313350
.. table::
314351
:widths: 400 400 120
315352
:align: center
316353

317354
============= ==================== ================
318355
|geolife_utm| |geolife_utm_zoomed| |geolife_legend|
319356
============= ==================== ================
357+
358+
.. rst-class:: caption
359+
360+
+------------------------------------------------------------------------------------+
361+
| `Geolife`_ GPS points in UTM coordinates visualized using :py:meth:`pptk.viewer`. |
362+
| Points are from around the Beijing area and are colored by mode of transportation. |
363+
+------------------------------------------------------------------------------------+

docs/source/tutorials/viewer/mobius.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,19 @@ Visualize.
5353
:width: 256px
5454
:align: middle
5555

56-
56+
.. rst-class:: image-grid
5757
.. table::
5858
:align: center
5959
:widths: 270 270 270 270
6060

6161
======== ========== ========== ==========
6262
|mobius| |mobius_x| |mobius_y| |mobius_z|
6363
======== ========== ========== ==========
64+
65+
.. rst-class:: caption
66+
67+
+---------------------------------------------------------------------------+
68+
| Visualization of a mobius strip using :py:meth:`pptk.viewer`. |
69+
| Points are colored by normal directions. |
70+
| And the latter three images are views along the -x, +y and -z directions. |
71+
+---------------------------------------------------------------------------+

docs/source/tutorials/viewer/saddle.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ One can also calculate and visualize additional per-point attributes.
5858
>>> # set per-point attributes
5959
>>> v.attributes(P[:, 2], mag, 0.5 * (N + 1))
6060
61-
Toggle between attributes using the [ and ] keys.
61+
Toggle between attributes using the :kbd:`[` and :kbd:`]` keys.
6262

6363
.. |saddle_z| image:: images/saddle_z.png
6464
:width: 256px
@@ -72,10 +72,18 @@ Toggle between attributes using the [ and ] keys.
7272
:width: 256px
7373
:align: middle
7474

75+
.. rst-class:: image-grid
7576
.. table::
7677
:widths: 275 275 275
7778
:align: center
7879

7980
========== ============ ==========
8081
|saddle_z| |saddle_mag| |saddle_n|
8182
========== ============ ==========
83+
84+
.. rst-class:: caption
85+
86+
+------------------------------------------------------------------------------------------------------+
87+
| Visualization of :math:`f(x,y)=x^2-y^2`. |
88+
| Points are colored by :math:`f` (left), :math:`|\nabla f|` (middle), and normal directions (right) |
89+
+------------------------------------------------------------------------------------------------------+

0 commit comments

Comments
 (0)