🙄Разминка для ума!
Треугольник Серпинского, интересная фигура которую построить достаточно просто.
Алгоритм такой:
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
The Kennedy Center Would Limit Voting to Trump-Appointed Trustees
The Kennedy Center reportedly adopted bylaws earlier this year that would limit voting to Trump-appointed trustees – a controversial move that appears to reveal the long-held plan to install Trump’s name to the center.
The bylaws, in a possible breach of the institution’s charter, were revised in May and specified that board members appointed by Congress, known as ex-officio members, could not vote or count towards a quorum, according to the Washington Post.
The new rule was in force when the board voted unanimously on 18 December to add Trump’s name to the center, rebranding the building as the Trump and the JFK Memorial Center for the Performing Arts.
The name change has since triggered a wave of protests. Artists have cancelled bookings and members of Congress have vowed to overturn the name change.
Joyce Beatty, a Democrat from Ohio, is even suing to reverse it on the grounds that changing the center’s name requires an act of Congress.
Trump took over as chair of the board in February, quickly purging sitting members, while installing his supporters – including his longtime foreign policy adviser Ric Grenell, whom he appointed as president of the center.
Grenell had been a vocal tribune of Trump’s “America First” ideology, and was not afraid to ruffle feathers during past spells as ambassador to Germany and acting director of national intelligence (he was the first openly gay person to lead the intelligence community).
Just prior to his Kennedy Center appointment, Grenell served as the president’s envoy for special missions, and was involved in securing the release of Americans detained in Venezuela.
The center lists 34 presidentially appointed board members and 23 ex-officio members, who by law must include the mayor of Washington DC, head of the library of Congress, and the majority and minority leaders of the Senate.
The federal law underpinning the center’s establishment identified ex-officio members as among the venue’s trustees, charged with maintaining it as a memorial to John F Kennedy, the Post reported.
Roma Daravi, the center’s vice-president for public relations, told the Post that the rules had been changed in line with longstanding convention that ex-officio members did not vote:
“The bylaws were revised to reflect this longstanding precedent and everyone received the technical changes both before the meeting and after revisions.”
Daravi continued: “Some members attended in person, others by phone, and no concerns were voiced, no one objected, and the bylaws passed unanimously.”
Ellen Aprill, a legal scholar at UCLA, told the paper that such voting right limits breached the center’s charter.
“Clearly the intent of the charter provisions was to entrust Kennedy Center guidance to a broad group, not just those appointed by the president,” she said.
The disclosure comes as new figures showed a sharp fall in television ratings for this year’s Kennedy Center honors awards.
A record low audience of 3.01m watched this year’s broadcast of the annual honors awards – hosted by Trump himself – when it was screened by CBS, marking a stark 25% downturn from last year.
The event included appearances from some of Trump’s favorite artists, including Gloria Gaynor, Kiss and George Strait.
As artists cancel bookings, Trump on social media on Tuesday posted a string of statements from supporters criticizing the Kennedy family’s supposed lack of support for the center.
His posts on his Truth Social network started mere hours after the Kennedy family announced the death of Tatiana Schlossberg, JFK’s granddaughter, who died aged 35, from leukemia.
#kennedy#center#limit#trump#trustees
📱American Оbserver - Stay up to date on all important events
🇺🇸