An implementation of restricted quadtree triangulation (RQT), for converting raster heightmaps to 3D meshes.
Project description
Triangulated terrain near Horseshoe Bend, Arizona.
rqtreemesh
rqtreemesh is a basic implementation of restricted quadtree triangulation (RQT), for converting raster heightmaps to 3D meshes. For an overview of RQT-based mesh generation, see
Pajarola, Renato. "Overview of Quadtree-based Terrain Triangulation and Visualization." (2002).
Implemented in C++ with a pybind11 wrapper for Python.
Quick Start
git clone --recursive
this repo and run pip install .
on it.
Alternatively:
pip install rqtreemesh
.
This package requires Numpy
and Pillow
.
Usage
Functionality is provided by the Heightmap
class.
from rqtreemesh import Heightmap
Two constructors are available:
heightmap = Heightmap(array: np.ndarray, pixel_dim: float, top_left_x: float, top_left_y: float)
Parameters
array: np.ndarray
Input raster heightmap as a 2-dimensional numpy array where each dimension is a power of two. E.g. 1024 x 2048. Maximum size is 32768 x 32768.
pixel_dim: float
The spatial dimension of one pixel in the input heightmap.
top_left_x: float, top_left_y: float
The x and y locations of the top left corner of the input heightmap. Note that this location is not the center of the top left pixel, but rather its top left corner.
Alternatively:
heightmap = Heightmap.from_geotiff(path: str)
Parameters
path: str
Path to input raster heightmap in geoTIFF format with dimesnsions a power of two. E.g. 1024 x 2048. Maximum size is 32768 x 32768. The geolocation and spatial resolution of the heightmap will be obtained from the appropriate tags in the geoTIFF.
Note that rqtreemesh was developed for converting Digital Elevation Models (DEMs) . For other heightmaps, such as where all values are between $0$ and $1$, scaling the Heightmap.array
or Heightmap.pixel_dim
may be necessary to obtain the desired result. Also take care when converting a DEM with planar units not equal to its elevation units (e.g. Geographic/WGS84 projection).
To generate a mesh, use the generate_mesh
method.
heightmap = Heightmap...
(vertices, triangles) = heightmap.generate_mesh(max_error: float, show_progress: bool = False) -> Tuple[np.ndarray, np.ndarray]
Parameters
max_error: float
The maximum absolute vertical distance between the input heightmap and the resulting mesh.
show_progress: bool = False
Show a progress bar while generating the mesh. Default value: False.
Returns
(vertices, triangles): Tuple[np.ndarray, np.ndarray]
A tuple containing the output mesh.
vertices
is an array where each row contains the x, y and z coordinates of a vertex.triangles
is a connectivity matrix, i.e. an array where each row contains a triangle as three (zero-indexed) indices into the first element.
To provide easy compatibility with most 3D software, basic exporters to the Wavefront Object (.obj) and Stereolithography (.stl) formats are provided:
from rqtreemesh import write_obj, write_stl
write_obj(path: str, verts: np.ndarray, triangles: np.ndarray, flip_zy: bool = False)
write_stl(path: str, verts: np.ndarray, triangles: np.ndarray)
Parameters
path: str
The output file path.
verts: np.ndarray, triangles: np.ndarray
A coordinate array and connectivity matrix, such as the output of
generate_mesh
.
flip_zy: bool = True
Interchange the z and y axes of the exported mesh (only for .obj export). Default value: False.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for rqtreemesh-1.0.1-pp310-pypy310_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c8cc83985c44a55b82fe4429daf48f451c62a183ea334349470f57abb1d4d4c |
|
MD5 | 63302132d0e907e42403bdc57a77ccc9 |
|
BLAKE2b-256 | 86041c583a0dcff6872014c3466dedb464b7d6be7a5578bd2dc655f4d4818c85 |
Hashes for rqtreemesh-1.0.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18ff7ce9b208648727ce8865132ff9b9d2b12b98070ff8a3eaff3080d533429b |
|
MD5 | 30c0b06d58a2db41f1d0eedfd512a2d2 |
|
BLAKE2b-256 | 23f0527a4bc1786265d81c85296b61068bda2c1b67e61888e8a89f90fb560672 |
Hashes for rqtreemesh-1.0.1-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f24a5ec463fe80d240639a5b6d54088be3f41c18a4e42f8cb619a7f82c6ad70f |
|
MD5 | f3290e75fb0b4124650814cef1eac803 |
|
BLAKE2b-256 | 51cac0e265aa922209103c4071303e289ddfcff16f421e80603f28356f8c7c3f |
Hashes for rqtreemesh-1.0.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d60b3b2eeac01a73fd38077d2fb0c36d5cbbee1bddc02ef08bad738cc2aad717 |
|
MD5 | 1479d60d318c5e7fa5a0310a4f4aa0d2 |
|
BLAKE2b-256 | f1bd5161a5084f565138ae9369cc6a918bd3aaccf3646abea195f5a4b81c8406 |
Hashes for rqtreemesh-1.0.1-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96d50472a53f2a093d3cdc832cd3d80a1f0ddff57303aef8b97cff3bbaebbf4d |
|
MD5 | cea3bf59f5c6e877f2472369b15592cd |
|
BLAKE2b-256 | b845c201a4c12c127bc530d8cb88218b596be7047409eaaa0b91e71676bb6cc4 |
Hashes for rqtreemesh-1.0.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7f588b91a0171edfb628d5ccb89f3f4be9361420846f2c9015e23ff0e444636 |
|
MD5 | 34f5763daa66e210d67e9772c1324f6d |
|
BLAKE2b-256 | e50459bf9acfe63d447dd1e2b83d060b90b0bf648c68e4f0b71548208f478209 |
Hashes for rqtreemesh-1.0.1-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 163052f5a3bf90c7bdc9d75aab25e46d0283aa20746d7c439a2a1acb97a32d15 |
|
MD5 | 2f4cf77d25dfc5e41447985df340ac7d |
|
BLAKE2b-256 | 9f502a3b89307ae4b14f1451d0ea58b6ba3866ba965d0d4ee5964dcc343b7700 |
Hashes for rqtreemesh-1.0.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7e42cafd4c3a5c266dee1f3a9028ede8d14febe0cfac3732c602566c15d6e24 |
|
MD5 | b38131e49c5cbb236b4a83a78516a25c |
|
BLAKE2b-256 | cdac6961c900b0026f330a8da88083ef7eb452be1a6820d54ad3f081a1ad884b |
Hashes for rqtreemesh-1.0.1-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 365f59c3f1445366cf04293fc50d2644334957fdbf0bc12534553b9c5f43f7b7 |
|
MD5 | ac2578d3df15987bff8f5f5562d8a666 |
|
BLAKE2b-256 | 1a82f9e84d7d9261d9ce20dcb1a96ac52dddd6efd00eb5c9d577de77ff32e705 |
Hashes for rqtreemesh-1.0.1-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 375db5763da50e3376062aee0439bdd9f09e96e2629e5a047aa80e1a05afd1fc |
|
MD5 | 53b6056285828bfbd2c829ef77af7492 |
|
BLAKE2b-256 | 8c2674822946dbf9ce7c8aa9a3e7dee264e047953ddf9317f3a5c16898ba5cfe |
Hashes for rqtreemesh-1.0.1-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ab8332479dbd8ea24a7de29509fea9d2aa5c09fe2df23ac0e8972937302ceb6 |
|
MD5 | 3417239c1ba54626968db899507e91a4 |
|
BLAKE2b-256 | e79133446886dd29041e292ff87f7981fa5fbc7a04e6557c71c6a97e146403e1 |
Hashes for rqtreemesh-1.0.1-cp312-cp312-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98fec08d09591efbc2ac367ec844a7ede7639c75038401c355a84400563f7af4 |
|
MD5 | b2446a70239d975c5a6fd56058353a21 |
|
BLAKE2b-256 | da0efa48fd7e950a87dcc59840e661dc8546cf7628e0b6f200cd89564ed42233 |
Hashes for rqtreemesh-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70018695b1bd1c2f5b930b985c79deb6664acc53328643d4defbb4a2e49ef0f1 |
|
MD5 | a0c98ef52e4931ad54b44f58670c6d9c |
|
BLAKE2b-256 | c5bc20e166e71b32f5e486e477fe07feb0e10349ff780d6075320194f766a64e |
Hashes for rqtreemesh-1.0.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 943c85a47efbdfa42ba9ceaa49762f12f6283591fb8443637581c554b4e99f34 |
|
MD5 | 3d4d3fda16b9985359262e61708fafc5 |
|
BLAKE2b-256 | 0b10902948ad794e2a361920e398b0e747428aa6704dda54fd18fd086452f79e |
Hashes for rqtreemesh-1.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 707321136b14c3b931a8c6460f10e5d220d6c40edc23791f063616027051f011 |
|
MD5 | e393831e270a2aab33256048a0ca0d8e |
|
BLAKE2b-256 | 5b9a78b81fd03689bb51583447f290422726db518f6c9587ed99f062c2233932 |
Hashes for rqtreemesh-1.0.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdbb13f734c6b4f94d6ab8ea79535ccc1df890fc5d658a1b1a983eed6ee24cc2 |
|
MD5 | 448a79e615c6b02d1798df4171e14c79 |
|
BLAKE2b-256 | 19e4e50592b9c4ae97eaae305b723342fc34138404b03f9ff4431f988f29ef27 |
Hashes for rqtreemesh-1.0.1-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 447f4982acc28cb9f51f2856f627bcd9d5bca0e6a0d70971dc4abfc8fa4c43b4 |
|
MD5 | 59aef164dab80ef00ff05be76cff09ab |
|
BLAKE2b-256 | 4e1ce20bf0df9fb2ac62cd463164aeed4bcaa3bce51310d8867a8a9c6b427184 |
Hashes for rqtreemesh-1.0.1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c1586f2982acabfd151e7d1dc66a50e6a19bf5b3014fe25c33554a554fffe50 |
|
MD5 | 6446e2c03440de05216b3d6e24a20f20 |
|
BLAKE2b-256 | 2a436a62a3e5d9c7df6a0ba0c2b2fd90caa0f463595c0d9aec241e6b39b31fc1 |
Hashes for rqtreemesh-1.0.1-cp311-cp311-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79f1247e0ed0ad8e62f3712d8e466fec523822ed6bb4771390fecdf83d7d2e68 |
|
MD5 | cd788d5b96ae0cf906f34800f6444315 |
|
BLAKE2b-256 | 9e455e32f9cbac395a65d9b29b3199b5dd26358e757d26c4e3ef30be3dd940f9 |
Hashes for rqtreemesh-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 007b673331be538993cee9cc876136f8f47a67e2fb99f257479b33a630a2e099 |
|
MD5 | 2ce4c0c06772744a0e7225ec826d75f3 |
|
BLAKE2b-256 | 63bd546ce394e7ae360462213ecff715b0cc9971457d808822111a79c7456ef1 |
Hashes for rqtreemesh-1.0.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d548e27315b3b5cb19bc66d3856b96efad855ccf2e73d8574f30e581a9bcec10 |
|
MD5 | 178e1c2850328c6cd2fb48c3b7a1ae9d |
|
BLAKE2b-256 | 0351cf4b29e15acde66c0318d5f3b4221933f66881e328e76f9939e560e76bd3 |
Hashes for rqtreemesh-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01bf8a66ebd00d5a503ea7334fb5b033106620604af2ce128ecccb8ce178f420 |
|
MD5 | e3b839d44bacf410f6a5410049864302 |
|
BLAKE2b-256 | b4a14b2104aca56f040602543b8e2697e1560b5bbf8176cb7789d6992fbf5f64 |
Hashes for rqtreemesh-1.0.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbc163fbbb92acd38b9d9ba96b6b5816925b5c690a9cc559439c70da0c15e04b |
|
MD5 | be01c2a6de2981cbf11b220ef558084b |
|
BLAKE2b-256 | 6fa29f6620a3985324d359406560fe9c793f4eea964fc03bdba2deea80eab955 |
Hashes for rqtreemesh-1.0.1-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 638dd7b5252581c2fefbebefce076b103093b94aa11bca64093859b0b20d7eac |
|
MD5 | 120b6c12718ce8ec57fde496122ec55a |
|
BLAKE2b-256 | c464673f50180e5b5f195bfa1655a5a56dffa7c9e64eaaaa714c077da211b39d |
Hashes for rqtreemesh-1.0.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a34edc512bc7937376dac3eb28abd6ff54d04cacdd1a60d1db8f78419a6b6425 |
|
MD5 | 382a9abff79fd0e81b53d9da9c548d4f |
|
BLAKE2b-256 | 208e6f664d95bbf5ca51aa02c56b3f0f8e97d6fd0538f5fafe69d31e325b78e4 |
Hashes for rqtreemesh-1.0.1-cp310-cp310-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93c57e084603a7b4d2a798be6336526bdb629659779964d31407034359ba5b99 |
|
MD5 | 764e75913d5cf3913296a6b85d6d69f4 |
|
BLAKE2b-256 | 262cd424b5e89f36d25b5bf481190a3a705e723ca668d30a75c4e7e2cc0edf99 |
Hashes for rqtreemesh-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5b9a366ddfb7665c0da28b962aa3756f4902645effeb8ec3ef8bdf380ad9be1 |
|
MD5 | 05b4f8202f24e7ba4327892fb6b33975 |
|
BLAKE2b-256 | b36e44fdbcbc66d316449106be0f31f274d0c476708b4b3a48a8da3cddfce34f |
Hashes for rqtreemesh-1.0.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9595d9002c43d0bb307cdbd186b3c4c827e86d9fbd5b2a1f67a5b4aafa522543 |
|
MD5 | 2338cd835e5b5ee79f841fe247a32ff4 |
|
BLAKE2b-256 | bc272ee28c70d463d013e414623b2a3da2129a254cc3839d965cdd87bc505dd6 |
Hashes for rqtreemesh-1.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88e6d95be97c5047e1c5b5af76222b9483b56f8f8a5a35822033f20ddb43d46b |
|
MD5 | 96536308d03fbdbfe6a9eafded35cca3 |
|
BLAKE2b-256 | 3750cbb6081f747d5d0cc393c0e628bfe4a37fbab851b585fc7741c72273e951 |
Hashes for rqtreemesh-1.0.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c361789678d008d1a5b2bd89cb7a6bdf1d21c1abe8aab8c138f121aa12bbd699 |
|
MD5 | 6f0f2f438bc68ca45883aa94726eb1d6 |
|
BLAKE2b-256 | 5d951c58350f2bef5d57d39360e5393dc72ca5828fcc1370e6f51b99aec10052 |
Hashes for rqtreemesh-1.0.1-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1854fc5741b2a764f413178506a29acc750ac173f75ee360673cfc26f33fd0fe |
|
MD5 | d6a67c277480d29c68403d11ad556719 |
|
BLAKE2b-256 | f14852b749e1504d903e7139e2edad7a1012b1d5fc3b2d2dca15257bf87c5f5a |
Hashes for rqtreemesh-1.0.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4376fca3f44ab9d756f8b65b58078c9d820097b7d7b9aa873d6de129950f250d |
|
MD5 | f37fc0e9b4a2d4f84b4e07b14534a9bb |
|
BLAKE2b-256 | 1562ddcfe24d564438c88023ac619e9196ef564b7e092dd2f121ef6b92ed1ffa |
Hashes for rqtreemesh-1.0.1-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6c5b20ad7a40a339f445adc93e1bbb571fe6e2abc17275bce15e843b79c2cb7 |
|
MD5 | ad910d09ccc978491613202ac38fc598 |
|
BLAKE2b-256 | 42f5d888b74c6991f349327f44f45c83681675d53b9f58ed31347ea516a975b5 |
Hashes for rqtreemesh-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cacc64216f1bbea50fea08ca8f3a5044853394b39df8bd703185461ec742c7ae |
|
MD5 | 464218549a7fd75dfba1d51728ef42db |
|
BLAKE2b-256 | 969b1eb35ae18caf6cccb93807118aaa903a31753cea552dd56f44067106553f |
Hashes for rqtreemesh-1.0.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95f38ce61e62bf461649f5738b7342f472b07a7f0337a4ed2bb811a9c17cbc5d |
|
MD5 | f1038e190b2aa7ee916f8a0db51b9fd2 |
|
BLAKE2b-256 | dbd9fbaf931669daf06cf67a2791be13882e2a66428d98b38ae7947682253b49 |
Hashes for rqtreemesh-1.0.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c6282a52638e8fe152912637cb87d5b4b697cf71b58d63bbcd2899e1a80af8f |
|
MD5 | 2a7968dc44fd2154beefb67c5dad6b9e |
|
BLAKE2b-256 | 271c0c73fcb21702723a63a8e3e4f9fdeba4c9bab6685c89c23532bc1db860a8 |