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.
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.
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, a simple exporter to the Wavefront Object (.obj) format is also provided:
from rqtreemesh import write_obj
write_obj(path: str, verts: np.ndarray, triangles: np.ndarray, flip_zy: bool = False)
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. 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.0-pp310-pypy310_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce2d139c98107de5adddb8c68f0e2cd5cebfa8f90bdc726800605ba1d0000c8d |
|
MD5 | 16d83b90eeaf97d24879a0b7582e1786 |
|
BLAKE2b-256 | 0a0ecfdf6f406a4c3d44f0e5fe21924bdfbac7d150fbd87ab2e3f0f7bad5ca19 |
Hashes for rqtreemesh-1.0.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42041437f91fafba720ea186ce2f2e2d324eb969d7666c72653c926b7224edb4 |
|
MD5 | 09a5184812729ed0bf492de4d28346e8 |
|
BLAKE2b-256 | 9e95e7a9d608fb33b6ffc11259e1a13251c13c4663f5cc7735a547f5675e3977 |
Hashes for rqtreemesh-1.0.0-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b7b81a9c95c101b60b87981ee42af8c7aa3710cdbd3db18a6a63fbcc4d4fb6a |
|
MD5 | d2aae0fcac0ef338ba0892df9ecab1c9 |
|
BLAKE2b-256 | ee6e35b213b5d2bb926968cb5989638efa27d8cc1a51e0e99a58223516b5b3b7 |
Hashes for rqtreemesh-1.0.0-pp310-pypy310_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1eeb1a18f7759b96c2e70246b0db18145682475568dce3210444cd35bc9a802 |
|
MD5 | 713f8b59c30685ded616e7b8d6eeb263 |
|
BLAKE2b-256 | 41a0ae6d48cbc47764ba43a4d77992ab5d8a8133dfd58eba5e9f7783769ea2b4 |
Hashes for rqtreemesh-1.0.0-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df28c3f02de9ce3c8d073e1c2704772bab82ebbcb8d2aa3232d5856f64611a3e |
|
MD5 | 37d7da7c8bbec7d063c1d95d1ef93a32 |
|
BLAKE2b-256 | b03e31f316ba02c292d045536fab81478f87f4e4540a42774501032140774c52 |
Hashes for rqtreemesh-1.0.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ff65805b7419aa748c47c357612d01ce9734263c7bde25db86051100727df69 |
|
MD5 | 49014570fd1d84e8df859541c094d56f |
|
BLAKE2b-256 | 438fc7658ad2677d8ed64d30f4f6b4bb038561343163bd8c03e54eee33ccef95 |
Hashes for rqtreemesh-1.0.0-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 287a54fe9a882dc5422476911b6e06ecf1edc641f02108e8428ae290ad60a43e |
|
MD5 | 145215b1d43b4089927715642b4346f3 |
|
BLAKE2b-256 | 3435b6e4ad5a72e727d97cc807b4c2208b884f958409c31cb79ad6f8b9249b2e |
Hashes for rqtreemesh-1.0.0-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bfe2dfb56f0bc9013b7cc213e9adb36b5cac5d6eb7048948c33acd4faf642c9 |
|
MD5 | 9008589c0b86b6a80f4b599ee949b2f2 |
|
BLAKE2b-256 | d02de03736cad2c49821d5aeaa573de5e4e71acaa761c5b77bf55e15e26dd69d |
Hashes for rqtreemesh-1.0.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c06477115db0533b2c28e63076d8f6947fdef80ce18234721d43d2691e715ab4 |
|
MD5 | f4d40c2a8dc85dc09c482bfcdf214b1d |
|
BLAKE2b-256 | 80c05f71bb5487d797eaf7584eb194f5c2d87f966d7c09bd74ec748ad5a52912 |
Hashes for rqtreemesh-1.0.0-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b974371066a5c9fe0d50d0294c151ebc4b4728b7517ce61d1ca0731641c3d7f6 |
|
MD5 | e27b12a89bc9419129888171d7bb104f |
|
BLAKE2b-256 | 2ef3189321c36cec89707d0a1e405e1cd5c9c20b05f9b0d86753c3a08ccc4df3 |
Hashes for rqtreemesh-1.0.0-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c396c85acd92737eaf1faef574d5fc958d136682584289f49ea1870d029a1df7 |
|
MD5 | ce82bcc1b7d9f106aa1178b4d2493424 |
|
BLAKE2b-256 | 6065da916a00cfdd620c547e5aff88dba4381969c64d9195f9a54abb881e6665 |
Hashes for rqtreemesh-1.0.0-cp312-cp312-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd6a6190eb6aea3e7763935372a6287daa02caf3b8d1a4ceff0117d02bb4e320 |
|
MD5 | 1600be9fea295d986228bac4a6e7fdd1 |
|
BLAKE2b-256 | a715c6a2deccb0bf7fa2afb3f816e4d16ea30d2f3996a88b8d01c8fd71dde3a0 |
Hashes for rqtreemesh-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1591866629d443176ab39735e05ad0786208759216432e3d1b2c6edd6e121e0 |
|
MD5 | 03aaaa523454530ada517451a5a85742 |
|
BLAKE2b-256 | 768d1c823c2897704a182cdc914d094b132d345e77c3fb365e5a917414fc3063 |
Hashes for rqtreemesh-1.0.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da3fb0e48863c159a2183b616fab3e9aafcd968ef4b17ffcdf5ac5f30ec24cbf |
|
MD5 | 80c55969f0ab7eddbe992df3b90694ff |
|
BLAKE2b-256 | 1145085f7e280837f4a1ca2b222fd240b94c6a9852218d3e15129f4cf22dc3ae |
Hashes for rqtreemesh-1.0.0-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 120c034da6a8725eac513c7f6335258b260f4a28be1d6df248f7598abb7eadf3 |
|
MD5 | b22051541724eab3a704b6fa0f47afbb |
|
BLAKE2b-256 | 71f0283a71730642356638199af2fccfbc361641bb226da5867869bfd7a1dafa |
Hashes for rqtreemesh-1.0.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6604ce1d4543115dd0548efb2279a9511ab2e1e79ef097d632328dd6e0bb3a0 |
|
MD5 | cf7c50094359efd0bb297072b87e9d52 |
|
BLAKE2b-256 | dcb62feb6df91ebff38c5fc4421fe8d18c78e264740db0286f096a30991e02ce |
Hashes for rqtreemesh-1.0.0-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02c671d15b030b0ed18ddcf675e458216065212844ef8a5306b9d862e55d6ce2 |
|
MD5 | 64ed245ab78b4e62370947428a1a0629 |
|
BLAKE2b-256 | 7cfe2d4b9287c163f6d096ee568f7ecd6c72c84e0252eba93ccf7a63847a5567 |
Hashes for rqtreemesh-1.0.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c1c8807da053b2fec9f5cb83735d104c4ed50ddfd25c7aa2a50bba88064e428 |
|
MD5 | a1113aec565cc20625e51652c53d26fc |
|
BLAKE2b-256 | 7dafebb2f38893929fe580677897b5aeb3316bdb34e6f5480a383e321504bc98 |
Hashes for rqtreemesh-1.0.0-cp311-cp311-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de8103084e5029d8afe52fd0cbd1f2cb7f4fbd90eacbaa225f4afdea7688b9b5 |
|
MD5 | 3f52b9553560f2ef76528311ddb91bc3 |
|
BLAKE2b-256 | ef68085e2a70fa1330ed4ee35c51a9c3019a1606c3e8bd0bb44aad4c47a5c2d2 |
Hashes for rqtreemesh-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34498c2256d31e948c6b047dfa60ae93cad5b92fb2627c7bb0296e7d250df367 |
|
MD5 | 21cfb038351d96693097ca0a0b278fb9 |
|
BLAKE2b-256 | e95f1309041788bf36191b065ab978626bd6c4671d6218c6953f52b947e0b696 |
Hashes for rqtreemesh-1.0.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94c244b9cc680271884a38d8e3ebd45d6d39a52c6e5314441f23427425aeb261 |
|
MD5 | 77f6049e37c9e0c099936dfd9d5829cf |
|
BLAKE2b-256 | dac84661d54e1fdf5bb010ffac80dd53f765de90c70e777f8df0ecb0bdd7d645 |
Hashes for rqtreemesh-1.0.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe5aa9dcdca51ab24579b2df255ea17399fe9724eb496fe387805c42942c2cfb |
|
MD5 | 90a7bf4d982796546a77d2f4e61c3861 |
|
BLAKE2b-256 | d15062fc23f55d0dd9367ad8571765283482860a40774d2469c3361211eca23e |
Hashes for rqtreemesh-1.0.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 583ce9c2aff7bac5e515498fa8e5067466aa42316d490f484a5f4282f0ee4ca7 |
|
MD5 | 829219ae500c325866208017073db0d2 |
|
BLAKE2b-256 | 40910405b23291bf19f4c0d2180590c4e8c3a70ad9eb4ccfa81474dcff950abb |
Hashes for rqtreemesh-1.0.0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0896b591775a837370d7d88a928952458038c00fc75186140b5e187fc43439e0 |
|
MD5 | 0d23acab30a9c789524bc6451328ee5f |
|
BLAKE2b-256 | f6961dae25e62d40030c805eacfdae36c3a74d16ff3b167b51697fd4f6c54c0d |
Hashes for rqtreemesh-1.0.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 966da41afcb5b5694748c77b82795ebc934f865e40ecaf5607cf84dc2f32a711 |
|
MD5 | 8e5da73aef0cb3ae91c372f04bb55680 |
|
BLAKE2b-256 | 43cc8114801ea609b9d7dbb6ef9c4b78236a07f0932d3677e133973bb1b5d017 |
Hashes for rqtreemesh-1.0.0-cp310-cp310-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d0f0d5521b3b941a20e29de2f03e5ef8b93ce2d815faa7e9537bea24387b534 |
|
MD5 | 884af0f6ab820ace84b545e106f5616f |
|
BLAKE2b-256 | c4b6dcaedba34a085d702e5b6fb9b96d786e2e85436c148e5974228cc3850e87 |
Hashes for rqtreemesh-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d23f79e1ad52170847481bb30140010f6ed4d920fa7b62c4e9552dc3063b68aa |
|
MD5 | 81daa9790a928232846f863465cc7646 |
|
BLAKE2b-256 | 47bc69773aa0ade35036b102a386323d893b09aa5c0daed5e48f04b00190186d |
Hashes for rqtreemesh-1.0.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cd92b5b1406e7ba2fcda60d00e2845bc0697b9254b50ad986a124f4c747cee1 |
|
MD5 | f99a051e1f393f2011ee0e43737da9e4 |
|
BLAKE2b-256 | 886591da70f3b651ebc9149ac2edcf6bf99b3809775b458336f9767afa8f1f8c |
Hashes for rqtreemesh-1.0.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d8cb3ad9c38def54c5b39776b00a07f8cb563c83a5c840cb1bf027683734f60 |
|
MD5 | 28e80f1995b4e7a2e17c62176a5d824e |
|
BLAKE2b-256 | 327406eaf1795dd51441d558bd2d65d7adca06f6d3f0fde569bcc36269e1965d |
Hashes for rqtreemesh-1.0.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f23ebd4624af360214a7871390d11d63740117649591b15cf346d0d1f2d8eeb |
|
MD5 | 1041d04c641502200e1ae33b56ab6144 |
|
BLAKE2b-256 | 9073919ed06e83dd709c2360d13aa9bf1db6699afafefb6bf2d221b542e6b8ff |
Hashes for rqtreemesh-1.0.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac5349f3aa4cca7203255d71f45c1d6b55b71e7f8248a6272148f7c6ff450eef |
|
MD5 | ed57630681391891b79ad2bcd225498c |
|
BLAKE2b-256 | 93687d2309ac0facf78eb51b560aabbe094053104c4d8923c55ec8c9ba47b400 |
Hashes for rqtreemesh-1.0.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f72e919a720c4cfa559a6ad15861ddae2fdfda0bae39534cb7be1eb914f9f4a0 |
|
MD5 | 19e5af3bec7e228ff28a3570022e654e |
|
BLAKE2b-256 | 6d3adb528c8fafe617ee9b55f1ab69d4e36951be1888edf617a2328e7c0f24f7 |
Hashes for rqtreemesh-1.0.0-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d157d5edd0bc1df1d83c8a5a0a13a59312f76f471dc2b9999acf4f858d0d4ba2 |
|
MD5 | 83b0d3cde4142c610b1f0aefd1ae0ce0 |
|
BLAKE2b-256 | 92da9109d682a397341521fa3911cd4118566d603aaf70a5f8ecb0d7d1ec3660 |
Hashes for rqtreemesh-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49dd19bec424377cf43b47fdc1dabe543111ba8fbd907bc4d9073c4c85dc0e65 |
|
MD5 | 86c4d447414f71becd46a896fe68614a |
|
BLAKE2b-256 | af128d3ca0613830925de03c40c7f5af919bf45731ca7f82663e2bd056defeac |
Hashes for rqtreemesh-1.0.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a88608d62add33096b045572a9428abccbb893cc465839d223b50162f442f2f |
|
MD5 | 112bfc525ece1c2937d205324b7193b8 |
|
BLAKE2b-256 | b1d917f326f7c1e9fe4812bc89b592880fb13289389fcca1ee1e88d1db91e2f7 |
Hashes for rqtreemesh-1.0.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 691a0ff9546858cb91bdaa3b65caf56d9a23548f9850fe30ce3c3694e57b0f6a |
|
MD5 | 6b38e36e276d8e86cdb141ef53e40d1c |
|
BLAKE2b-256 | d72d7dd2b89795041fabe05345c99f0007b0a92b9f69c16e2588f068eefe1546 |