Skip to content

Conversation

@Mereshiya
Copy link

This PR addresses Issue #5966 by adding an example script to color octree leaf nodes based on the height (z-coordinate) or RGB colors of a point cloud. The script:

  • Creates a point cloud from synthetic data or a .ply file.
  • Supports height-based coloring (jet, hot, viridis, cool) with '4' key toggling.
  • Supports RGB colors (or default gray) with '5' key to toggle modes.
  • Colors octree leaf nodes by averaging point colors.
    Tested with Open3D 0.16.0.

Fixes #5966

@update-docs
Copy link

update-docs bot commented Aug 15, 2025

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

@Mereshiya
Copy link
Author

@syncle Can you please help in reviewing it

@ssheorey ssheorey requested a review from Copilot October 29, 2025 22:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds an example script that demonstrates how to color octree leaf nodes based on either height (z-coordinate) or RGB colors of a point cloud. The script creates a synthetic point cloud and provides interactive visualization with keyboard controls to toggle between different coloring modes and color maps.

Key changes:

  • New interactive example with height-based (jet/hot/viridis/cool) and RGB coloring modes
  • Octree leaf node coloring by averaging point colors within each node
  • Keyboard callbacks ('4' and '5') for toggling color maps and modes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +43 to +51
def safe_boundary_half_edges(mesh, vid):
try:
return mesh.BoundaryHalfEdgesFromVertex(vid)
except Exception as e:
if "not on boundary" in str(e):
return []
return []


Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function safe_boundary_half_edges appears to be unrelated to the octree coloring example. This function references mesh operations that are not used anywhere in this script. Consider removing it as dead code.

Suggested change
def safe_boundary_half_edges(mesh, vid):
try:
return mesh.BoundaryHalfEdgesFromVertex(vid)
except Exception as e:
if "not on boundary" in str(e):
return []
return []

Copilot uses AI. Check for mistakes.
Comment on lines +52 to +58
def safe_send_data(data):
"""Prevents RemoteFunctions.SendGarbage from failing."""
if not isinstance(data, (bytes, bytearray)):
return False
return True


Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function safe_send_data appears to be unrelated to the octree coloring example. This function references RemoteFunctions that are not used in this script. Consider removing it as dead code.

Suggested change
def safe_send_data(data):
"""Prevents RemoteFunctions.SendGarbage from failing."""
if not isinstance(data, (bytes, bytearray)):
return False
return True

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +69
def safe_unpack_message(data):
"""Prevents RemoteFunctions.SendReceiveUnpackMessages from failing."""
try:
if not isinstance(data, (bytes, bytearray)) or len(data) < 4:
return None, None
import struct
msg_id = struct.unpack("!I", data[:4])[0]
payload = data[4:]
return msg_id, payload
except Exception:
return None, None
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function safe_unpack_message appears to be unrelated to the octree coloring example. This function references RemoteFunctions and message unpacking that are not used in this script. Consider removing it as dead code.

Suggested change
def safe_unpack_message(data):
"""Prevents RemoteFunctions.SendReceiveUnpackMessages from failing."""
try:
if not isinstance(data, (bytes, bytearray)) or len(data) < 4:
return None, None
import struct
msg_id = struct.unpack("!I", data[:4])[0]
payload = data[4:]
return msg_id, payload
except Exception:
return None, None

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot change color when visualizing octree

1 participant