Quad art with Go

polaris · · 421 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hey all, I&#39;m learning golang and I made a little art project using quad trees. Check it out <a href="https://github.com/bradymadden97/go-quads">https://github.com/bradymadden97/go-quads</a>.</p> <hr/>**评论:**<br/><br/>Kraigius: <pre><p>Your project is difficult to setup but it&#39;s easy to fix.</p> <p>You should probably vendor or at the strict minimum list your go dependencies. I would recommend that you document that python can be used to <em>enhance</em> the program to allow gif creation, it&#39;s not required strictly speaking for the program to function and it just adds more dependencies (bash and python aren&#39;t standard on windows ;) ). You should also document where we should put that python script. Looking at the code it seems to only look in the local directory but in my case I build the executable somewhere else and the script remained in the <code>quads/</code> folder. There&#39;s also an error in your requirements file as it requires double equals.</p> <p>As a last note, and this is more about the code itself, check that the <code>.out</code> folder exists and create it if it doesn&#39;t. I thought your program wasn&#39;t working until I peaked in the code and realized that I needed that folder. The default iteration is 20 and not 200 ;)</p> <p>It works great though!</p></pre>birkbork: <pre><blockquote> <p>You should probably vendor or at the strict minimum list your go dependencies.</p> </blockquote> <p>If you are unsure about what dependencies a project needs, let go figure it out for you:</p> <p>In the project root:</p> <pre><code>go get -v -u -t ./... </code></pre> <p>-v is verbose, to show what packages are pulled</p> <p>-u updates packages already in your go/src tree</p> <p>-t also pulls packages only used in *_test.go files</p> <p>and ./... travels the directory hierarchy</p> <pre><code>go help get </code></pre> <p>for more info!</p></pre>bmadden19: <pre><p><code>vendor</code> is inside <code>/quads</code></p></pre>birkbork: <pre><p>Yes, I found it. Was just adding some useful info in reply to <a href="/u/Kraigius" rel="nofollow">/u/Kraigius</a></p></pre>Kraigius: <pre><p>Thanks but it&#39;s not just knowing the dep but also locking it to a specific version (or taking note of that version) otherwise your project can silently break at any moment.</p></pre>bmadden19: <pre><p>Thanks for your help! This is one of my first go projects/ projects used by os community so the setup steps definitely need some tweaking and feedback.</p></pre>Kraigius: <pre><p>I didn&#39;t just complained, I also sent some PR love in your way :)</p></pre>Baratock: <pre><p>separating the application from the quad-generating library would be great.</p> <p>Then you can try to use your quadgenerator as a library for another application.</p></pre>puffybunion: <pre><p>Nice! Really like the results. Do you mind sharing a bit about the algorithm you use? Also, mind talking about the performance, i.e, how long it takes to generate an image?</p></pre>FogleMonster: <pre><p>The algorithm is briefly explained on my page here:</p> <p><a href="https://www.michaelfogleman.com/static/quads/">https://www.michaelfogleman.com/static/quads/</a></p></pre>puffybunion: <pre><p>Holy shit, it&#39;s Fogleman! I love your work, dude.</p></pre>FogleMonster: <pre><p>Haha, thanks!</p></pre>bmadden19: <pre><p>Wow! Didn&#39;t expect this at all. Definitely all the credit to you for the idea - I thought it was so cool I had to see if I could do it myself!</p></pre>bmadden19: <pre><p>Just from some quick trials on my computer: Small image (512x512 px) 250 iterations: 1 s; 1000 iterations: 2.3 s</p> <p>Larger image (2048x2048 px) 250 iterations: 17 s; 1000 iterations: 45 s</p> <p>Maybe @FogleMonster could share how long his Python version takes in comparison</p></pre>int32_t: <pre><p>Perhaps you can add a benchmark using the <code>testing</code> package so that it can be done simply by <code>go test -bench ...</code>. (Also a good exercise about the idiomatic testing if you&#39;re learning Go)</p></pre>FogleMonster: <pre><p>512x512, 1000 iterations: 1.7 seconds 2048x2048, 1000 iterations: 2.1 seconds</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

421 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传