<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: City In a Intensity Graph in BreakPoint</title>
    <link>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4377113#M33876</link>
    <description>&lt;P&gt;I have the nagging feeling that the entire thing could be done entirely in blue (no orange wires!), but I have not tried.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jun 2024 16:45:27 GMT</pubDate>
    <dc:creator>altenbach</dc:creator>
    <dc:date>2024-06-05T16:45:27Z</dc:date>
    <item>
      <title>City In a Intensity Graph</title>
      <link>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4375000#M33850</link>
      <description>&lt;P&gt;&lt;SPAN&gt;This weekend I was so excited when I saw this js code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;for(c.width=w=99,++t,i=6e3;i--;c.getContext`2d`.fillRect(i%w,i/w|0,1-d*Z/w+s,1))for(a=i%w/50-1,s=b=1-i/4e3,X=t,Y=Z=d=1;++Z&amp;lt;w&amp;amp;(Y&amp;lt;6-(32&amp;lt;Z&amp;amp;27&amp;lt;X%w&amp;amp;&amp;amp;X/9^Z/8)*8%46||d|(s=(X&amp;amp;Y&amp;amp;Z)%3/Z,a=b=1,d=Z/w));Y-=b)X+=a&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;(It is originally from &lt;A href="https://frankforce.com/city-in-a-bottle-a-256-byte-raycasting-system/" target="_self"&gt;City In A Bottle – A 256 Byte Raycasting System&lt;/A&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So, I spent some time today to recreate it in LabVIEW:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CityInBottleSnippet.png" style="width: 961px;"&gt;&lt;img src="https://ip1.i.lithium.com/cf80c344ef6fd16e33d137e41216ca14048c8b59/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33333334373269383030414434464333454634453434312f696d6167652d73697a652f6c617267653f763d76322670783d393939" role="button" title="CityInBottleSnippet.png" alt="CityInBottleSnippet.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Because such ray tracing with relatively few operations looks like magic to me:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cityinbottle.gif" style="width: 825px;"&gt;&lt;img src="https://ip1.i.lithium.com/af9aa5e50c84da9862c12fb977f2c4f3b931420f/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33333334373369434141303235383246433745334642352f696d6167652d73697a652f6c617267653f763d76322670783d393939" role="button" title="cityinbottle.gif" alt="cityinbottle.gif" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;There may be some kinds of Rube Goldberg Code here, but it works at least. By the way, JavaScript is slightly different from the C Programming Language in terms of Operator Precedence and also logical operators' behaviors. Most of the time was spent converting this piece of code from JS to C (I learned some new old things, and I can recommend this exercise for everyone). Once it was successfully executed in C, it was more or less trivial to port it to LabVIEW. Sorry for the slightly messy diagram; I would like to see the whole thing on the same BD snipet without SubVIs. Feel free to modify or improve it, of course. Enjoy!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 26 May 2024 13:19:15 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4375000#M33850</guid>
      <dc:creator>Andrey_Dmitriev</dc:creator>
      <dc:date>2024-05-26T13:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: City In a Intensity Graph</title>
      <link>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4375018#M33851</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/7545"&gt;@Andrey_Dmitriev&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt; Feel free to modify or improve it, of course. Enjoy!&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Very nice!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What immediately comes to mind of course is that all controls belong outside the FOR loop stack. It is more effort if the compiler must assume that they can change midstream instead of allowing constant folding for the duration of the loop stack. It also makes the code cleaner to read if all control terminal are in one location instead of scattered all over the diagram.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wasn't aware that bitwise operations on DBL coerce to I32. Seems somewhat random.... &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 26 May 2024 18:23:38 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4375018#M33851</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2024-05-26T18:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: City In a Intensity Graph</title>
      <link>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4375378#M33853</link>
      <description>&lt;P&gt;That ... is awesome!&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2024 15:31:52 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4375378#M33853</guid>
      <dc:creator>Yamaeda</dc:creator>
      <dc:date>2024-05-28T15:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: City In a Intensity Graph</title>
      <link>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4375396#M33854</link>
      <description>&lt;P&gt;Yeah that is pretty cool. Sometimes intense math stuff like this blows my mind.&amp;nbsp; Early video game developers, and demo scene people are wizards with this type of stuff.&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2024 16:46:58 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4375396#M33854</guid>
      <dc:creator>Hooovahh</dc:creator>
      <dc:date>2024-05-28T16:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: City In a Intensity Graph</title>
      <link>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4375412#M33855</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/74523"&gt;@Hooovahh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Early video game developers, and demo scene people are wizards with this type of stuff.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Imagine having to program a (pseudo) 3D racing game on an &lt;A href="https://en.wikipedia.org/wiki/Master_System" target="_blank" rel="noopener"&gt;8bit 3.58Mhz processor with 8kB RAM&lt;/A&gt;, but they did it (&lt;A href="https://en.wikipedia.org/wiki/Master_System" target="_blank" rel="noopener"&gt;example&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then there is a full chess game that was running on a 4bit processor with 80bytes (No, not kbytes!) of RAM. (&lt;A href="https://forums.ni.com/t5/BreakPoint/Are-you-smarter-than-a-kilobyte-of-javascript-code/m-p/4134396#M32477" target="_blank" rel="noopener"&gt;see my old post here&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We are totally spoiled! Of course my first LabVIEW program to control a spectrometer was running on a 100Mhz Pentium 1 and I never had performance problems. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2024 17:32:13 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4375412#M33855</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2024-05-28T17:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: City In a Intensity Graph</title>
      <link>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4375666#M33856</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/74523"&gt;@Hooovahh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;and &lt;STRONG&gt;demo scene people&lt;/STRONG&gt; are wizards with this type of stuff.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Thanks! I did a few of those (at age 12 &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;)...&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 14:07:16 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4375666#M33856</guid>
      <dc:creator>wiebe@CARYA</dc:creator>
      <dc:date>2024-05-29T14:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: City In a Intensity Graph</title>
      <link>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4376203#M33857</link>
      <description>&lt;P&gt;Went full circle and ported the LabVIEW implementation to G Web Development Software to run in a browser &lt;span class="lia-unicode-emoji" title=":face_savoring_food:"&gt;😋&lt;/span&gt;. &lt;A href="https://rajsite.github.io/webvi-experiments/CityInBottle/" target="_self"&gt;See the demo page&lt;/A&gt;!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CityInABottle.png" style="width: 999px;"&gt;&lt;img src="https://ip1.i.lithium.com/b5baba7d702fe5cce19f3b7c88a9a984c86d9080/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33333337333869443445384132344444324538344441352f696d6167652d73697a652f6c617267653f763d76322670783d393939" role="button" title="CityInABottle.png" alt="CityInABottle.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Used LabVIEW NXG's import from LabVIEW feature to create an NXG project, converted it to an NXG Web Module target, and then imported the NXG project to G Web so diagram was ruffled up quite a bit. It really is only useful for simple projects like this. Probably would have been quicker to rewrite by hand &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CityInBottle.gif" style="width: 900px;"&gt;&lt;img src="https://ip1.i.lithium.com/32404b982d2cb2610a2d4af1992647138742ae33/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33333337333969334539303637314241463332373238422f696d6167652d73697a652f6c617267653f763d76322670783d393939" role="button" title="CityInBottle.gif" alt="CityInBottle.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Doesn't run particularly fast but G Web isn't really targeted for fast numerical processing. G Web is better suited to UI interactions and talking to backends doing any serious number crunching (or using the JSLI to call into JS for doing lots of data processing). Anyway, cool project! Was fun to play with &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2024 00:21:50 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4376203#M33857</guid>
      <dc:creator>MilanR</dc:creator>
      <dc:date>2024-06-01T00:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: City In a Intensity Graph</title>
      <link>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4377089#M33875</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;kudos to you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;reminds me of "&lt;A href="https://www.youtube.com/watch?v=L9KLnN0GczI" target="_self"&gt;Creating music in one line of C code&lt;/A&gt;" - or &lt;A href="https://www.youtube.com/watch?v=4K9C3OBCDDc" target="_self"&gt;caustics's 8 bit synthesizer&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 15:10:38 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4377089#M33875</guid>
      <dc:creator>alexderjuengere</dc:creator>
      <dc:date>2024-06-05T15:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: City In a Intensity Graph</title>
      <link>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4377113#M33876</link>
      <description>&lt;P&gt;I have the nagging feeling that the entire thing could be done entirely in blue (no orange wires!), but I have not tried.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 16:45:27 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4377113#M33876</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2024-06-05T16:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: City In a Intensity Graph</title>
      <link>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4377114#M33877</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/7614"&gt;@altenbach&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have the nagging feeling that the entire thing could be done entirely in blue (no orange wires!), but I have not tried.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't think so (at least not 1:1), because a and b (X and Y increments) are fractional. But you can try.&lt;/P&gt;
&lt;P&gt;At the beginning everything was looks pretty simple, but I spend much more time that was initially expected.&lt;/P&gt;
&lt;P&gt;Anyway, functionally equivalent C code is below, may be will be helpful for you if you will give a try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;bool isThereAnythingAt(double X, double Y, int Z)
{ // The random building height comes from (X^Z)*8.
    int temp1 = (int)(X / BUILDING_WIDTH) ^ (Z / BUILDING_DEPTH);
    int temp2 = (CITY_DISTANCE &amp;lt; Z) &amp;amp; (AVENUE_WIDTH &amp;lt; fmod(X, (double)AVENUE_PERIOD));
    int temp3 = temp2 ? temp1 : 0;    
    int Hit = GROUND_PLANE - (temp3 *  % (BUILDING_HEIGHT + 1);
    return (Y &amp;gt;= Hit);
}

void verboseDraw(int t, float* data) {
    const int w = 99;
    for (int i = 6000; i--;) { // World space coordinates.
        double X = t;
        double Y = 1;
        int Z; // Ray direction in world space.
        double a = i % w / 50.0 - 1.0;
        double b = 1.0 - (double)i / 4000;
        double d = 1; // Light.
        double s = b; // Background
        for (Z = 2; Z &amp;lt; w; ++Z) { // Ray tracing!
            if (isThereAnythingAt(X, Y, Z)) { // We hit the model, ray tracing toward the light.
                double last_d = d;
                s = ((int)X &amp;amp; (int)Y &amp;amp; Z) % 3; // The texture.
                s /= (double)Z; // Fog.
                a = b = 1; // New direction, toward the light.
                d = (double)Z / w;
                if (last_d &amp;lt; 1) break; // Effectively the same as the ||d|(...) part.
            }
            X += a;
            Y -= b;
        }
        double darkness = d * Z / w - s; // Texture + lighting.
        data[i] = (float)darkness;
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 16:52:52 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4377114#M33877</guid>
      <dc:creator>Andrey_Dmitriev</dc:creator>
      <dc:date>2024-06-05T16:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: City In a Intensity Graph</title>
      <link>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4385239#M33940</link>
      <description>&lt;P&gt;Went to &lt;A href="https://austin.nerdnite.com/" target="_self"&gt;Nerd Nite Austin&lt;/A&gt; and a presenter named Frank Force shared "JavaScript Haikus" that included an example that looked oddly familiar &lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;. Chatted after and shared the LabVIEW and G Web City In A Bottle ports. Nice fellow!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="frankforcenerdnite.jpg" style="width: 400px;"&gt;&lt;img src="https://ip1.i.lithium.com/7d486bce436405eb47a263b51c4f2d29615ee756/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33333537343569303338373946464341423931424533392f696d6167652d73697a652f6d656469756d3f763d76322670783d343030" role="button" title="frankforcenerdnite.jpg" alt="frankforcenerdnite.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 02:54:58 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4385239#M33940</guid>
      <dc:creator>MilanR</dc:creator>
      <dc:date>2024-07-19T02:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: City In a Intensity Graph</title>
      <link>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4400832#M34041</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/7545"&gt;@Andrey_Dmitriev&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/7614"&gt;@altenbach&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have the nagging feeling that the entire thing could be done entirely in blue (no orange wires!), but I have not tried.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't think so (at least not 1:1), because a and b (X and Y increments) are fractional. But you can try.&lt;/P&gt;
&lt;P&gt;At the beginning everything was looks pretty simple, but I spend much more time that was initially expected.&lt;/P&gt;
&lt;P&gt;Anyway, functionally equivalent C code is below, may be will be helpful for you if you will give a try:&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Go half way and use Fixed points &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2024 14:32:21 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/City-In-a-Intensity-Graph/m-p/4400832#M34041</guid>
      <dc:creator>Yamaeda</dc:creator>
      <dc:date>2024-10-21T14:32:21Z</dc:date>
    </item>
  </channel>
</rss>

