Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Add support for coloring pointclouds by distance #6938

Merged
merged 14 commits into from Dec 19, 2023
Merged

Conversation

IvDmNe
Copy link
Contributor

@IvDmNe IvDmNe commented Oct 3, 2023

User-Facing Changes
Added option to color points in 3D and Image panels by norm of their coordinates.

Description

image
image

I added a ColorFieldOption "<distance>" and a new reader function for packedColorReader that uses 3 another readers for X, Y, Z coordinates and returns norm of these values.

I am not sure about one moment - should "<distance>" option be added in such hardcoded way or the name should be some variable to support translation to another languages?

@vercel
Copy link

vercel bot commented Oct 3, 2023

@IvDmNe is attempting to deploy a commit to the Foxglove Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@jtbandes jtbandes left a comment

Choose a reason for hiding this comment

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

Thanks for the PR and sorry for the delay in response. I think we are in favor of adding this feature. My main concern is that the "<distance>" string is being appended to a list of field names that come from user data, so in the rare event there is a conflict, that would cause problems. I would suggest that you actually add a new field to the config, maybe something like config.colorFieldComputed: "distance" | undefined. Then it becomes possible to disambiguate this special computed value from any user-defined point cloud field. The colorFieldOptions can still be a combination of user-defined and computed options, but the value of each option can be prefixed to avoid conflicting with a value of "distance".

Re translation, the option label can be translated, e.g. t("colorFieldDistance") and then add colorFieldDistance: "<distance>" to i18n/en/threeDee.ts.

You should also be able to add an entry to foxglove.PointCloud.stories.tsx to demonstrate the new functionality in a screenshot test.

… config field ColorFieldComputed and translation string for option to compute distance in ColorBy list
@IvDmNe
Copy link
Contributor Author

IvDmNe commented Nov 15, 2023

I have done as you suggested: automatically computed distance option now has prefix _auto_. In updatePointCloud function it is checked if specified value in config has this prefix. If so, it sets config.ColorFieldComputed to distance, which is used to create PackedColorReader. Is this what you meant?

If everything is alright, I will start to add the story.

@IvDmNe IvDmNe marked this pull request as ready for review December 2, 2023 21:01
@IvDmNe IvDmNe changed the title Add support for coloring pointclouds by distance [WIP] Add support for coloring pointclouds by distance Dec 2, 2023
@amacneil
Copy link
Contributor

👍 great feature

Copy link
Contributor

@snosenzo snosenzo left a comment

Choose a reason for hiding this comment

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

Thanks so much for the contribution!

@snosenzo snosenzo merged commit f9d343e into foxglove:main Dec 19, 2023
14 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants