|
Are you sure it's a genuine SanDisk card? Was the seller reputable and unlikely also to have been naive enough to buy from a dodgy supplier?
You can definitely still buy micro SDs in the megabyte range. I got some the other month for around a dollar each for a uController project.
|
|
|
|
|
It was Canakit. I expect that they would be on the level. Though the card did come in a small antistatic bag, rather than on a SanDisk bubble-pack card. So maybe they purchased a bulk lot, with the odd one being bad, or mislabeled. Who knows? It doesn't really seem worth pursuing, its only a 16GB card, and I have several 32G cards available to me. For ~$7, its probably more than that in postage. At my hourly rate, I've probably spent more than that wingeing about it here ...
Keep Calm and Carry On
|
|
|
|
|
k5054 wrote: At my hourly rate, I've probably spent more than that wingeing about it here ...
I've often joked that I'm well within my rights to spend a week making a program that'll save me a few minutes each time I do a task.
|
|
|
|
|
At this point I would write to your supplier to notify them of the problem and use another card - they're cheap and ubiquitous.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Most likely, the SD card has the Linux OS on it already (Raspian), which means that the SD card is probably ok. Boot up on the SD card and log in. The user name should be pi and the password is raspberry. Once at the command prompt, type in sudo raspiconfig. Once there, go to the advanced options. There should be an option to expand the drive. It will utilize the rest of the 16gb space.
This is common with the Raspberry Pi, especially with the Cana Kit.
"When you are dead, you won't even know that you are dead. It's a pain only felt by others; same thing when you are stupid."
Ignorant - An individual without knowledge, but is willing to learn.
Stupid - An individual without knowledge and is incapable of learning.
Idiot - An individual without knowledge and allows social media to do the thinking for them.
modified 19-Nov-21 21:01pm.
|
|
|
|
|
Is the human that opens the cat food tin a purrson?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Merely a dispenser.
The less you need, the more you have.
Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?
JaxCoder.com
|
|
|
|
|
|
A subordinate claws?
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
The human is to err, as the cat is too purr-fection
|
|
|
|
|
I almost have my TTF rendering working but I've been banging my head against the wall because of this:
[Rendering of a "B"^]
Forgive the flat edges. I'm foregoing the "curving" process in order to debug.
I don't know what polygon fill algorithm I'm supposed to be using but apparently even/odd w/ winding isn't working, and that's by far the most common, including (i believe) the one .NET uses for drawing.
I am terrible at sifting through documentation. I'm a bit better at sifting through code to a point.
This project might be derailed entirely and that's super frustrating because I put a ton of work into it already and the problem visually is somewhat minor compared to the scope of the problem. It also only happens on certain letters (I think ones with multiple "holes")
I don't deal with failure well, which sometimes serves me because it helps me commit to succeeding, but it's hard to know when to throw in the towel.
Real programmers use butterflies
|
|
|
|
|
I once played with FreeType, it has a rendering library in code (to learn from) - no documentation
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
I know, I've been tinkering with freetype myself trying to integrate it because that was my plan A.
However, the way they coded it, integration into Arduino projects is - while not impossible - really a pain because you have to compile a static lib for each different platform you plan to target.
All that because you can't build from source by including it in a larger project, and no tools (PlatformIO/Arduino IDE) support building a project as two separate projects and then linking them together. =(
I am trying to understand how freetype renders but the code is a zoo.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: but the code is a zoo To many people worked on it over time - however my part is crystal clear
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
|
No I think missed it in the fray as I was neck deep in half a dozen different things. I'll follow the link. Thanks!
Real programmers use butterflies
|
|
|
|
|
I just looked at that wiki entry you pointed me to. It looks like that would solve it but I don't know how to do it yet. Sally forth! Onward to google!
Thank you so much for your comment. I didn't mean to ignore your tip from before, I think I just got buried.
Real programmers use butterflies
|
|
|
|
|
You are welcome,
honey the codewitch wrote: Thank you so much for your comment. I couldn't help but notice that you checked in the sample code from wikipedia nearly verbatim. Your intersects_poly[^] function is a copy-paste from the even–odd rule[^] article that we discussed last month. Looks like it was checked in ~15 minutes after we discussed polygon intersections.
The nonzero-rule[^] will require either a frame buffer or some clever math to determine stroke direction.
Best Wishes,
-David Delaune
|
|
|
|
|
yeah, that was my starting point. I'll end up modifying it. I intend to modify it anyway to use horizontal run-lengths to speed up drawing.
Real programmers use butterflies
|
|
|
|
|
I don't necessarily have read/a framebuffer on all my devices, but I do have it on e-paper devices.
However, in order to make this work for all devices I'll need to probably need to do that clever math, or draw the characters to an intermediary bitmap, which I don't want to do since then memory usage is tied to character size and I run into issues where characters somewhat overlap or otherwise connect with each other (think a cursive font) - because what I've noticed is characters in TTF can overhang their effective bounding box.
I'm wondering - if I draw in order, can't i determine the stroke direction by looking at previous points?
I guess I need to understand the algorithm better.
Real programmers use butterflies
|
|
|
|
|
Well,
Might be easier to find using the math term. I guess only software engineers would call it 'The non-zero rule.'
The math terminology you are looking for is contour winding numbers[^].
Winding number - Wikipedia[^]
I don't expect that you would be interested in this... but the same algorithm software engineers call 'the non-zero rule ' is the same algorithm Ed Witten used in the 1990's for exploring Calabi–Yau manifolds[^]. Today that work is known as T-duality[^].
There are hundreds C/C++ of examples of this algorithm on the internet. Just google for 'winding number algorithm'.
Best Wishes,
-David Delaune
|
|
|
|
|
I found this:
Point in polygon - Wikiwand[^]
Which led me here: Geometry Algorithms TOC[^]
Which led me to some code, but I think i'm looking at the wrong routine because when I implemented theirs I get the same dodgy result I do when I use .NET's FillPolygon() or when I use my own even-odd method in C++ (picture of the result in the original post)
int
wn_PnPoly( Point P, Point* V, int n )
{
int wn = 0;
for (int i=0; i<n; i++) { if (V[i].y <= P.y) { if (V[i+1].y > P.y) if (isLeft( V[i], V[i+1], P) > 0) ++wn; }
else { if (V[i+1].y <= P.y) if (isLeft( V[i], V[i+1], P) < 0) --wn; }
}
return wn;
}
That's from the book, but I reimplemented it in C# with my C# version of my TTF renderer, so I'm still digging, but I've maybe made some progress..
ETA: I should note while you may not be familiar with this variant of the winding algorithm depending on the last time you had to do this, in the first link it's covered here:
Quote: There is a significant speed-up (known since 2001) of the winding number algorithm. It uses signed crossings, based on whether each crossing is left-to-right or right-to-left. Details and C++ code are given at the link in the following annotation .[6] Angles are not used, and no trigonometry is involved. The code is as fast as the simple boundary crossing algorithm. Further, it gives the correct answer for nonsimple polygons, whereas the boundary crossing algorithm fails in this case.
Real programmers use butterflies
modified 5-Jul-21 15:17pm.
|
|
|
|
|
|
Here's a link to a repo in C#. I have something in C++ but you'll be buried in abstractions if I share it.
GitHub - codewitch-honey-crisis/Ttf[^]
The pertinent code is all in Main.cs
_poly contains a list of points to draw. Because of the needs of the winding algorithm, I close the polygon as the final point (it points to the same point as the first point). That happens in Main's constructor.
The constructor takes a glyph that I've loaded from a ttf and turns it into a bunch of "GlyphPoint" entries, which the ctor turns into Point objects. There's an extra member on GlyphPoint but I'm not using it in this case. It's for rounding the edges of the polygons.
Real programmers use butterflies
|
|
|
|
|
I got the exact same result with the PNPOLY algorithm. I'm starting to think there's some kind of problem with how I'm building the final points of my glyph? I don't know. *scratches head* I'm kind of clueless right now.
static bool IsInsidePolygon2(Point P, Point[] V)
{
int i, j;
bool c = false;
for(i=0,j=V.Length-1;i<V.Length; j=i++)
{
Point pti = V[i];
Point ptj = V[j];
if (((pti.Y > P.Y) != (ptj.Y > P.Y)) &&
(P.X < (ptj.X - pti.X) * (P.Y - pti.Y) / (ptj.Y - pti.Y) + pti.X))
c = !c;
}
return c;
}
Real programmers use butterflies
|
|
|
|