Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

WesleyWu

parametric surface problem

This topic is 5319 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just want to know in detail about a certain type of parametric surface which could exactly interpolate its control points (say 4x4) as what Catmull-Rom spline did in 2D. Can anyone tell me if there is such a type of parametric surface? And detailed documents are preferred. ThanX in advance.

Share this post


Link to post
Share on other sites
Advertisement
Catmull-Rom interpolation works in 3d, also - I think it could be used to interpolate the surface.

-Nik

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Nik02
Catmull-Rom interpolation works in 3d, also - I think it could be used to interpolate the surface.

-Nik


I''ve tried the following code. But the result is disappointing.

MB is the Catmull-Rom basis matrix.

D3DXMatrixTranspose(&MBt,&MB);
Mx=MB*Gx*MBt;
My=MB*Gy*MBt;
Mz=MB*Gz*MBt;

void Calc(float fu, float fv, D3DXMATRIX Mx, D3DXMATRIX My,
D3DXMATRIX Mz, D3DXVECTOR3 &r)
{
D3DXVECTOR4 tu,tv,tx,ty,tz;

tu=D3DXVECTOR4(fu*fu*fu,fu*fu,fu,1.0f);
tv=D3DXVECTOR4(fv*fv*fv,fv*fv,fv,1.0f);

tx=D3DXVECTOR4(tu.x*Mx._11+tu.y*Mx._12+tu.z*Mx._13+tu.w*Mx._14,
tu.x*Mx._21+tu.y*Mx._22+tu.z*Mx._23+tu.w*Mx._24,
tu.x*Mx._31+tu.y*Mx._32+tu.z*Mx._33+tu.w*Mx._34,
tu.x*Mx._41+tu.y*Mx._42+tu.z*Mx._43+tu.w*Mx._44);
ty=D3DXVECTOR4(tu.x*My._11+tu.y*My._12+tu.z*My._13+tu.w*My._14,
tu.x*My._21+tu.y*My._22+tu.z*My._23+tu.w*My._24,
tu.x*My._31+tu.y*My._32+tu.z*My._33+tu.w*My._34,
tu.x*My._41+tu.y*My._42+tu.z*My._43+tu.w*My._44);
tz=D3DXVECTOR4(tu.x*Mz._11+tu.y*Mz._12+tu.z*Mz._13+tu.w*Mz._14,
tu.z*Mz._21+tu.y*Mz._22+tu.z*Mz._23+tu.w*Mz._24,
tu.z*Mz._31+tu.y*Mz._32+tu.z*Mz._33+tu.w*Mz._34,
tu.z*Mz._41+tu.y*Mz._42+tu.z*Mz._43+tu.w*Mz._44);

r=D3DXVECTOR3(D3DXVec4Dot(&tx,&tv),
D3DXVec4Dot(&ty,&tv),
D3DXVec4Dot(&tz,&tv));
}

Suppose control point 0 is (-8.250,0.0469,-8.250)

when I sent (fu=0.0f, fv=0.0f) into Calc, I got ridiculus result in r=(-8.000,0.0469,8.000)

They didn''t match at all!

Any one can help me figure this out?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!