<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[Anfänger] Apfelmännchen]]></title><description><![CDATA[<p>Hallo, ich habe die aufgabe gestellt bekommen diese Mandelbrotmenge zu zeichnen in einem Intervall (-2,1) und (-1.5,1.5). Nun habe ich mich da eingelesen und hab so in etwa verstanden welche bedingungen erfüllt werden müssen, damit noch eine komplexe Zahl zu der Menge gehört.</p>
<p>Was ich allerdings nicht verstehe bzw wovon ich garkeine ahnung habe, ist wie man bei C++ Bilder plottet oder einzelne Pixels im Bild setzt. Gibt es irgendwo etwas dazu nachzulesen? Ich wollte, bevor ich überhaupt mit der aufgabe anfange, erstmal sowas wie einen kreis oder linie überhaupt zeichnen können.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/304904/anfänger-apfelmännchen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 04 Aug 2026 21:19:28 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/304904.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 16 Jun 2012 17:09:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Sat, 16 Jun 2012 17:09:53 GMT]]></title><description><![CDATA[<p>Hallo, ich habe die aufgabe gestellt bekommen diese Mandelbrotmenge zu zeichnen in einem Intervall (-2,1) und (-1.5,1.5). Nun habe ich mich da eingelesen und hab so in etwa verstanden welche bedingungen erfüllt werden müssen, damit noch eine komplexe Zahl zu der Menge gehört.</p>
<p>Was ich allerdings nicht verstehe bzw wovon ich garkeine ahnung habe, ist wie man bei C++ Bilder plottet oder einzelne Pixels im Bild setzt. Gibt es irgendwo etwas dazu nachzulesen? Ich wollte, bevor ich überhaupt mit der aufgabe anfange, erstmal sowas wie einen kreis oder linie überhaupt zeichnen können.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2223952</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2223952</guid><dc:creator><![CDATA[Namal]]></dc:creator><pubDate>Sat, 16 Jun 2012 17:09:53 GMT</pubDate></item><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Sat, 16 Jun 2012 17:14:40 GMT]]></title><description><![CDATA[<p>Grafiken kann man mit Standart C++ nicht Zeichnen, da musst du auf die API von deinem Betriebbsystem zugreiffen.</p>
<p>Du könntest dir auch eine passende Grafik Bibliothek herunterladen, im Spiele Bereich hier im Forum da wird für 2D Spiele öfters die SDL empfohlen.</p>
<p><a href="http://www.libsdl.org/" rel="nofollow">http://www.libsdl.org/</a> &lt;-- Da findest du die SDL.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2223954</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2223954</guid><dc:creator><![CDATA[Banause]]></dc:creator><pubDate>Sat, 16 Jun 2012 17:14:40 GMT</pubDate></item><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Sat, 16 Jun 2012 17:15:37 GMT]]></title><description><![CDATA[<p>Standard-C++ kennt keine Grafikausgabe. Nimm die API deines Systems, z.B. die WinAPI. Erstell dort ein Fenster und bei WM_PAINT zeichneste dann. Gibt's genug Tutorials für. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2223956</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2223956</guid><dc:creator><![CDATA[cooky451]]></dc:creator><pubDate>Sat, 16 Jun 2012 17:15:37 GMT</pubDate></item><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Sat, 16 Jun 2012 17:25:28 GMT]]></title><description><![CDATA[<p>Nun ich kenn mich einigermaßen mit gnuplot aus. Könnte ich die einzelne Koordinaten in eine Textdatei speichern und sie dan mit gnuplot darstellen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2223961</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2223961</guid><dc:creator><![CDATA[Namal]]></dc:creator><pubDate>Sat, 16 Jun 2012 17:25:28 GMT</pubDate></item><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Sat, 16 Jun 2012 17:28:29 GMT]]></title><description><![CDATA[<p>Namal schrieb:</p>
<blockquote>
<p>Nun ich kenn mich einigermaßen mit gnuplot aus. Könnte ich die einzelne Koordinaten in eine Textdatei speichern und sie dan mit gnuplot darstellen?</p>
</blockquote>
<p>gnuplot kennt sogar eine Direktanbindung an ein Programm per Bibliothek. Jedoch ist es immer noch ein Plotprogramm und nicht dazu gedacht, die Grafikausgabe eines Programms zu ersetzen. Der Versuch wird zu nichts brauchbarem führen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2223962</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2223962</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sat, 16 Jun 2012 17:28:29 GMT</pubDate></item><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Sat, 16 Jun 2012 17:38:34 GMT]]></title><description><![CDATA[<p>Ok, könnt ihr mir dann ein tutorial empfehlen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2223966</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2223966</guid><dc:creator><![CDATA[Namal]]></dc:creator><pubDate>Sat, 16 Jun 2012 17:38:34 GMT</pubDate></item><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Tue, 06 Nov 2012 14:32:17 GMT]]></title><description><![CDATA[<p>Hallo, hab die Frage jetzt im Grafikunterforum gestellt, aber dort antwortet mir leider niemand. Also ich habe das mit Hilfe von glut so versucht:</p>
<pre><code>#include &lt;GL/glut.h&gt; 

double MinRe = -2.0; 
double MaxRe = 1.0; 
double MinIm = -1.2; 
double MaxIm = MinIm+(MaxRe-MinRe); 
double Re_factor = (MaxRe-MinRe)/(399); 
double Im_factor = (MaxIm-MinIm)/(399); 
unsigned MaxIterations = 100; 

void draw() 
{ 

   glClear(GL_COLOR_BUFFER_BIT ); 
   //Draw order 

   glBegin(GL_POINTS); 

         for(unsigned y=0; y&lt;400; ++y) 
   { 
     double c_im = MinIm + y*Im_factor; 
     for(unsigned x=0; x&lt;400; ++x) 
     { 
         double c_re = MinRe + x*Re_factor; 

         double Z_re = c_re, Z_im = c_im; 
         bool isInside = true; 
          int k=0; 
         for(unsigned n=0; n&lt;MaxIterations; ++n) 
         { 

             double Z_re2 = Z_re*Z_re, Z_im2 = Z_im*Z_im; 
             if(Z_re2 + Z_im2 &gt; 4) 
             { 
                 isInside = false; 
                 break; 
             } 
             Z_im = 2*Z_re*Z_im + c_im; 
             Z_re = Z_re2 - Z_im2 + c_re; 
             k++; 
         } 
         if(isInside) 
                     {   
                        float col=(100-k)/100.0; 
                        glColor3f(col,col,col); 
                        glVertex2f(x,y); 
                     } 
     } 
} 

   glEnd(); 

   glFlush(); 
} 

//Main program 
int main(int argc, char **argv) 
{ 
   glutInit(&amp;argc, argv); 
   //Simple buffer 
   glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB ); 
   glutInitWindowPosition(400,50); 
   glutInitWindowSize(400,400); 
   glutCreateWindow(&quot;new window&quot;); 
   glClearColor(1,1,1,1); 

   glMatrixMode(GL_PROJECTION); 
   glLoadIdentity(); 
   glOrtho(0.0,400.0,0.0,400.0,-1.0,1.0); 

   glutDisplayFunc(draw); 
   glutMainLoop(); 
   return 0; 
}
</code></pre>
<p>Aber es scheint so, dass die Abhängigkeit von der Anzahl der Schritte nicht dargestellt wird und ich verstehe leider nicht warum. Es ist doch richtig, dass wenn ich col = 0 habe, dann schwarz bekomme und bis col = 1 die Graustufen bis weiß, aber es scheint so zu sein, dass der Zähller immer die Maximale anzahl erreicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268135</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268135</guid><dc:creator><![CDATA[Namal]]></dc:creator><pubDate>Tue, 06 Nov 2012 14:32:17 GMT</pubDate></item><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Tue, 06 Nov 2012 13:58:01 GMT]]></title><description><![CDATA[<p>Alternativ zur Live-Anzeige kannst du auch einfach ein Bild abspeichern. Ein recht einfaches Format ist PGM. Da gibt es auch eine ASCII-Text-Version von:</p>
<pre><code>P2    # P2 -&gt; ASCII-Graustufenbild
10 5  # Breite und Hoehe
9     # maximaler Intensitaetswert
0 0 0 0 0 9 0 0 0 0
0 2 4 2 0 0 9 0 0 0
0 4 8 4 0 0 0 9 0 0
0 2 4 2 0 0 0 0 9 0
0 0 0 0 0 0 0 0 0 9
</code></pre>
<p>Das als .pgm abspeichern und freuen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268140</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268140</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Tue, 06 Nov 2012 13:58:01 GMT</pubDate></item><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Tue, 06 Nov 2012 13:48:27 GMT]]></title><description><![CDATA[<p>Namal schrieb:</p>
<blockquote>
<pre><code class="language-cpp">if(isInside) 
{   
  float col=(100-k)/100.0;
  fprintf(stdout, &quot;k: %d, glcolor3f(%f,%f,%f)\n&quot;, k, col, col, col);
  glColor3f(col,col,col); 
  glVertex2f(x,y);
</code></pre>
</blockquote>
<p>Wenn ich mir an dieser Stelle eine Testausgabe einbaue, ist k konstant(=100) und col damit auch(=0.0). Das ist wohl nicht so gewollt, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268145</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268145</guid><dc:creator><![CDATA[Furble Wurble]]></dc:creator><pubDate>Tue, 06 Nov 2012 13:48:27 GMT</pubDate></item><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Tue, 06 Nov 2012 14:34:58 GMT]]></title><description><![CDATA[<p>Furble Wurble schrieb:</p>
<blockquote>
<p>Das ist wohl nicht so gewollt, oder?</p>
</blockquote>
<p>Genau! Das verstehe ich nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268164</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268164</guid><dc:creator><![CDATA[Namal]]></dc:creator><pubDate>Tue, 06 Nov 2012 14:34:58 GMT</pubDate></item><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Tue, 06 Nov 2012 14:41:58 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">if(!isInside)
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2268168</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268168</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Tue, 06 Nov 2012 14:41:58 GMT</pubDate></item><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Tue, 06 Nov 2012 16:01:46 GMT]]></title><description><![CDATA[<p>MFK schrieb:</p>
<blockquote>
<pre><code class="language-cpp">if(!isInside)
</code></pre>
</blockquote>
<p>BAAAAH. ICh kapier es nicht. Warum funktioniert es so aber andersrum nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268196</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268196</guid><dc:creator><![CDATA[Namal]]></dc:creator><pubDate>Tue, 06 Nov 2012 16:01:46 GMT</pubDate></item><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Tue, 06 Nov 2012 17:01:43 GMT]]></title><description><![CDATA[<pre><code>if(isInside) 
                     {   
                        float col=0; 
                        glColor3f(col,col,col); 
                        glVertex2f(x,y); 
                     } 
if(!isInside) 
                     {   
                        float col=(100-k)/100.0; 
                        glColor3f(col,col,col); 
                        glVertex2f(x,y); 
                     }
</code></pre>
<p>Danke MFK...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268197</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268197</guid><dc:creator><![CDATA[Namal]]></dc:creator><pubDate>Tue, 06 Nov 2012 17:01:43 GMT</pubDate></item><item><title><![CDATA[Reply to [Anfänger] Apfelmännchen on Tue, 06 Nov 2012 17:49:42 GMT]]></title><description><![CDATA[<p>Namal schrieb:</p>
<blockquote>
<p>Warum funktioniert es so aber andersrum nicht?</p>
</blockquote>
<p>k zeigt an, nach wievielen Iterationen deine Schleife abgebrochen wurde. Den Abbruch signalisierst du, indem du isInside auf false setzt. Die interessanten Werte stehen also dann in k, wenn isInside false ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268281</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268281</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Tue, 06 Nov 2012 17:49:42 GMT</pubDate></item></channel></rss>