uusky 发表于 2005-9-19 18:17:00

调用函数的问题(两点坐标相同时)

<P>如何调用函数Equal_Points的问题:</P>
<P>在Attribute.h中:<BR>class CAttribute : public CDialog<BR>{<BR>// Construction<BR>public:<BR>int Equal_Points (const ads_point p1, const ads_point p2);/<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .............<BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>在Attribute.cpp中我的代码:<BR><FONT color=#1111ee>int</FONT> Equal_Points(const ads_point p1, const ads_point p2) //判断两点坐标p1,p2是否相等<BR>{<BR>&nbsp;&nbsp;&nbsp; // 指定误差范围<BR>&nbsp;&nbsp;&nbsp; const ads_real Equality_Margin = (ads_real)0.00000001; <BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; int c ;<BR>&nbsp;&nbsp;&nbsp; for (c = X ; c &lt;= Z ; c++) {<BR>&nbsp;&nbsp;float&nbsp; ee=p1 - p2;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(fabs(ee) &gt; Equality_Margin) { //(fabs(p1 - p2) &gt; Equality_Margin) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (<FONT color=#e61a94>0</FONT>) ;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; return (<FONT color=#ee1169>1</FONT>) ;<BR>}</P>
<P>我在Attribute.cpp下面的函数这样调用:<BR><FONT color=#3809f7>void</FONT> CAttribute::OnLine() //编 辑void CAttribute::OnLine() 函 数<BR>{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcGePoint3d&nbsp; BPt;<BR>int k=0;<BR>ads_getpoint(NULL,"\n 第一点:",asDblArray(BPt)); <BR>for (i=1; <FONT color=#ee1169>k==1</FONT> ;i++)&nbsp; //当两点坐标相等时跳出循环<BR>&nbsp;{&nbsp; <BR>&nbsp;ads_getpoint(asDblArray(BPt),"\n 下一点:",asDblArray(BPt));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT color=#f70968> k= Equal_Points(asDblArray(BPt),asDblArray(BPt))</FONT>;//如果屏蔽该句则没问题<BR>//请问这样调用会出错,应该怎样改?<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>.........<BR>}<BR>可这样调用总是出错:<BR>Attribute.obj : error LNK2001: unresolved external symbol "public: int __thiscall </P>
<P>CAttribute::Equal_Points(double const * const,double const * const)" </P>
<P>(<A href="mailto:?Equal_Points@CAttribute@@QAEHQBN0@Z" target="_blank" >?Equal_Points@CAttribute@@QAEHQBN0@Z</A>)<BR>这里面还存在问题:const ads_point p1 ;好象不能使用<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AcGePoint3d BPt;定义的坐标?<BR></P>

azx 发表于 2005-9-24 20:30:00

你可能要解决负0问题,注意   -0!=0 。
页: [1]
查看完整版本: 调用函数的问题(两点坐标相同时)