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

Fix pixelateLine #336

Closed
wants to merge 1,440 commits into from
Closed

Fix pixelateLine #336

wants to merge 1,440 commits into from

Conversation

ppiastucki
Copy link

@ppiastucki ppiastucki commented Jan 23, 2020

Add proper checks before advancing the position in the special case in pixelateLine to avoid creating pixels outside of the given range.

Here is a test case to reproduce the issue:

   QtRegion testRegion;   
   testRegion.encompass(Point2f(0.020345052078482695,0.03306070963481034));
   ShapeMap testShapeMap;
   testShapeMap.init(1, testRegion);
   Line line = Line(Point2f(0.000000,0.007629394531193157), Point2f(0.010172526039241347,0.000000));
   PixelRefVector pixels = testShapeMap.pixelateLine(line);
   for (size_t i = 0; i < pixels.size(); i++) {
       PixelRef pix = pixels[i];
       printf("Pixel %d, %d\n", pix.x, pix.y);
   }

Result:

Pixel 0, 4
Pixel 1, 4
Pixel 1, 3
Pixel 2, 3
Pixel 3, 3
Pixel 3, 2
Pixel 4, 2
Pixel 5, 2
Pixel 5, 1
Pixel 6, 1
Pixel 7, 1
Pixel 7, 0
Pixel 8, 0
Pixel 9, 0
Pixel 10, 0
Pixel 10, -1

Or by running the following command with the attached DXF file:

./depthmapXcli -m IMPORT -f ./shape_250_4810.dxf -o shape.graph

Result:

row out of range

shape_250_4810.zip

blsemo and others added 30 commits October 19, 2018 07:42
* Squash warnings on windows

* Crank up warning level to /W4 on MSVC

* Fix w4 warnings in MSVC

* Remove some clang warnings

* Remove psubvec - only used in one place and does not add real value.

* Shut up warning about overload hiding in paftl (we know about it and the
only way to get rid of it is getting rid of paftl)

* Suppress warnings on mac as well.
Change the actual getRows() and getCols() to size_t
…_version

Add the current git-commit at the version
pklampros and others added 25 commits June 5, 2019 23:33
…esh_interface

Make sure the result of the analysis is used to refresh the interface
…esh_interface

Replace "retvar" with appropriate variable names
Otherwise the progress dialog runs out much faster because the whole grid is tested
…lity_progress_fix

Move the progress check inside the filled-point test
When an attribute is selected from the index, the table is sorted by the same column. When a column is sorted at the table it is also selected on the attribute index
Add special handling for diagonal lines to XAXIS in
pixelateLineTouching.
* Silence OpenGL macOS warnings

* Remove version variable from all read and write functions

* Add default case handling to all switch statements

* Remove 'const' type qualifiers that have no effect

* Remove communicator variable name where not required

* Remove unused functions

* Remove all unused parameters

* Remove unused variables

* Properly order initialisation lists

* Fix multi-line comment

* Clear ambiguity of logical operations

* Add missing virtual destructors

* Replace old finite() with isfinite()

* Remove the register specifier

* Change __max to std::max

* Use std::move for SalaErrors in SalaProgram

* Fix operator order

* Fix other minor issues

* Squash all warnings when comparing integers of different signs and sizes

* Read count as an integer

* Remove unused variable

* Remove last version signifiers

* Reimplement various glu functions

Apple's deprecation of OpenGL creates a different problem here because the 3DView is coded using the old OpenGL way. Once 3DView is adapted to work as the GLView (or merged into it) then the glureimpl.h file won't be required. The license of the original file and thus the code in glureimpl.h is the SGI Free Sofware License B, version 2 and it is compatible with the GPL according to https://www.gnu.org/licenses/license-list.html

* Remove unnecessary code

* Remove unused functions and reduntant file

* Add missing math declarations

* Remove non-existant file reference

* Squash some gcc warnings

* Restore and expose a hidden colourscale

The colourscale g_nicecolorhsb along with the relevant comment "Test a range designed to try to keep consistent saturation and brightness of g_nicecolor, and only move hue" has been named "Hue Only Axmanesque" as it's a variation of that colourscale. On the interface it appears as "Equal Ranges (3-Colour Hue Only)"

* Remove qt5_wrap_cpp as AUTOMOC is set to ON
Add proper checks before advancing the position in the special case in pixelateLine to avoid creating pixels outside of the given range.
@pklampros
Copy link
Collaborator

Moved to #372

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.

3 participants