mycad 发表于 2010-2-8 16:47:00

[求助]版主关于曲线曲率的问题;.net附件上传了

本帖最后由 作者 于 2010-2-9 8:08:04 编辑 <br /><br /> 我把vb.net下的代码改写成C#时 double ka = (double)kp(1) / (double)kp(0) - Math.PI / 2;<br/>错误:Error3 'kp' is a 'variable' but is used like a 'method';高手赐教一下,谢谢!!!<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;'vb&nbsp; &nbsp;<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Dim p As Point3d = cv.GetPointAtDist(i * len / n)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Dim kp As Object = cv.GetFirstDerivative(cv.GetParameterAtDistance(i * len / n))<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Dim ka As Double = kp(1) / kp(0) - Math.PI / 2<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;'Double&nbsp;&nbsp;s = kp(1)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Call AddText(p, "等分点\" &amp; CStr(i), 3, ka, 1, 1)<br/>////////C#<br/>p =cv.GetPointAtDist (i * len / n);<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Object kp&nbsp;&nbsp;=(Object) cv.GetFirstDerivative(cv.GetParameterAtDistance(i * len / n));<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;double ka = (double)kp(1) / (double)kp(0) - Math.PI / 2;<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;AddText(p, "等分点" + i.ToString(), 3, ka, 1, 1);

雪山飞狐_lzh 发表于 2010-2-8 21:18:00

<p>Vector3d kp =&nbsp;cv.GetFirstDerivative(cv.GetParameterAtDistance(i * len / n));<br/>double ka = kp / kp - Math.PI / 2;//?奇怪的方式,可以解释下么?</p><p></p>

游天居士 发表于 2010-2-8 23:14:00

<p>我也看不明白。</p><p>&nbsp;</p>

mycad 发表于 2010-2-9 08:07:00

<p>&nbsp;</p><p>我把vb.net放在附件了;版主运行一下看看</p><p>在vb.net中;源程序是这样定义的:</p><p>Dim kp As<strong> Object</strong> = <strong>cv.GetFirstDerivative(cv.GetParameterAtDistance(i * len / n))</strong><br/></p><p>Dim ka As Double = kp(1) / kp(0) - Math.PI / 2</p><p>此句在c#中不知怎样表示?<br/></p><p>在vb.net中 kp(1)与kp(0)是个double值;</p><p>&nbsp;</p>

雪山飞狐_lzh 发表于 2010-2-9 10:44:00

<p>二楼不是写了?</p><p>Curve.GetFirstDerivative Method</p><p>返回曲线的切向量</p>

mycad 发表于 2010-2-9 13:08:00

<strong><font face="Verdana" color="#da2549">太感谢lzh741206</font></strong>
页: [1]
查看完整版本: [求助]版主关于曲线曲率的问题;.net附件上传了