Skip to content

Commit

Permalink
rendering techniques notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
philipc2 committed Dec 8, 2023
1 parent 82d53e7 commit 295d6f2
Showing 1 changed file with 42 additions and 75 deletions.
117 changes: 42 additions & 75 deletions notebooks/02-methods/02-rendering-techniques.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
"# Rendering Techniques\n",
"---\n",
"\n",
"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",
"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",
"\n",
"\n",
"This notebook introduces relevant concepts and techniques that will be mentioned and used throughout this Cookbook."
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"## Vector (Shape) Geometries\n",
"\n",
Expand All @@ -26,70 +30,40 @@
"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",
"\n",
"\n",
"<img src=\"../images/rendering/polygons.png\" alt=\"Continents\" width=\"800\"/>"
],
"metadata": {
"collapsed": false
}
"<img src=\"../images/rendering/polygons.png\" alt=\"Continents\" width=\"400\"/>"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"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",
"\n",
"\n",
"<img src=\"../images/rendering/contients.jpg\" alt=\"Continents\" width=\"800\"/>"
],
"metadata": {
"collapsed": false
}
"<img src=\"../images/rendering/contients.jpg\" alt=\"Continents\" width=\"600\"/>"
]
},
{
"cell_type": "markdown",
"source": [
"The following examples show examples of how different elements of an unstructured grid can be represented geometrically."
],
"metadata": {
"collapsed": false
}
},
"source": [
"The following code snippets show how we can represent each of the main unstructured grid geometries.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"import shapely as sp"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "markdown",
"source": [
"A point is represented using a pair of Longitude and Latitude Values"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "markdown",
"source": [
"sp.Point([0.0, 0.0])"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "markdown",
},
"outputs": [],
"source": [
"An Edge is represented using a pair of points. "
],
"metadata": {
"collapsed": false
}
"import shapely as sp"
]
},
{
"cell_type": "code",
Expand All @@ -102,59 +76,52 @@
"collapsed": false
}
},
{
"cell_type": "markdown",
"source": [
"A Polygon is represented in terms of it's exterior coordinates, each of which are points."
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"sp.Polygon([[100, 40], [100, 50], [90, 50], [90, 40], [100, 40]])"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"## Rasterization\n",
"\n",
"Rendering each geometry directly is an expensive operation for even moderately large datasets. \n",
"While there is definitely merit in rendering each geometric shape directly, this operation is extremely computationally expensive for large datasets.\n",
"\n",
"Rasterization todo..\n",
"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",
"\n",
"The figure below shows how rasterization approximates the geometry of geometries.\n",
"\n",
"<img src=\"../images/rendering/raster_example.png\" alt=\"Rasterization Example\" width=\"800\"/>"
],
"metadata": {
"collapsed": false
}
"\n",
"<img src=\"../images/rendering/raster_example.png\" alt=\"Rasterization Example\" width=\"1000\"/>"
]
},
{
"cell_type": "markdown",
"source": [
"Below is an example of rastered polygons plotted against the expected geometry.\n",
"\n",
"<img src=\"../images/rendering/raster-vs-vector.png\" alt=\"raster and vector\" width=\"800\"/>"
],
"metadata": {
"collapsed": false
}
},
"source": [
"Below is an example of rasterized polygons plotted against the expected geometry.\n",
"\n",
"<img src=\"../images/rendering/raster-vs-vector.png\" alt=\"raster and vector\" width=\"400\"/>"
]
},
{
"cell_type": "markdown",
"source": [],
"metadata": {
"collapsed": false
}
},
"source": []
}
],
"metadata": {
Expand All @@ -173,7 +140,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
"version": "3.11.5"
},
"nbdime-conflicts": {
"local_diff": [
Expand Down

0 comments on commit 295d6f2

Please sign in to comment.