Skip to content

Add color support#76

Draft
f-fl0 wants to merge 4 commits into
masterfrom
add-color-support
Draft

Add color support#76
f-fl0 wants to merge 4 commits into
masterfrom
add-color-support

Conversation

@f-fl0

@f-fl0 f-fl0 commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

f-fl0 added 3 commits March 11, 2026 13:35
- Provides Color(), ColorAt(), SetColor(), and standard iterator
  methods (Incr, IsValid, RawIndex) on packed RGB/RGBA point cloud
  fields. PointCloud.ColorIterator() auto-detects "rgb" or "rgba".
- Add tests.
@codecov

codecov Bot commented Mar 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.15%. Comparing base (50ac694) to head (fd4de7e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #76      +/-   ##
==========================================
+ Coverage   86.24%   88.15%   +1.91%     
==========================================
  Files          33       34       +1     
  Lines        1941     1706     -235     
==========================================
- Hits         1674     1504     -170     
+ Misses        208      143      -65     
  Partials       59       59              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class packed RGB/RGBA color handling to the pc point cloud data model via a new Color type and iterator support, with tests validating iterator behavior and I/O round-trips.

Changes:

  • Introduce Color type with PCL-compatible packing/unpacking (0xAARRGGBB) and float32/uint32 conversions.
  • Add ColorIterator API to PointCloud plus a backing colorIterator implementation.
  • Add unit tests for color packing, iterators (rgb/rgba), and marshal/unmarshal round-trips.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pc/randomaccess.go No functional change (formatting/newline).
pc/pointcloud.go Adds PointCloud.ColorIterator() that locates rgb/rgba fields and returns a color iterator.
pc/iterator.go Adds Color*Iterator interfaces and colorIterator implementation over packed 4-byte fields.
pc/iterator_test.go Adds iterator-level tests for ColorIterator across rgb/rgba/no-field cases.
pc/io_test.go Adds round-trip marshal/unmarshal test verifying color bytes are preserved.
pc/color.go New Color type and conversion helpers matching PCL packed layout.
pc/color_test.go Adds tests for Color float32/uint32 round-trip and bit layout expectations.

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

Comment thread pc/color_test.go
Comment on lines +18 to +32
for _, c := range testCases {
t.Run("Uint32", func(t *testing.T) {
v := c.Uint32()
got := ColorFromUint32(v)
if got != c {
t.Errorf("Uint32 round-trip: expected %v, got %v", c, got)
}
})
t.Run("Float32", func(t *testing.T) {
f := c.Float32()
got := ColorFromFloat32(f)
if got != c {
t.Errorf("Float32 round-trip: expected %v, got %v", c, got)
}
})

Copilot AI Mar 11, 2026

Copy link

Choose a reason for hiding this comment

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

In this loop you pass a closure to t.Run that closes over the range variable c. While it happens to work as written (no t.Parallel), the repo targets Go 1.16 and other tests consistently rebind loop variables before t.Run (e.g., tt := tt in pc/iterator_test.go) to avoid future capture bugs. Consider rebinding c := c inside the loop (or use table-driven subtests with unique names) before starting subtests.

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.

2 participants