Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct rounding error in number of pixel computation and grid drawing #259

Merged

Conversation

fabien-colonnier
Copy link
Contributor

I realized the indexing of the grid was wrong due to a rounding error. I corrected it and tested it is correct while updating grid_border example to have different width and height. It highlighted another error in the full grid drawing with an added column. It is corrected too.

@sebjameswml
Copy link
Collaborator

sebjameswml commented Oct 12, 2024

Just apply this diff - essentially just changing step to 0.64f so that the text for the grids in grid_border all show.

diff --git a/examples/grid_border.cpp b/examples/grid_border.cpp
index 9fc7051e..04994027 100644
--- a/examples/grid_border.cpp
+++ b/examples/grid_border.cpp
@@ -42,7 +42,7 @@ int main()
         data[ri][0] =  static_cast<double>(std::rand()) / RAND_MAX ; // Range 0->1
     }
 
-    float step = 0.6f;
+    float step = 0.64f;
     // Add a GridVisual to display the Grid within the morph::Visual scene
     morph::vec<float, 3> offset = { -step * grid.width(), step * grid.height(), 0.0f };
 
@@ -175,7 +175,7 @@ int main()
     gv->setVectorData (&data);
     gv->cm.setType (morph::ColourMapType::Twilight);
     gv->zScale.setParams(0.0f, 0.0f);
-    
+
     gv->showgrid = true;
     gv->grid_colour = morph::colour::red;
     gv->grid_thickness = 0.2f;

Then it'll be good to merge.

@fabien-colonnier
Copy link
Contributor Author

Thanks for spotting it, I corrected it. Let me know if there is anything else to change

@sebjameswml sebjameswml merged commit 7b07eea into ABRG-Models:main Oct 14, 2024
6 checks passed
@fabien-colonnier fabien-colonnier deleted the correct_bug_grid_border branch October 14, 2024 09:12
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