🙄Разминка для ума!
Треугольник Серпинского, интересная фигура которую построить достаточно просто.
Алгоритм такой:
1. создаём любые 3 точки на плоскости
2. из этих точек случайно выбираем любую, как начальную
3. случайно выбираем любую точку из этих же трёх точек как цель
4. перемещаемся в сторону цели на половину расстояния
5. повторяем бесконечно с пункта 3
Если сделать достаточно много итераций то вырисовывается интересная фигура. Треугольник, в который вписаны более мелкие треугольники. Это самый настоящий фрактал!
Я собрал пример построения такой фигуры на базе Qt.
🌎 Код можно посмотреть здесь.
С помощью paintEvent я рисую точки по озвученному алгоритму. Каждые 10 секунд либо по клику на виджете строится следующий треугольник.
Особенности примера:
🔸 Атрибут Qt.WA_OpaquePaintEvent позволяет сохранить то, что было нарисовано в прошлой итерации. Таким образом мы видим постепенное наполнение точек а не мелькающую одну точку.
🔸QTimer позволяет создавать отложенные вызовы один раз или с повторением через интервал.
🔸QColor.fromHsv() позволяет создать рандомный но предсказуемый цвет с помощью HSV схемы. Не слишком светлый и не слишком тёмный но всегда с разный. Рандомизации подвергается только смещение по цветовому кругу (Hue), яркость (Value) и насыщенность (Saturation) можно контролировать отдельно в своих пределах или оставить статичными. Обычный рандом цвета по RGB не даёт такой предсказуемый результат.
🔸 Каждый новый цикл с новым треугольником предварительно затемняет предыдущие через этот вызов
painter.fillRect(rec, QColor(0, 0, 0, 100))
То есть полупрозрачный цвет. Таким образом, чем старше треугольник, тем он темней.
Если сделать виджет фулскрин, то у нас получится некий ScreenSaver)))
🔸 Да, я знаю, что рисование в Qt не самый лучший способ сделать этот пример) Скорее всего самый НЕподходящий. Попробуйте сделать тоже самое но другими средствами.
#qt#source#tricks
Tech quiz master
#phone
ℹ️ Ham IT ni ham ingliz tilini o'rganaman deganlar uchun mobil dastur (android). Ancha vaqtlar bu dastur pullik edi, bugun bepul turibdi!
✅ Ushbu dasturda turli darajalarda IT va kompyuter sohasiga oid testlarni ishlaysiz. Faktlar bo'limida esa faktlarni ko'rishingiz mumkin.
⬇️Play Marketdan yuklash
💻 Kompyuterni birga o'rganamiz ⤵️
🛫Telegram I 📺YouTube
Red
Redirect outgoing calls to Signal/Telegram/Threema.
Tiny app to redirect outgoing calls to Signal/Telegram/Threema if available.
You can cancel redirection by clicking on "Redirecting to.." popup.
Download - https://github.com/x13a/Red/releases
https://github.com/x13a/Red
#new#phone
@foss_Android
UNIWA X28 Old Man Flip #Mobile#Phone GSM Senior Big Push-Button Flip Phone Dual Sim FM Radio
Price 24€
Place your order
https://s.click.aliexpress.com/e/_EwCPskl
#bootloader unlock wall of shame
https://github.com/melontini/bootloader-unlock-wall-of-shame
updated guide, check it before buying a #phone
Over the past few years, a suspicious number of companies have started to "take care of your data", aka block/strictly limit your ability to unlock the bootloader on your own devices.
While this may not affect you directly, it sets a bad precedent. You never know what will get the axe next: Shizuku? ADB? Sideloading? I thought it might be a good idea to keep track of bad companies and workarounds.
#android
🪫🔋RealMe presented the world's fastest charger. Charge up to 26% in 1 minute. Full charge up to 100% in 4 minutes and 30 seconds.
#Realme#Charger#Phone
MARKHEMIST
#phone#art
#wallpaper#wallpapers
Wallpaper
https://t.me/Wallpaper
HD-4K-8K-3D
https://t.me/wallpapers
wallpapers
https://t.me/EZwalls
Mobile phone
https://t.me/Wallpapers_Phone_HD_4k_3D_Mobile
smart paper art
https://t.me/swadt
Residents report #phone, #internet#outages in #North_Shewa Zone, leaving families struggling to stay connected
Residents in several districts of North Shewa Zone of the #Oromia region say recent disruptions to mobile phone and internet services have left families unable to communicate, heightening concerns among civilians and students struggling to reach relatives in affected areas.
Residents who spoke to Addis Standard said the communication disruption began weeks ago and has made it difficult to obtain information about the safety and well-being of family members.
This is not the first time communication blackouts have affected the North Shewa Zone. In 2024, residents also reported data outages and network disruptions across parts of the zone in the Oromia region, with some saying the communication blackout persisted for nearly two months amid ongoing insurgency-related security concerns.
https://addisstandard.com/?p=55093