🙄Разминка для ума!
Треугольник Серпинского, интересная фигура которую построить достаточно просто.
Алгоритм такой:
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
🌎 In the deep ocean, methane hydrate deposits form icy, flammable crystals that trap methane gas in water molecules. These deposits occur at high pressure and low temperature, mainly along continental margins, and may hold more carbon than all other fossil fuels combined. ✨
#ocean⚡#geology⚡#methane
👉subscribe Interesting Planet
👉more Channels
🌍 Global methane emissions from wetlands are rising due to warmer temperatures and increased rainfall. This powerful greenhouse gas traps far more heat than carbon dioxide in the atmosphere. ✨
#climate⚡#wetlands⚡#methane⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 In tundra regions, permafrost can sometimes trap ancient methane gas. When the ground thaws, bubbles of this gas may rise and burst at the surface, creating sudden pops in the landscape. ✨
#permafrost⚡#tundra⚡#methane⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌎 A layer of diamond rain may fall deep within Neptune and Uranus! Under immense pressure, methane breaks apart, causing carbon atoms to form glittering diamond crystals that drift towards the core. ✨
#planets⚡#diamonds⚡#methane
👉subscribe Interesting Planet
🌍 Melting permafrost in Arctic regions is releasing ancient greenhouse gases like methane, accelerating climate change and threatening traditional ways of life for local communities. ✨
#permafrost⚡#climate⚡#change⚡#methane⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌎 Every summer in Siberia, mysterious craters known as "Yamal holes" appear in the Arctic tundra. These giant pits, sometimes 20 meters wide, form when underground methane gas builds pressure and violently explodes through permafrost. Scientists have identified at least 17 such craters since 2014, linking them to warming temperatures and melting ice. ✨
#permafrost⚡#methane⚡#explosions
👉subscribe Interesting Planet
👉more Channels
🪐 Saturn’s moon Titan is one of the most intriguing places in the solar system where life could exist because it has lakes and rivers of liquid methane and ethane—chemicals similar to gasoline on Earth. While it’s far too cold for liquid water, scientists are captivated by the idea that life, if it ever formed there, would be fundamentally different from anything on our planet. ✨
#Titan⚡#methane⚡#habitability⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 Scientists have detected unusual patterns of methane gas in the atmosphere of Mars, with the Curiosity rover finding short-lived spikes near the Gale Crater. Since methane can be produced by both geological processes and living microbes, its mysterious appearance and disappearance on Mars keeps the search for alien life in our own solar system wide open. ✨
#Mars⚡#Curiosity⚡#methane⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
В журнале Electrochemical Materials and Technologies вышла обзорная работа "H/D exchange studies of methane activation mechanisms in heterogeneous catalysis"
🔗https://doi.org/10.15826/elmattech.2023.2.014
🔗https://journals.urfu.ru/index.php/elmattech/article/view/6883
В данном обзоре подробно рассматривается механизм конверсии метана и анализируются существующие теоретические и экспериментальные подходы к изотопному обмену H/D между метаном и каталитическими системами:
#CH4#methane#conversion#isotope#catalyst#bonds#homogeneous#exchange #