tag:blogger.com,1999:blog-3523430694927356595.post4772668366790843001..comments2024-02-14T18:33:00.594-08:00Comments on Squircles: Mapping a Circle to a SquareChamberlainhttp://www.blogger.com/profile/16514653288703177586noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-3523430694927356595.post-62872077138906569792024-02-14T18:33:00.594-08:002024-02-14T18:33:00.594-08:00How do I turn polar coordinates into u and v so I ...How do I turn polar coordinates into u and v so I can use the forward mapping to solve for x and y?Ted Milkerhttps://www.blogger.com/profile/09576535384411693962noreply@blogger.comtag:blogger.com,1999:blog-3523430694927356595.post-5940580371953777022022-12-20T02:26:53.272-08:002022-12-20T02:26:53.272-08:00This comment has been removed by the author.Ambience Indiahttps://www.blogger.com/profile/17865050871559855715noreply@blogger.comtag:blogger.com,1999:blog-3523430694927356595.post-4915766852572589612018-07-15T12:37:33.667-07:002018-07-15T12:37:33.667-07:00Actually, I found a similar solution for the inver...Actually, I found a similar solution for the inverse.<br /><br />x = ( √( 2 + 2un√2 + (un)² - (vn)² ) - √( 2 - 2un√2 + (un)² - (vn)² ) )/2n<br /><br />Where n is the interpolator.<br />Also, by replacing each instance of n with n^0.48 in this function, you get nearly the original image back when using both formula's with the same value for n.Anonymoushttps://www.blogger.com/profile/03999164310306501948noreply@blogger.comtag:blogger.com,1999:blog-3523430694927356595.post-68242827117469044452018-07-15T07:17:50.105-07:002018-07-15T07:17:50.105-07:00Are there any good ways of interpolating values? S...Are there any good ways of interpolating values? So you get a slightly rounded square for instance?<br />For the regular version I've already found a simple solution that works quite well.<br />u=x(1-0.5y^2)^(n/2)<br />where n is your interpolator. <br />But I can't find a very elegant way of doing the same for the inverse.Anonymoushttps://www.blogger.com/profile/03999164310306501948noreply@blogger.comtag:blogger.com,1999:blog-3523430694927356595.post-14516832732223019412018-07-15T07:15:35.296-07:002018-07-15T07:15:35.296-07:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/03999164310306501948noreply@blogger.comtag:blogger.com,1999:blog-3523430694927356595.post-28031899610912539532017-06-26T23:09:46.892-07:002017-06-26T23:09:46.892-07:00cool demo! Thanks for sharing your work!! It'...cool demo! Thanks for sharing your work!! It's nice to see an online implementation in javascript. I couldn't see the difference after changing the resampling factor but maybe it's just my poor eyes.Chamberlainhttps://www.blogger.com/profile/16514653288703177586noreply@blogger.comtag:blogger.com,1999:blog-3523430694927356595.post-31785217994908910272017-06-16T10:40:37.741-07:002017-06-16T10:40:37.741-07:00thanks for the write up.
Made a javascript/Canvas2...thanks for the write up.<br />Made a javascript/Canvas2D based version on codepen<br />https://codepen.io/mxfh/pen/gRLqXX#https%3A%2F%2F2.bp.blogspot.com%2F-GaCwOyqLmjw%2FVfN3yDNgGCI%2FAAAAAAAAASU%2FgBcnVj_ydGo%2Fs113%2Fchess.pngdiskurshttps://www.blogger.com/profile/01078464685370608981noreply@blogger.comtag:blogger.com,1999:blog-3523430694927356595.post-57202546272374670682016-11-28T20:11:48.817-08:002016-11-28T20:11:48.817-08:00This comment has been removed by the author.M Lehttps://www.blogger.com/profile/11941172456750845657noreply@blogger.comtag:blogger.com,1999:blog-3523430694927356595.post-74023839357077848792016-11-24T13:46:31.392-08:002016-11-24T13:46:31.392-08:00 I'm assuming you mean when u = v = sqrt(2) on... I'm assuming you mean when u = v = sqrt(2) on the circle. The error you are getting with regards to a negative argument to a square root is because of numerical imprecision. If you observe the value of termx2 and termy2 in the source code for the case u=v=sqrt(2), they are very small and close to zero. You can insert this code before the square root calls in order to avoid numerical imprecision of floating point numbers.<br /><br />double epsilon = 0.0000001;<br />if (fabs(termx2)< epsilon) {<br /> termx2 = 0.0;<br />}<br />if (fabs(termy2)< epsilon) {<br /> termy2 = 0.0;<br />}<br /><br />In a perfect world of floating point numbers without numerical imprecision, termx2 and termy2 should be equal to zero for this caseChamberlainhttps://www.blogger.com/profile/16514653288703177586noreply@blogger.comtag:blogger.com,1999:blog-3523430694927356595.post-73110276483487725342016-11-05T06:45:11.011-07:002016-11-05T06:45:11.011-07:00If u2 == v2, I find that termx2 and termy2 can be ...If u2 == v2, I find that termx2 and termy2 can be negative and result in errors.Parasolianhttps://www.blogger.com/profile/01422967323154514734noreply@blogger.com