Click here to Skip to main content
15,895,799 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
AnswerRe: What's the most challenging algorithm you've ever faced Pin
honey the codewitch30-May-21 1:30
mvahoney the codewitch30-May-21 1:30 
GeneralRe: What's the most challenging algorithm you've ever faced Pin
Randor 30-May-21 18:34
professional Randor 30-May-21 18:34 
GeneralRe: What's the most challenging algorithm you've ever faced Pin
honey the codewitch30-May-21 18:49
mvahoney the codewitch30-May-21 18:49 
GeneralRe: What's the most challenging algorithm you've ever faced Pin
Randor 30-May-21 19:08
professional Randor 30-May-21 19:08 
GeneralRe: What's the most challenging algorithm you've ever faced Pin
honey the codewitch30-May-21 19:30
mvahoney the codewitch30-May-21 19:30 
GeneralRe: What's the most challenging algorithm you've ever faced Pin
honey the codewitch30-May-21 19:39
mvahoney the codewitch30-May-21 19:39 
GeneralRe: What's the most challenging algorithm you've ever faced Pin
Randor 30-May-21 19:56
professional Randor 30-May-21 19:56 
GeneralRe: What's the most challenging algorithm you've ever faced Pin
honey the codewitch30-May-21 21:30
mvahoney the codewitch30-May-21 21:30 
I can't use the STL because it's pretty much non-existent on the arduino for anything non-trivial. Part of the reason is due to supporting 8 bit processors and all the constraints that usually come with them. The STL doesn't play well with 8kB of RAM. It's not that it won't work, it's just not really great for that, and if you only have 256kB of nvs program space to work with.

Because of that I've had to hand roll things like std::is_same<> D'Oh! | :doh:

I can't do anything that specifically targets SIMD, because although some of the processors I target do support those instructions, there is no unified way to target it other than to cajole the C++ compiler into generating the right machine code. Frankly, I don't even know what SIMD looks like on, say a 32-bit Tensilica chip but I know it supports it in some form. Same with ARM Cortex CPUs.

I'm currently using run lengths so that I draw horizontal scanlines at a time. That cuts down device traffic (often SPI bus traffic), since I can almost always fill a rectangle with a color in less instructions than writing each individual pixel. - horizontal and vertical lines are technically filled rectangles. =)

Other than that though, it's still pixel by pixel. What really gets me though, is having to examine each point in the draw destination.

I've limited the search by getting a bounding rectangle for the polygon, but all it does is sort the points so it won't deal with "inside out" polygons. I don't rightly care, because that's almost never what you want anyway, and if you did you could just fill the screen before drawing it or something. I can add support for it fairly easily but it seems a waste of time.

I'm not worried about scanning the path segments in terms of time or space as I expect paths to be very small in practice. Like less than 30 or so points. You can do more of course, but it's on you because I make you pass in a buffer to use anyway.

What I'm concerned about is the brute force check of each pixel in the draw destination to see if it falls within the polygon. That seems ... inelegant to say the least.

I got it working less than 10 minutes after you pointed me to it. =)
Real programmers use butterflies

PraiseRe: What's the most challenging algorithm you've ever faced Pin
Randor 30-May-21 22:02
professional Randor 30-May-21 22:02 
GeneralRe: What's the most challenging algorithm you've ever faced Pin
honey the codewitch31-May-21 3:02
mvahoney the codewitch31-May-21 3:02 
JokeRe: What's the most challenging algorithm you've ever faced Pin
Randor 31-May-21 4:04
professional Randor 31-May-21 4:04 
GeneralRe: What's the most challenging algorithm you've ever faced Pin
honey the codewitch31-May-21 4:15
mvahoney the codewitch31-May-21 4:15 
AnswerRe: What's the most challenging algorithm you've ever faced Pin
Greg Utas30-May-21 6:54
professionalGreg Utas30-May-21 6:54 
GeneralRe: What's the most challenging algorithm you've ever faced Pin
honey the codewitch30-May-21 7:02
mvahoney the codewitch30-May-21 7:02 
AnswerRe: What's the most challenging algorithm you've ever faced Pin
Clumpco30-May-21 20:20
Clumpco30-May-21 20:20 
GeneralRe: What's the most challenging algorithm you've ever faced Pin
honey the codewitch30-May-21 21:33
mvahoney the codewitch30-May-21 21:33 
AnswerRe: What's the most challenging algorithm you've ever faced Pin
ormonds31-May-21 1:52
ormonds31-May-21 1:52 
AnswerRe: What's the most challenging algorithm you've ever faced Pin
ElectronProgrammer31-May-21 2:08
ElectronProgrammer31-May-21 2:08 
AnswerRe: What's the most challenging algorithm you've ever faced Pin
BDieser31-May-21 3:37
BDieser31-May-21 3:37 
GeneralRe: What's the most challenging algorithm you've ever faced Pin
honey the codewitch31-May-21 4:22
mvahoney the codewitch31-May-21 4:22 
AnswerRe: What's the most challenging algorithm you've ever faced Pin
obermd31-May-21 4:50
obermd31-May-21 4:50 
AnswerRe: What's the most challenging algorithm you've ever faced Pin
Matt McGuire1-Jun-21 5:39
professionalMatt McGuire1-Jun-21 5:39 
GeneralWhy do lazy students assume everyone else is dumber than them? Pin
OriginalGriff29-May-21 3:12
mveOriginalGriff29-May-21 3:12 
GeneralRe: Why do lazy students assume everyone else is dumber than them? Pin
Dave Kreskowiak29-May-21 3:33
mveDave Kreskowiak29-May-21 3:33 
GeneralRe: Why do lazy students assume everyone else is dumber than them? Pin
Nelek29-May-21 4:00
protectorNelek29-May-21 4:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.