关于float 到const float不能转化的问题

Sigger 2008-12-08 11:47:30
BOOL CKDtreeDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
root = new SoSeparator;
root->ref();

SoMaterial *myMaterial;
root->addChild(myMaterial = new SoMaterial);
myMaterial->diffuseColor.setValue(1.0, 0.0, 0.0);
SoSphere* sphere=new SoSphere;
sphere->radius = 0.1f;
root->addChild(sphere);

int PointNum=100;
float ptss[100][SD];
SoCoordinate3 *pts =new SoCoordinate3;

for(int i=0;i<PointNum;i++)
{
generate_random_point(pTarget,SD);

ptss[i][0]=(float)pTarget[0];
ptss[i][1]=(float)pTarget[1];
ptss[i][2]=(float)pTarget[2];
}

pts->point.setValue(0,1,ptss);
root->addChild(pts);
return TRUE;
}

上述代码中产生的错误是红色部分:
1>c:\documents and settings\scan\desktop\sgg\kdtree\kdtree\kdtreedoc.cpp(133) : error C2664: 'void SoMFVec3f::setValue(const float,const float,const float)' : cannot convert parameter 3 from 'float [100][3]' to 'const float'
SoMFVec3f::setValue是OpenInventor中的函数,请大家帮忙解决下啊?

...全文
307 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Sigger 2008-12-09
  • 打赏
  • 举报
回复
setValue()函数的第一量是数组的元素的起始号码,第二个为数组的总行数,第三个是数组的名称!
星羽 2008-12-08
  • 打赏
  • 举报
回复
pts->point.setValue

的定义是什么样子的

70,011

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧