Skip to content

Commit 295d6f2

Browse files
committed
rendering techniques notebook
1 parent 82d53e7 commit 295d6f2

File tree

1 file changed

+42
-75
lines changed

1 file changed

+42
-75
lines changed

notebooks/02-methods/02-rendering-techniques.ipynb

Lines changed: 42 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@
77
"# Rendering Techniques\n",
88
"---\n",
99
"\n",
10-
"Since Unstructured Grids are significantly more complex than Structured (a.k.a. Regular) Grids, the choice of rendering technique plays an important role in obtaining high-resolution, accurate, and scalable visualizations. \n",
10+
"Since Unstructured Grids require significantly more overhead to represent compared to Structured (a.k.a. Regular) grids, the choice of rendering technique plays an important in obtaining high-resolution, accurate, and scalable visualuations. \n",
11+
"\n",
1112
"\n",
1213
"This notebook introduces relevant concepts and techniques that will be mentioned and used throughout this Cookbook."
1314
]
1415
},
1516
{
1617
"cell_type": "markdown",
18+
"metadata": {
19+
"collapsed": false
20+
},
1721
"source": [
1822
"## Vector (Shape) Geometries\n",
1923
"\n",
@@ -26,70 +30,40 @@
2630
"Rendering each face as a polygon will lead to visuals that look like this, which are extremely high-quality and represent the exact geometry of each face.\n",
2731
"\n",
2832
"\n",
29-
"<img src=\"../images/rendering/polygons.png\" alt=\"Continents\" width=\"800\"/>"
30-
],
31-
"metadata": {
32-
"collapsed": false
33-
}
33+
"<img src=\"../images/rendering/polygons.png\" alt=\"Continents\" width=\"400\"/>"
34+
]
3435
},
3536
{
3637
"cell_type": "markdown",
38+
"metadata": {
39+
"collapsed": false
40+
},
3741
"source": [
3842
"Another example of Vector Geometries is encountered when adding features to a visualization, such as Contents or Borders. The geometries of these features are drawn onto our screen.\n",
3943
"\n",
4044
"\n",
41-
"<img src=\"../images/rendering/contients.jpg\" alt=\"Continents\" width=\"800\"/>"
42-
],
43-
"metadata": {
44-
"collapsed": false
45-
}
45+
"<img src=\"../images/rendering/contients.jpg\" alt=\"Continents\" width=\"600\"/>"
46+
]
4647
},
4748
{
4849
"cell_type": "markdown",
49-
"source": [
50-
"The following examples show examples of how different elements of an unstructured grid can be represented geometrically."
51-
],
5250
"metadata": {
5351
"collapsed": false
54-
}
52+
},
53+
"source": [
54+
"The following code snippets show how we can represent each of the main unstructured grid geometries.\n"
55+
]
5556
},
5657
{
5758
"cell_type": "code",
5859
"execution_count": null,
59-
"outputs": [],
60-
"source": [
61-
"import shapely as sp"
62-
],
63-
"metadata": {
64-
"collapsed": false
65-
}
66-
},
67-
{
68-
"cell_type": "markdown",
69-
"source": [
70-
"A point is represented using a pair of Longitude and Latitude Values"
71-
],
7260
"metadata": {
7361
"collapsed": false
74-
}
75-
},
76-
{
77-
"cell_type": "markdown",
78-
"source": [
79-
"sp.Point([0.0, 0.0])"
80-
],
81-
"metadata": {
82-
"collapsed": false
83-
}
84-
},
85-
{
86-
"cell_type": "markdown",
62+
},
63+
"outputs": [],
8764
"source": [
88-
"An Edge is represented using a pair of points. "
89-
],
90-
"metadata": {
91-
"collapsed": false
92-
}
65+
"import shapely as sp"
66+
]
9367
},
9468
{
9569
"cell_type": "code",
@@ -102,59 +76,52 @@
10276
"collapsed": false
10377
}
10478
},
105-
{
106-
"cell_type": "markdown",
107-
"source": [
108-
"A Polygon is represented in terms of it's exterior coordinates, each of which are points."
109-
],
110-
"metadata": {
111-
"collapsed": false
112-
}
113-
},
11479
{
11580
"cell_type": "code",
11681
"execution_count": null,
82+
"metadata": {
83+
"collapsed": false
84+
},
11785
"outputs": [],
11886
"source": [
11987
"sp.Polygon([[100, 40], [100, 50], [90, 50], [90, 40], [100, 40]])"
120-
],
121-
"metadata": {
122-
"collapsed": false
123-
}
88+
]
12489
},
12590
{
12691
"cell_type": "markdown",
92+
"metadata": {
93+
"collapsed": false
94+
},
12795
"source": [
12896
"## Rasterization\n",
12997
"\n",
130-
"Rendering each geometry directly is an expensive operation for even moderately large datasets. \n",
98+
"While there is definitely merit in rendering each geometric shape directly, this operation is extremely computationally expensive for large datasets.\n",
13199
"\n",
132-
"Rasterization todo..\n",
100+
"Rasterization is a technique in computer graphics that converts vector (a.k.a geometric shapes) graphics into a raster image, which is simply a series of pixels.\n",
133101
"\n",
102+
"The figure below shows how rasterization approximates the geometry of geometries.\n",
134103
"\n",
135-
"<img src=\"../images/rendering/raster_example.png\" alt=\"Rasterization Example\" width=\"800\"/>"
136-
],
137-
"metadata": {
138-
"collapsed": false
139-
}
104+
"\n",
105+
"<img src=\"../images/rendering/raster_example.png\" alt=\"Rasterization Example\" width=\"1000\"/>"
106+
]
140107
},
141108
{
142109
"cell_type": "markdown",
143-
"source": [
144-
"Below is an example of rastered polygons plotted against the expected geometry.\n",
145-
"\n",
146-
"<img src=\"../images/rendering/raster-vs-vector.png\" alt=\"raster and vector\" width=\"800\"/>"
147-
],
148110
"metadata": {
149111
"collapsed": false
150-
}
112+
},
113+
"source": [
114+
"Below is an example of rasterized polygons plotted against the expected geometry.\n",
115+
"\n",
116+
"<img src=\"../images/rendering/raster-vs-vector.png\" alt=\"raster and vector\" width=\"400\"/>"
117+
]
151118
},
152119
{
153120
"cell_type": "markdown",
154-
"source": [],
155121
"metadata": {
156122
"collapsed": false
157-
}
123+
},
124+
"source": []
158125
}
159126
],
160127
"metadata": {
@@ -173,7 +140,7 @@
173140
"name": "python",
174141
"nbconvert_exporter": "python",
175142
"pygments_lexer": "ipython3",
176-
"version": "3.10.11"
143+
"version": "3.11.5"
177144
},
178145
"nbdime-conflicts": {
179146
"local_diff": [

0 commit comments

Comments
 (0)