Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 19, 2025

This PR adds special styling for grid lines that pass through the origin (world axis lines) to make them stand out as reference lines, bringing ImPlot3D's visual behavior in line with ImPlot.

Problem

ImPlot3D currently only distinguishes between minor and major grid lines (with 0.3 and 0.6 alpha respectively), but lacks the special highlighting for lines passing through the origin that ImPlot provides. This makes it harder to visually identify the coordinate system's origin in 3D plots.

Before (ImPlot3D):
ImPlot3D before

Reference (ImPlot):
ImPlot reference

Solution

The implementation adds a third visual tier for grid lines:

  • Minor grid lines: 30% opacity (dim, subtle background grid)
  • Major grid lines: 60% opacity (medium, regular tick marks)
  • World axis lines: 90% opacity (bright, origin reference) ← NEW

Implementation Details

  • Detects origin lines by checking if tick position is within 1e-8f of zero (consistent with other coordinate comparisons in the codebase)
  • Applies to all three axes (X, Y, Z) and is visible on all plot faces
  • Minimal code changes: only 3 lines added + 2 lines modified in the RenderGrid function
  • Maintains backward compatibility - existing plots will just get the improved visual hierarchy

Testing

  • ✅ Builds successfully with existing CMake configuration
  • ✅ Code follows project style guidelines (clang-format applied)
  • ✅ Logic validation confirms correct origin detection with appropriate tolerance
  • ✅ No breaking changes to existing API

The world axis lines will be most visible in plots where axis ranges span across the origin, providing clear visual reference to the coordinate system center.

Fixes #108.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@brenocq brenocq changed the title [WIP] [Feature] World axis lines with additional styling [WIP] Feat: Highlight origin grid lines Jul 19, 2025
@github-actions github-actions bot added the status:review The task is under review label Jul 19, 2025
@brenocq brenocq added type:feat New feature or request prio:medium Medium priority labels Jul 19, 2025
Co-authored-by: brenocq <17342434+brenocq@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Feat: Highlight origin grid lines Add world axis lines with brighter styling for origin grid lines Jul 19, 2025
@Copilot Copilot AI requested a review from brenocq July 19, 2025 09:59
Copilot finished work on behalf of brenocq July 19, 2025 09:59
@brenocq
Copy link
Owner

brenocq commented Jul 19, 2025

It is a bit hard to know which lines are "major tick" lines and which ones are "origin" lines. I just checked matplotlib and they don't have a special line color for major ticks. I think it would be better for all lines to have the same color (just like ImPlot), and only have "origin" lines with a special color to stand out.

…ll regular grid lines

Co-authored-by: brenocq <17342434+brenocq@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jul 19, 2025

It is a bit hard to know which lines are "major tick" lines and which ones are "origin" lines. I just checked matplotlib and they don't have a special line color for major ticks. I think it would be b...

You're absolutely right! I've simplified the approach to match ImPlot and matplotlib behavior. Now all regular grid lines use the same color (no distinction between major/minor), and only origin lines have special styling to stand out. This provides a cleaner visual hierarchy with just two tiers: regular grid lines (60% opacity) and world axis lines (90% opacity). Fixed in commit 19cc070.

Copilot finished work on behalf of brenocq July 19, 2025 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio:medium Medium priority status:review The task is under review type:feat New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Highlight origin grid lines
2 participants