File:Mandelbrot Set Color Cycling Animation 600px 7.gif

Captions
Captions
Summary
[edit]| DescriptionMandelbrot Set Color Cycling Animation 600px 7.gif |
Русский: Участок множества Мандельброта
Координаты: -0.1634198884574723 1.0978411602700539 Ширина изображения: 0.0000000000000029English: The piece of Mandelbrot Set
Coordinates: -0.1634198884574723 1.0978411602700539 Width: 0.0000000000000029 |
| Date | |
| Source | Own work |
| Author | Aokoroko |
| Other versions |
|
| Source code (C++ with OpenMP, 80-bit, SSAA 8x8) InfoField |
#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
#include <cstdint>
#include <string>
#include <atomic>
#include <omp.h>
#include <cstdio>
using namespace std;
const double PI = 3.14159265358979323846;
#pragma pack(push, 1)
struct BMPHeader {
uint16_t type{0x4D42};
uint32_t size{0};
uint16_t reserved1{0};
uint16_t reserved2{0};
uint32_t offBits{54};
uint32_t structSize{40};
int32_t width{0};
int32_t height{0};
uint16_t planes{1};
uint16_t bitCount{24};
uint32_t compression{0};
uint32_t sizeImage{0};
int32_t xpelsPerMeter{2834};
int32_t ypelsPerMeter{2834};
uint32_t clrUsed{0};
uint32_t clrImportant{0};};
#pragma pack(pop)
void save_bmp(const string& filename, const vector<uint8_t>& data, int w, int h) {
int rowSize = (w * 3 + 3) & ~3;
BMPHeader header;
header.width = w;
header.height = h;
header.sizeImage = rowSize * h;
header.size = header.sizeImage + 54;
ofstream f(filename, ios::binary);
f.write(reinterpret_cast<char*>(&header), 54);
f.write(reinterpret_cast<const char*>(data.data()), data.size());
f.close();}
int main() {
long double absc = -1.749675773048651182L;
long double ordi = -0.000001140170813768L;
long double size_val = 0.0000000000000021L;
const int targetW = 3840;
const int targetH = 3840;
const int scale = 8;
const int rawW = targetW * scale;
const int rawH = targetH * scale;
cout << "Step 1: Calculating Raw Map (" << rawW << "x" << rawH << ")..." << endl;
vector<uint8_t> iterMap(rawW * rawH);
long double step = size_val / rawW;
long double startX = absc - (size_val / 2.0);
long double startY = ordi - (step * rawH / 2.0);
atomic<int> linesDone{0};
#pragma omp parallel for schedule(dynamic)
for (int b = 0; b < rawH; ++b) {
for (int a = 0; a < rawW; ++a) {
long double m = startX + a * step;
long double n = startY + b * step;
long double c = m, d = n, cc, dd;
int t = 50000;
do { cc = c * c; dd = d * d;
d = (c + c) * d + n;
c = cc - dd + m;
t--; } while (t > 0 && (cc + dd <= 50000.0));
if (t == 0) {
iterMap[b * rawW + a] = 255;} else {
iterMap[b * rawW + a] = (uint8_t)(t % 255); } }
if (++linesDone % 100 == 0) cout << "Progress: " << linesDone << "/" << rawH << "\r" << flush; }
uint8_t pal[256][3];
for (int a = 0; a < 255; ++a) {
pal[a][0] = (uint8_t)round(127 + 127 * cos(2 * PI * a / 255.0));
pal[a][1] = (uint8_t)round(127 + 127 * sin(2 * PI * a / 255.0));
pal[a][2] = (uint8_t)round(127 + 127 * sin(2 * PI * a / 255.0)); }
pal[255][0] = 255; pal[255][1] = 255; pal[255][2] = 255;
cout << "\nStep 2: Rendering frames..." << endl;
int rowSize = (targetW * 3 + 3) & ~3;
for (int frame = 0; frame < 255; ++frame) {
vector<uint8_t> frameData(rowSize * targetH);
#pragma omp parallel for schedule(static)
for (int y = 0; y < targetH; ++y) {
for (int x = 0; x < targetW; ++x) {
uint32_t rSum = 0, gSum = 0, bSum = 0;
for (int j = 0; j < scale; ++j) {
for (int i = 0; i < scale; ++i) {
uint8_t t = iterMap[(y * scale + j) * rawW + (x * scale + i)];
int colorIdx;
if (t == 255) { colorIdx = 255; } else { colorIdx = (t - frame + 255) % 255; }
bSum += pal[colorIdx][0];
gSum += pal[colorIdx][1];
rSum += pal[colorIdx][2]; } }
int outIdx = y * rowSize + x * 3;
frameData[outIdx + 0] = (uint8_t)(bSum >> 6);
frameData[outIdx + 1] = (uint8_t)(gSum >> 6);
frameData[outIdx + 2] = (uint8_t)(rSum >> 6); } }
string filename = "Mandelbrot" + to_string(1000 + frame).substr(1) + ".bmp";
save_bmp(filename, frameData, targetW, targetH);
cout << "Frame " << frame << "/254 saved. \r" << flush; }
return 0; }
|
Technical details
[edit]- Method: High-Fidelity C++ Implementation (80-bit long double precision).
- Anti-aliasing: 64x SSAA (8x8 supersampling).
- Iterations: 50,000 max.
- Software: C++ (compiled with g++), GNU C++ Compiler.
Notes
[edit]- Rosetta Code: https://rosettacode.org/wiki/Mandelbrot_set#High-Fidelity_C++_Implementation_(80-bit,_64x_SSAA,_OpenMP)
- github: https://github.com/Divetoxx/Mandelbrot
Licensing
[edit]| This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. | |
| The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
This image has been assessed using the Quality image guidelines and is considered a Quality image.
العربية ∙ جازايرية ∙ беларуская ∙ беларуская (тарашкевіца) ∙ български ∙ বাংলা ∙ català ∙ čeština ∙ Cymraeg ∙ Deutsch ∙ Schweizer Hochdeutsch ∙ Zazaki ∙ Ελληνικά ∙ English ∙ Esperanto ∙ español ∙ eesti ∙ euskara ∙ فارسی ∙ suomi ∙ français ∙ galego ∙ עברית ∙ हिन्दी ∙ hrvatski ∙ magyar ∙ հայերեն ∙ Bahasa Indonesia ∙ italiano ∙ 日本語 ∙ Jawa ∙ ქართული ∙ Qaraqalpaqsha ∙ 한국어 ∙ kurdî ∙ кыргызча ∙ Latina ∙ Lëtzebuergesch ∙ lietuvių ∙ македонски ∙ മലയാളം ∙ मराठी ∙ Bahasa Melayu ∙ Nederlands ∙ ਪੰਜਾਬੀ ∙ Norfuk / Pitkern ∙ polski ∙ português ∙ português do Brasil ∙ rumantsch ∙ română ∙ русский ∙ sicilianu ∙ slovenčina ∙ slovenščina ∙ shqip ∙ српски / srpski ∙ svenska ∙ தமிழ் ∙ తెలుగు ∙ ไทย ∙ Tagalog ∙ toki pona ∙ Türkçe ∙ українська ∙ oʻzbekcha / ўзбекча ∙ vèneto ∙ Tiếng Việt ∙ 中文 ∙ 中文(简体) ∙ 中文(繁體) ∙ +/− |
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Thumbnail | Dimensions | User | Comment | |
|---|---|---|---|---|---|
| current | 18:18, 16 March 2026 | 600 × 600 (31.71 MB) | Aokoroko (talk | contribs) | Red channel - sin 2π | |
| 16:58, 12 June 2025 | 600 × 600 (67.89 MB) | Aokoroko (talk | contribs) | Uploaded own work with UploadWizard |
You cannot overwrite this file.
File usage on Commons
The following 56 pages use this file:
- Fractal
- Mandelbrot set
- User:Aokoroko
- User talk:Aokoroko
- Commons:Quality images
- Commons:Quality images/Subject/Animated
- Commons:Quality images/Subject/Animated/Sample
- Commons:Quality images/ar
- Commons:Quality images/arz
- Commons:Quality images/bn
- Commons:Quality images/br
- Commons:Quality images/ca
- Commons:Quality images/cs
- Commons:Quality images/cy
- Commons:Quality images/da
- Commons:Quality images/de
- Commons:Quality images/el
- Commons:Quality images/en
- Commons:Quality images/en-ca
- Commons:Quality images/en-gb
- Commons:Quality images/es
- Commons:Quality images/eu
- Commons:Quality images/fa
- Commons:Quality images/fr
- Commons:Quality images/gl
- Commons:Quality images/gsw
- Commons:Quality images/hi
- Commons:Quality images/hr
- Commons:Quality images/id
- Commons:Quality images/it
- Commons:Quality images/ja
- Commons:Quality images/ko
- Commons:Quality images/krc
- Commons:Quality images/lt
- Commons:Quality images/mk
- Commons:Quality images/ml
- Commons:Quality images/ms
- Commons:Quality images/mwl
- Commons:Quality images/nan
- Commons:Quality images/nan-latn-tailo
- Commons:Quality images/ne
- Commons:Quality images/nl
- Commons:Quality images/oc
- Commons:Quality images/pl
- Commons:Quality images/ps
- Commons:Quality images/pt
- Commons:Quality images/ru
- Commons:Quality images/scn
- Commons:Quality images/sv
- Commons:Quality images/th
- Commons:Quality images/tr
- Commons:Quality images/uk
- Commons:Quality images/uz
- Commons:Quality images/vi
- Commons:Quality images/zh
- Commons:Quality images candidates/Archives September 30 2025
File usage on other wikis
The following other wikis use this file:
- Usage on en.wikipedia.org
- Usage on meta.wikimedia.org
- Usage on ru.wikipedia.org
- Usage on www.wikidata.org