|
... that you can explain the purpose of in one (reasonable) line, say a sentence or two brief ones.
Mine is implementing a 2D polygon fill algorithm on a write only display device.
I know how in theory - vaguely - to do it, but it's mind bending to attempt in practice, and I say that as someone who writes old-school table based LR parsers.
UPDATE: Randor humbled me. There's an easy way to do this. I even knew about it at one point but blanked on it here. I am very grateful, despite feeling a little foolish.
My most complicated algo... probably GLR parsing. In terms of ones I haven't solved - there's one that should be simple but I can never get it right -> converting an NFA or DFA state machine into a regular expression.
Real programmers use butterflies
modified 31-May-21 10:18am.
|
|
|
|
|
|
a sentence or two brief ones.
or say, a tweet if I'm being generous. If you can put it in one tweet.
Real programmers use butterflies
|
|
|
|
|
Something bounded by two points.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Technowockally, that a line _segment_.
|
|
|
|
|
That must be the H.264 video encoding and decoding algorithm, I don't even want to look at the newer H.265 algorithm!
|
|
|
|
|
I've never tackled that one, I just punt that kind of thing to ffmpeg
Real programmers use butterflies
|
|
|
|
|
Many (~ 500) moons ago, I had to write a line "fitting" program with some unusual constraints. None of the usual "least squares", "cubic spline" etc. methods did exactly what was wanted, so I had to roll my own.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
true love
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Treating love like an algorithm might have something to do with it.
Real programmers use butterflies
|
|
|
|
|
When "true love" is your patient, then, doctor, treatment "primum non nocere" is even more critical.
I find it fascinating that the original sigil of the Asclepian healing cult had only onw serpent twining around the staff, not two (as on the Caduceus of Mercury).
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Obligatory xkcd: Useless
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Given these truths:
o Time is money.
o Money is the root of all evil.
o Girls cost time and money.
We obtain
time = money
_____
money = V evil
girls = time x money
girls = money x money
_____ _____
girls = V evil x V evil
girls = evil
|
|
|
|
|
You forgot the branch cut - a square root has two solutions. This gives us:
time = money
_____
money = ± V evil
girls = time x money
girls = money x money
_____ _____
girls = ± V evil x ± V evil
girls = ± evil
This is closer to the real world, in that:
- Money may be either positive (credit) or negative (debit)
- Some girls are good
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Greg Utas wrote: Given these truths:
o Time is money.
o Money is the root of all evil.
o Girls cost time and money.
Time is worth far more than money ( money can't ( always ) buy me time )
"_The love of_" money is the root of all evil. ( Actually, I'd say power(?) domination(??) )
Proposition 3 I won't touch.
|
|
|
|
|
Mine, and I have not completed it after a few years.. :/
Is to do 2D shape (bordered by bezier line) intersection...
|
|
|
|
|
honey the codewitch wrote: Mine is implementing a 2D polygon fill algorithm Are you saying that the most complex algorithm you've ever implemented is a depth-first/breadth-first traversal? Or am I misunderstanding something. I glanced through your latest articles but didn't see anything mentioned.
I guess the most complicated I've dealt with is noisy sparse signals recovery using Kalman filter[^] variants while I was working at Marine Technologies[^] circa ~2006. Kalman wasn't even the hard part... the underlying Gaussian mixture model[^] was where all the magic really happens. The reason it's considered difficult is because it's an approximation and there is always a better approximation to be found. We had to hire a mathematics professor from Norway as a consultant to help. Math is hard.
Best Wishes,
-David Delaune
|
|
|
|
|
It's just not depth first or breadth first traversal - that part is easy. I think you're thinking of a flood fill algorithm, which won't work on a write only device because you need to read the pixel data. It also won't work if you try to draw a filled polygon over existing draws.
What I need to do for example:
_/\_
\__/
Say that's my poly
here /\ I need to go top to bottom, left to right from the beginning of each point of the left line to each point on the right line, across.
I also need to sort the points so I can figure out where to start drawing.
Real programmers use butterflies
modified 30-May-21 6:06am.
|
|
|
|
|
Hi,
A few more questions;
1.) Does your algorithm support polygons with holes[^]?
2.) Did you invent something new or implement an existing algorithm?
3.) Where can I find your work? I'd like to look at it.
Best Wishes,
-David Delaune
|
|
|
|
|
1. Heck no!*
2. I haven't been able to implement the algorithm. It is described at tutorialspoint somewhere but no implementation
3. I'll publish it here when I solve it.
Sorry if my OP implied I solved it. I did not mean to. If I had solved it I'd have found something else to get stuck on by now.
* adding, there's no way to even describe it with my API, except you should be able to approximate any polygon with holes by one without one that loops back on itself - as long as it's filled you won't be able to tell the difference.
Real programmers use butterflies
|
|
|
|
|
I just figured out a much easier way in theory to do it. Just scale the thing smaller and smaller by 1 pixel in any direction and keep redrawing it until you get down to a single point.
Unfortunately, in practice this won't work - the way the bresenham line drawing algo works it will leave little holes in the result. *sadface*
Real programmers use butterflies
|
|
|
|
|
Well,
That doesn't really make any sense. I don't understand the technical issues you are encountering. Drawing, filling and scaling 2D polygons is exceedingly trivial.
Based on what you have said I see the following requirements:
1.) You are only supporting simple polygons[^].
2.) You need to write to the video device in a scanline pattern[^].
3.) You cannot read pixels.
4.) You have not stated why you can't draw in a frame buffer. But I will assume that you either can't or are unwilling.
So I don't think that you can use the Nonzero-rule[^].
But you could use the even–odd rule[^].
Some other things for you to read for scaling your polygons:
Dot product[^]
Best Wishes,
-David Delaune
|
|
|
|
|
You know I've even read about that technique years ago, and for some reason I completely overlooked it - it went down the memory hole.
I'm not entirely sure even-odd will work until I try it, but I'll certainly try it.
Thanks in advance, even if it leaves me feeling like a bit of an idiot. I'll take it if it means a solution.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: it leaves me feeling like a bit of an idiot You are obviously not an idiot, but rather experimenting with geometry and probably never looked here before. Everyone is clueless when they poke around in an unfamiliar topic. Everybody is standing on the shoulders of giants and very rarely do you find a human that generates something new. That's why I wanted to see what you created, I wanted to see if it was something new.
Anyway, I forgot to mention why you probably can't use the nonzero-rule. It works by summing the angles which means it would need to use a minimum of 3 rows. The even–odd rule would allow you to cast a single photon (ray of light) across one scanline and simply check for even/odd values.
I would recommend testing this stuff on your desktop and get out of that restrained environment during the test development.
Good luck,
-David Delaune
|
|
|
|
|
Randor wrote: I would recommend testing this stuff on your desktop and get out of that restrained environment during the test development.
That's actually part of why I wrote GFX to be runnable anywhere. I didn't want to develop it on a constrained environment. But it has to run on them.
My initial GFX library dumped its output solely using printf() and drawing ascii art after converting bitmaps to 16 color grayscale.
I used that to test my line drawing algorithms and such.
But now that all of that is done and pretty predictable, I find myself going back to the PC to code this thing less and less, either because I'm dealing with things like asynchronous draws which have no support on the PC, or most of what I'm doing works the first time or two after it compiles because i've built the foundation up by now enough that the coding is fairly high level.
Real programmers use butterflies
|
|
|
|