linzhixiao 发表于 2007-4-2 23:28:00

用双圆弧来拟合非圆曲线(如椭圆)

<p>用双圆弧来拟合非圆曲线(如椭圆)</p><p>对这方面有研究的高手,希望能联系我。<a href="mailto:85315168@vip.163.com"><font color="#000000">85315168@vip.163.com</font></a></p><p>我们出开发费用,请人帮我们兼职开发这方面的算法函数。</p>

huihuo 发表于 2007-4-8 17:02:00

<p>Here's some java code that should help you out. (modify to suit your<br/>language needs)</p><p>If anyone sees any problems with this code, please let me know so I can<br/>fix my stuff :)</p><p>float x, y, width, height - these are already set.</p><p>float hwidth = width / 2;<br/>float hheight = height / 2;<br/>float ab = (float)(hwidth * (4.0/3.0*(Math.sqrt(2.0)-1.0)));<br/>float cd = (float)(hheight * (4.0/3.0*(Math.sqrt(2.0)-1.0)));</p><p>pdf.moveto(x, y + hheight);</p><p>// top right<br/>pdf.curveto(x + ab, y + hheight, // B<br/>x + hwidth, y + cd, // C<br/>x + hwidth, y);</p><p>// bottom right<br/>pdf.curveto(x + hwidth, y - cd, x + ab, y - hheight, x, y - hheight);</p><p>// bottom left<br/>pdf.curveto(x - ab, y - hheight, x - hwidth, y - cd, x - hwidth, y);</p><p>// top left<br/>pdf.curveto(x - hwidth, y + cd, x - ab, y + hheight, x, y + hheight);</p><p>pdf.moveto(x, y + hheight);</p><p>pdf.fill();<br/></p>
页: [1]
查看完整版本: 用双圆弧来拟合非圆曲线(如椭圆)