pyoctomap 0.1.11__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. pyoctomap-0.1.11/LICENSE +21 -0
  2. pyoctomap-0.1.11/MANIFEST.in +38 -0
  3. pyoctomap-0.1.11/PKG-INFO +379 -0
  4. pyoctomap-0.1.11/README.md +324 -0
  5. pyoctomap-0.1.11/README_pypi_preview.md +324 -0
  6. pyoctomap-0.1.11/docs/README.md +31 -0
  7. pyoctomap-0.1.11/docs/api_reference.md +401 -0
  8. pyoctomap-0.1.11/docs/build_system.md +119 -0
  9. pyoctomap-0.1.11/docs/counting_octree_explanation.md +188 -0
  10. pyoctomap-0.1.11/docs/file_format.md +258 -0
  11. pyoctomap-0.1.11/docs/performance_guide.md +135 -0
  12. pyoctomap-0.1.11/docs/troubleshooting.md +386 -0
  13. pyoctomap-0.1.11/docs/wheel_technology.md +326 -0
  14. pyoctomap-0.1.11/pyoctomap/__init__.py +146 -0
  15. pyoctomap-0.1.11/pyoctomap/color_octree.cpp +54724 -0
  16. pyoctomap-0.1.11/pyoctomap/color_octree.pyx +974 -0
  17. pyoctomap-0.1.11/pyoctomap/counting_octree.cpp +40425 -0
  18. pyoctomap-0.1.11/pyoctomap/counting_octree.pyx +448 -0
  19. pyoctomap-0.1.11/pyoctomap/dynamicEDT3D_defs.pxd +26 -0
  20. pyoctomap-0.1.11/pyoctomap/include_and_setting.h +10 -0
  21. pyoctomap-0.1.11/pyoctomap/octomap.cpp +6098 -0
  22. pyoctomap-0.1.11/pyoctomap/octomap.pyx +95 -0
  23. pyoctomap-0.1.11/pyoctomap/octomap_defs.pxd +7 -0
  24. pyoctomap-0.1.11/pyoctomap/octomap_math.pxd +37 -0
  25. pyoctomap-0.1.11/pyoctomap/octomap_std.pxd +86 -0
  26. pyoctomap-0.1.11/pyoctomap/octomap_trees.pxd +477 -0
  27. pyoctomap-0.1.11/pyoctomap/octree.cpp +35997 -0
  28. pyoctomap-0.1.11/pyoctomap/octree.pxd +23 -0
  29. pyoctomap-0.1.11/pyoctomap/octree.pyx +906 -0
  30. pyoctomap-0.1.11/pyoctomap/octree_base.cpp +20169 -0
  31. pyoctomap-0.1.11/pyoctomap/octree_base.pxd +14 -0
  32. pyoctomap-0.1.11/pyoctomap/octree_base.pyx +170 -0
  33. pyoctomap-0.1.11/pyoctomap/octree_iterators.cpp +25663 -0
  34. pyoctomap-0.1.11/pyoctomap/octree_iterators.pyx +887 -0
  35. pyoctomap-0.1.11/pyoctomap/pointcloud.cpp +21161 -0
  36. pyoctomap-0.1.11/pyoctomap/pointcloud.pyx +403 -0
  37. pyoctomap-0.1.11/pyoctomap/stamped_octree.cpp +48663 -0
  38. pyoctomap-0.1.11/pyoctomap/stamped_octree.pyx +726 -0
  39. pyoctomap-0.1.11/pyoctomap.egg-info/SOURCES.txt +91 -0
  40. pyoctomap-0.1.11/pyproject.toml +88 -0
  41. pyoctomap-0.1.11/setup.cfg +10 -0
  42. pyoctomap-0.1.11/setup.py +387 -0
  43. pyoctomap-0.1.11/src/octomap/dynamicEDT3D/include/dynamicEDT3D/bucketedqueue.h +90 -0
  44. pyoctomap-0.1.11/src/octomap/dynamicEDT3D/include/dynamicEDT3D/bucketedqueue.hxx +75 -0
  45. pyoctomap-0.1.11/src/octomap/dynamicEDT3D/include/dynamicEDT3D/dynamicEDT3D.h +151 -0
  46. pyoctomap-0.1.11/src/octomap/dynamicEDT3D/include/dynamicEDT3D/dynamicEDTOctomap.h +130 -0
  47. pyoctomap-0.1.11/src/octomap/dynamicEDT3D/include/dynamicEDT3D/dynamicEDTOctomap.hxx +338 -0
  48. pyoctomap-0.1.11/src/octomap/dynamicEDT3D/include/dynamicEDT3D/point.h +61 -0
  49. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/AbstractOcTree.h +164 -0
  50. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/AbstractOccupancyOcTree.h +241 -0
  51. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/ColorOcTree.h +207 -0
  52. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/CountingOcTree.h +123 -0
  53. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/MCTables.h +355 -0
  54. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/MapCollection.h +103 -0
  55. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/MapCollection.hxx +330 -0
  56. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/MapNode.h +82 -0
  57. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/MapNode.hxx +101 -0
  58. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/OcTree.h +101 -0
  59. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/OcTreeBase.h +57 -0
  60. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/OcTreeBaseImpl.h +575 -0
  61. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/OcTreeBaseImpl.hxx +1119 -0
  62. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/OcTreeDataNode.h +137 -0
  63. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/OcTreeDataNode.hxx +140 -0
  64. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/OcTreeIterator.hxx +470 -0
  65. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/OcTreeKey.h +243 -0
  66. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/OcTreeNode.h +97 -0
  67. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/OcTreeStamped.h +128 -0
  68. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/OccupancyOcTreeBase.h +508 -0
  69. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/OccupancyOcTreeBase.hxx +1134 -0
  70. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/Pointcloud.h +127 -0
  71. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/ScanGraph.h +231 -0
  72. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/math/Pose6D.h +206 -0
  73. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/math/Quaternion.h +203 -0
  74. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/math/Utils.h +56 -0
  75. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/math/Vector3.h +337 -0
  76. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/octomap.h +38 -0
  77. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/octomap_deprecated.h +49 -0
  78. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/octomap_timing.h +54 -0
  79. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/octomap_types.h +81 -0
  80. pyoctomap-0.1.11/src/octomap/octomap/include/octomap/octomap_utils.h +55 -0
  81. pyoctomap-0.1.11/src/octomap/octovis/include/octovis/CameraFollowMode.h +79 -0
  82. pyoctomap-0.1.11/src/octomap/octovis/include/octovis/ColorOcTreeDrawer.h +48 -0
  83. pyoctomap-0.1.11/src/octomap/octovis/include/octovis/OcTreeDrawer.h +163 -0
  84. pyoctomap-0.1.11/src/octomap/octovis/include/octovis/OcTreeRecord.h +42 -0
  85. pyoctomap-0.1.11/src/octomap/octovis/include/octovis/PointcloudDrawer.h +53 -0
  86. pyoctomap-0.1.11/src/octomap/octovis/include/octovis/SceneObject.h +113 -0
  87. pyoctomap-0.1.11/src/octomap/octovis/include/octovis/SelectionBox.h +62 -0
  88. pyoctomap-0.1.11/src/octomap/octovis/include/octovis/TrajectoryDrawer.h +50 -0
  89. pyoctomap-0.1.11/src/octomap/octovis/include/octovis/ViewerGui.h +228 -0
  90. pyoctomap-0.1.11/src/octomap/octovis/include/octovis/ViewerSettings.h +54 -0
  91. pyoctomap-0.1.11/src/octomap/octovis/include/octovis/ViewerSettingsPanel.h +70 -0
  92. pyoctomap-0.1.11/src/octomap/octovis/include/octovis/ViewerSettingsPanelCamera.h +89 -0
  93. pyoctomap-0.1.11/src/octomap/octovis/include/octovis/ViewerWidget.h +125 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Spinkoo (PyOctoMap)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,38 @@
1
+ # Include core package files
2
+ include README.md
3
+ include README_pypi_preview.md
4
+ include LICENSE
5
+ include pyproject.toml
6
+ include setup.cfg
7
+ include setup.py
8
+
9
+ # Include core Python package files
10
+ recursive-include pyoctomap *.pyx *.pxd *.cpp *.h
11
+ recursive-include pyoctomap/lib *.so *.so.* *.a *.dll *.dylib
12
+
13
+ # Include documentation
14
+ recursive-include docs *.md
15
+
16
+ # Include source libraries for building (but not in final package)
17
+ recursive-include src/octomap/octomap/include *.h *.hpp *.hxx
18
+ recursive-include src/octomap/dynamicEDT3D/include *.h *.hpp *.hxx
19
+ recursive-include src/octomap/octovis/include *.h *.hpp *.hxx
20
+ recursive-include src/octomap/lib *.so *.so.* *.a *.dll *.dylib
21
+
22
+ # Exclude build artifacts and external dependencies
23
+ prune build
24
+ prune dist
25
+ prune *.egg-info
26
+ prune src/octomap/build
27
+ prune src/octomap/bin
28
+ prune examples
29
+ prune tests
30
+ prune github2pypi
31
+ prune docker
32
+ prune images
33
+ prune test
34
+
35
+ # Exclude source C++ code from package (only headers needed for building)
36
+ prune src/octomap/octomap/src
37
+ prune src/octomap/dynamicEDT3D/src
38
+ prune src/octomap/octovis/src
@@ -0,0 +1,379 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyoctomap
3
+ Version: 0.1.11
4
+ Summary: Python binding of the OctoMap library with bundled shared libraries.
5
+ Author-email: Spinkoo <lespinkoo@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Spinkoo (PyOctoMap)
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ Project-URL: Homepage, https://spinkoo.github.io/pyoctomap/
28
+ Project-URL: Repository, https://github.com/Spinkoo/pyoctomap
29
+ Project-URL: Documentation, https://github.com/Spinkoo/pyoctomap/tree/main/docs
30
+ Project-URL: Bug Tracker, https://github.com/Spinkoo/pyoctomap/issues
31
+ Keywords: octomap,occupancy,mapping,robotics,3d
32
+ Classifier: Development Status :: 5 - Production/Stable
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: Intended Audience :: Science/Research
35
+ Classifier: Natural Language :: English
36
+ Classifier: Programming Language :: Python :: 3 :: Only
37
+ Classifier: Topic :: Scientific/Engineering
38
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
39
+ Requires-Python: >=3.8
40
+ Description-Content-Type: text/markdown
41
+ License-File: LICENSE
42
+ Requires-Dist: numpy>=1.16.0
43
+ Provides-Extra: visualization
44
+ Requires-Dist: matplotlib>=3.0.0; extra == "visualization"
45
+ Requires-Dist: open3d>=0.13.0; extra == "visualization"
46
+ Provides-Extra: dev
47
+ Requires-Dist: pytest>=6.0; extra == "dev"
48
+ Requires-Dist: pytest-cov; extra == "dev"
49
+ Requires-Dist: black; extra == "dev"
50
+ Requires-Dist: flake8; extra == "dev"
51
+ Requires-Dist: mypy; extra == "dev"
52
+ Requires-Dist: twine; extra == "dev"
53
+ Requires-Dist: build; extra == "dev"
54
+ Dynamic: license-file
55
+
56
+ # PyOctoMap
57
+
58
+ <div align="center">
59
+ <img src="https://github.com/Spinkoo/pyoctomap/blob/main/images/octomap_core.png?raw=true" alt="OctoMap Core" width="900">
60
+ </div>
61
+
62
+ A comprehensive Python wrapper for the OctoMap C++ library, providing efficient 3D occupancy mapping capabilities for robotics and computer vision applications. This modernized binding offers enhanced performance, bundled shared libraries for easy deployment, and seamless integration with the Python scientific ecosystem.
63
+
64
+ ## Features
65
+
66
+ - **3D Occupancy Mapping**: Efficient octree-based 3D occupancy mapping
67
+ - **Probabilistic Updates**: Stochastic occupancy updates with uncertainty handling
68
+ - **Path Planning**: Ray casting and collision detection
69
+ - **File Operations**: Save/load octree data in binary format
70
+ - **Cross-Platform**: Linux native support with Windows compatibility via WSL
71
+
72
+ ## Installation
73
+
74
+ ### Quick Install (Recommended)
75
+
76
+ Install from PyPI (pre-built manylinux wheel when available):
77
+
78
+ ```bash
79
+ pip install pyoctomap
80
+ ```
81
+
82
+ > **🚀 ROS Integration**: ROS/ROS2 integration is currently being developed on the [`ros` branch](https://github.com/Spinkoo/pyoctomap/tree/ros), featuring ROS2 message support and real-time point cloud processing.
83
+
84
+ ### Building from Source
85
+
86
+ > **📋 Prerequisites**: See [Build System Documentation](https://github.com/Spinkoo/pyoctomap/blob/main/docs/build_system.md) for detailed system dependencies and troubleshooting guide.
87
+
88
+ If you need to build from source or create custom wheels, we provide a Docker-based build system:
89
+
90
+ **From Source (Linux / WSL):**
91
+ ```bash
92
+ # Clone the repository with submodules
93
+ git clone --recursive https://github.com/Spinkoo/pyoctomap.git
94
+ cd pyoctomap
95
+
96
+ chmod +x build.sh
97
+ ./build.sh
98
+ ```
99
+
100
+ ```bash
101
+ # Build wheels for all supported Python versions
102
+ ./build-wheel.sh
103
+
104
+ # Or build manually with Docker
105
+ docker build -f docker/Dockerfile.wheel -t pyoctomap-wheel .
106
+ ```
107
+
108
+ The Docker build creates manylinux-compatible wheels for Python 3.8-3.14, properly bundling all required C++ libraries.
109
+
110
+ > **📋 Google Colab Users**: See [Build System Documentation](https://github.com/Spinkoo/pyoctomap/blob/main/docs/build_system.md) for detailed Colab installation instructions.
111
+
112
+ ## Quick Start
113
+
114
+ ### Basic Usage
115
+
116
+ ```python
117
+ import pyoctomap
118
+ import numpy as np
119
+
120
+ # Create an octree with 0.1m resolution
121
+ tree = pyoctomap.OcTree(0.1)
122
+
123
+ # Add occupied points
124
+ tree.updateNode([1.0, 2.0, 3.0], True)
125
+ tree.updateNode([1.1, 2.1, 3.1], True)
126
+
127
+ # Add free space
128
+ tree.updateNode([0.5, 0.5, 0.5], False)
129
+
130
+ # Check occupancy
131
+ node = tree.search([1.0, 2.0, 3.0])
132
+ if node and tree.isNodeOccupied(node):
133
+ print("Point is occupied!")
134
+
135
+ # Save to file
136
+ tree.write("my_map.bt")
137
+ ```
138
+
139
+ ### Tree Families Overview
140
+
141
+ PyOctoMap provides multiple octree variants from a single package:
142
+
143
+ - `OcTree` – standard probabilistic occupancy tree (most users start here)
144
+ - `ColorOcTree` – occupancy + RGB color per voxel
145
+ - `CountingOcTree` – integer hit counters per voxel
146
+ - `OcTreeStamped` – occupancy with per-node timestamps for temporal mapping
147
+
148
+ See the **[API Reference](https://github.com/Spinkoo/pyoctomap/blob/main/docs/api_reference.md)** for a detailed comparison
149
+ table and full method documentation.
150
+
151
+ ### Color Occupancy Mapping (ColorOcTree)
152
+
153
+ ```python
154
+ import pyoctomap
155
+ import numpy as np
156
+
157
+ tree = pyoctomap.ColorOcTree(0.1)
158
+ coord = [1.0, 1.0, 1.0]
159
+
160
+ tree.updateNode(coord, True)
161
+ tree.setNodeColor(coord, 255, 0, 0) # R, G, B (0-255)
162
+ ```
163
+
164
+ **Batch insertion with colors:**
165
+ ```python
166
+ # Insert point cloud with colors in a single operation
167
+ points = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]], dtype=np.float64)
168
+ colors = np.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]], dtype=np.float64) # RGB in [0, 1] range
169
+ sensor_origin = np.array([0.0, 0.0, 0.0]) # Optional: for proper ray casting
170
+ tree.insertPointCloud(points, sensor_origin=sensor_origin, colors=colors)
171
+ ```
172
+
173
+
174
+
175
+ ### Batch Operations (Summary)
176
+
177
+ For large point clouds, use the unified `insertPointCloud` method:
178
+
179
+ - `OcTree.insertPointCloud(points, origin, max_range=-1.0, lazy_eval=False, discretize=False)`
180
+ - `ColorOcTree.insertPointCloud(points, sensor_origin=None, ..., colors=colors)` — also sets per-point colors
181
+ - `OcTreeStamped.insertPointCloud(points, sensor_origin=None, ..., timestamps=ts)` — also sets per-node timestamps
182
+
183
+ See the **Performance Guide** for practical batch sizing and resolution
184
+ recommendations.
185
+
186
+ ## Examples
187
+
188
+ See runnable demos in `examples/`:
189
+ - `examples/basic_test.py` — smoke test for core API
190
+ - `examples/demo_occupancy_grid.py` — build and visualize a 2D occupancy grid
191
+ - `examples/demo_octomap_open3d.py` — visualize octomap data with Open3D
192
+ - `examples/sequential_occupancy_grid_demo.py` — comprehensive sequential occupancy grid with Open3D visualization
193
+ - `examples/test_sequential_occupancy_grid.py` — comprehensive test suite for all occupancy grid methods
194
+
195
+ ### Demo Visualizations
196
+
197
+ **3D OctoMap Scene Visualization:**
198
+ <div align="center">
199
+ <img src="https://github.com/Spinkoo/pyoctomap/blob/main/images/octomap_demo_scene.png?raw=true" alt="OctoMap Demo Scene" width="700">
200
+ </div>
201
+
202
+ **Occupancy Grid Visualization:**
203
+ <div align="center">
204
+ <img src="https://github.com/Spinkoo/pyoctomap/blob/main/images/occupancy_grid.png?raw=true" alt="Occupancy Grid" width="700">
205
+ </div>
206
+
207
+ ## Showcase
208
+
209
+ ### 🎨 Photo to 3D Voxel Scene
210
+
211
+ **[pyocto-map-anything](https://github.com/Spinkoo/pyocto-map-anything)** - Transform single photos into vibrant 3D voxel scenes using AI depth estimation (Depth Anything 3) and PyOctoMap's `ColorOcTree`. This showcase demonstrates the power of combining modern depth estimation models with efficient octree-based mapping, enabling instant 3D reconstruction from 2D images.
212
+
213
+ **Features:**
214
+ - AI-powered depth estimation from single images
215
+ - Automatic camera intrinsics estimation (DA3 models)
216
+ - Color-integrated voxel mapping with `ColorOcTree`
217
+ - Support for multiple depth models (Depth Anything v3, ZoeDepth, DPT)
218
+ - High-resolution 3D reconstruction with configurable voxel resolution
219
+
220
+ Perfect for exploring PyOctoMap's color mapping capabilities and seeing how it integrates with modern computer vision pipelines.
221
+
222
+ ## Advanced Usage
223
+
224
+ ### Room Mapping with Ray Casting
225
+
226
+ ```python
227
+ import pyoctomap
228
+ import numpy as np
229
+
230
+ # Create octree
231
+ tree = pyoctomap.OcTree(0.05) # 5cm resolution
232
+ sensor_origin = np.array([2.0, 2.0, 1.5])
233
+
234
+ # Add walls with ray casting
235
+ wall_points = []
236
+ for x in np.arange(0, 4.0, 0.05):
237
+ for y in np.arange(0, 4.0, 0.05):
238
+ wall_points.append([x, y, 0]) # Floor
239
+ wall_points.append([x, y, 3.0]) # Ceiling
240
+
241
+ # Use batch insertion for better performance
242
+ wall_points = np.array(wall_points)
243
+ tree.insertPointCloud(wall_points, sensor_origin, lazy_eval=True)
244
+ tree.updateInnerOccupancy()
245
+
246
+ print(f"Tree size: {tree.size()} nodes")
247
+ ```
248
+
249
+ ### Path Planning
250
+
251
+ ```python
252
+ import pyoctomap
253
+ import numpy as np
254
+
255
+ # Create an octree for path planning
256
+ tree = pyoctomap.OcTree(0.1) # 10cm resolution
257
+
258
+ # Add some obstacles to the map
259
+ obstacles = [
260
+ [1.0, 1.0, 0.5], # Wall at (1,1)
261
+ [1.5, 1.5, 0.5], # Another obstacle
262
+ [2.0, 1.0, 0.5], # Wall at (2,1)
263
+ ]
264
+
265
+ for obstacle in obstacles:
266
+ tree.updateNode(obstacle, True)
267
+
268
+ def is_path_clear(start, end, tree):
269
+ """Efficient ray casting for path planning using OctoMap's built-in castRay"""
270
+ start = np.array(start, dtype=np.float64)
271
+ end = np.array(end, dtype=np.float64)
272
+
273
+ # Calculate direction vector
274
+ direction = end - start
275
+ ray_length = np.linalg.norm(direction)
276
+
277
+ if ray_length == 0:
278
+ return True, None
279
+
280
+ # Normalize direction
281
+ direction = direction / ray_length
282
+
283
+ # Use OctoMap's efficient castRay method
284
+ end_point = np.zeros(3, dtype=np.float64)
285
+ hit = tree.castRay(start, direction, end_point,
286
+ ignoreUnknownCells=True,
287
+ maxRange=ray_length)
288
+
289
+ if hit:
290
+ # Ray hit an obstacle - path is blocked
291
+ return False, end_point
292
+ else:
293
+ # No obstacle found - path is clear
294
+ return True, None
295
+
296
+ # Check if path is clear
297
+ start = [0.5, 2.0, 0.5]
298
+ end = [2.0, 2.0, 0.5]
299
+ clear, obstacle = is_path_clear(start, end, tree)
300
+ if clear:
301
+ print("✅ Path is clear!")
302
+ else:
303
+ print(f"❌ Path blocked at: {obstacle}")
304
+
305
+ # Advanced path planning with multiple waypoints
306
+ def plan_path(waypoints, tree):
307
+ """Plan a path through multiple waypoints using ray casting"""
308
+ path_clear = True
309
+ obstacles = []
310
+
311
+ for i in range(len(waypoints) - 1):
312
+ start = waypoints[i]
313
+ end = waypoints[i + 1]
314
+ clear, obstacle = is_path_clear(start, end, tree)
315
+
316
+ if not clear:
317
+ path_clear = False
318
+ obstacles.append((i, i+1, obstacle))
319
+
320
+ return path_clear, obstacles
321
+
322
+ # Example: Plan path through multiple waypoints
323
+ waypoints = [
324
+ [0.0, 0.0, 0.5],
325
+ [1.0, 1.0, 0.5],
326
+ [2.0, 2.0, 0.5],
327
+ [3.0, 3.0, 0.5]
328
+ ]
329
+
330
+ path_clear, obstacles = plan_path(waypoints, tree)
331
+ if path_clear:
332
+ print("✅ Complete path is clear!")
333
+ else:
334
+ print(f"❌ Path blocked at segments: {obstacles}")
335
+ ```
336
+
337
+ ### Dynamic Environment Mapping & Iterators
338
+
339
+ For more complete examples on:
340
+
341
+ - dynamic environment mapping,
342
+ - iterator usage (`begin_tree`, `begin_leafs`, `begin_leafs_bbx`),
343
+
344
+ refer to the **API Reference** and example scripts in `examples/`.
345
+
346
+ ## Requirements
347
+
348
+ - Python 3.8+
349
+ - NumPy
350
+ - Cython (for building from source)
351
+
352
+ **Optional for visualization:**
353
+ - matplotlib (for 2D plotting)
354
+ - open3d (for 3D visualization)
355
+
356
+ ## Documentation
357
+
358
+ - **[Complete API Reference](https://github.com/Spinkoo/pyoctomap/blob/main/docs/api_reference.md)** - Detailed API documentation
359
+ - **[Build System](https://github.com/Spinkoo/pyoctomap/blob/main/docs/build_system.md)** - Prerequisites, build process, and troubleshooting
360
+ - **[File Format Guide](https://github.com/Spinkoo/pyoctomap/blob/main/docs/file_format.md)** - Supported file formats
361
+ - **[Performance Guide](https://github.com/Spinkoo/pyoctomap/blob/main/docs/performance_guide.md)** - Optimization tips and benchmarks
362
+ - **[Troubleshooting](https://github.com/Spinkoo/pyoctomap/blob/main/docs/troubleshooting.md)** - Common issues and solutions
363
+ - **[Wheel Technology](https://github.com/Spinkoo/pyoctomap/blob/main/docs/wheel_technology.md)** - Library bundling details
364
+
365
+ ## License
366
+
367
+ MIT License - see [LICENSE](https://github.com/Spinkoo/pyoctomap/blob/main/./LICENSE) file for details.
368
+
369
+ ## Contributing
370
+
371
+ Contributions are welcome! Please feel free to submit issues and pull requests.
372
+
373
+ ## Acknowledgments
374
+
375
+ - **Previous work**: [`wkentaro/octomap-python`](https://github.com/wkentaro/octomap-python) - This project builds upon and modernizes the original Python bindings
376
+ - **Core library**: [OctoMap](https://OctoMap.github.io) - An efficient probabilistic 3D mapping framework based on octrees
377
+ - **Build system**: Built with Cython for seamless Python-C++ integration and performance
378
+ - **Visualization**: [Open3D](https://www.open3d.org/) - Used for 3D visualization capabilities in demonstration scripts
379
+ - **Research support**: Development of this enhanced Python wrapper was supported by the French National Research Agency (ANR) under the France 2030 program, specifically the IRT Nanoelec project (ANR-10-AIRT-05), advancing robotics and 3D mapping research capabilities.