I've got as far as getting all the control point positions, and the vertex positions normalised to the bounding box of the FFDBox, but I can't work out the math to reposition the vertices based on the new positions of the FFDBox control point positions.
I've been translating some c++ code I came across into maxscript, and I've almost got it working. The problem comes when using one of the libraries to translate the vertice positions based on the control points.
Here's the include code
template <class Real>
class WM4_FOUNDATION_ITEM BSplineVolume
// Construction and destruction of an open uniform B-spline volume. The
// class will allocate space for the control points. The caller is
// responsible for setting the values with the member function
BSplineVolume (int iNumUCtrlPoints, int iNumVCtrlPoints,
int iNumWCtrlPoints, int iUDegree, int iVDegree, int iWDegree);
int GetNumCtrlPoints (int iDim) const;
int GetDegree (int iDim) const;
// Control points may be changed at any time. If any input index is
// invalid, the returned point is a vector whose components are all
void SetControlPoint (int iUIndex, int iVIndex, int iWIndex,
const Vector3<Real>& rkCtrlPoint);
Vector3<Real> GetControlPoint (int iUIndex, int iVIndex, int iWIndex)
// The spline is defined for 0 <= u <= 1, 0 <= v <= 1, and 0 <= w <= 1.
// The input values should be in this domain. Any inputs smaller than 0
// are clamped to 0. Any inputs larger than 1 are clamped to 1.
Vector3<Real> GetPosition (Real fU, Real fV, Real fW) const;
Vector3<Real> GetDerivativeU (Real fU, Real fV, Real fW) const;
Vector3<Real> GetDerivativeV (Real fU, Real fV, Real fW) const;
Vector3<Real> GetDerivativeW (Real fU, Real fV, Real fW) const;
// for array indexing: i = 0 for u, i = 1 for v, i = 2 for w
Vector3<Real> GetPosition (Real afP) const;
Vector3<Real> GetDerivative (int i, Real afP) const;
Vector3<Real>*** m_aaakCtrlPoint; // ctrl[unum][vnum][wnum]
typedef BSplineVolume<float> BSplineVolumef;
typedef BSplineVolume<double> BSplineVolumed;
Is it possible to 'translate' this c++ code into some kind of workable maxscript?
It looks like you can get or set the vertice positions based on where the control points have been moved to. Perhaps there is some further underlying code using bspline curves to actually do the calculation of where the vert should be...
I dunno... I think I'm stumped!
Any C++ wizards that can point me on the right track?