I try to modify morph control vertex coordinates in my codes,
control vertex can accessed by these codes, as below
//----------------------------------------------
const ON_MorphControl* ctr = src->Control(); // CRhinoMorphControl::Control()
ON_NurbsCage* cage = (ON_NurbsCage*)(&ctr->m_nurbs_cage); // [const ON_NurbsCage] to [ON_NurbsCage]
//
int i_num = cage->m_cv_count[0]; // vertex number at x direction
int j_num = cage->m_cv_count[1]; // vertex number at y direction
int k_num = cage->m_cv_count[2]; // vertex number at z direction
int i,j,k;
for (i=0; i<i_num; i++)
{
for (j=0; j<j_num; j++)
{
for (k=0; k<k_num; k++)
{
ON_3dPoint pt;
cage->GetCV(i,j,k, pt); // get original position of morph control vertex at (i,j,k)
pt.x = pt.x + pt3ds[i][j][k].x; // x displacement of control vertex(i,j,k)
pt.y = pt.y + pt3ds[i][j][k].y; // y displacement of control vertex(i,j,k)
pt.z = pt.z + pt3ds[i][j][k].z; // z displacement of control vertex(i,j,k)
cage->SetCV(i,j,k, pt); // set new position to the morph cage
}
}
}
//
but these didn’t work,
seems CRhinoMorphControl::Control() returns a const pointer, so it’s member ON_MorphControl::m_nurbs_cage
this member can not modify.
is there a method that can modify morph control vertex coordinatess, instead of manipulating on screen .
thanks!!