bon j´ ai relis et mon probleme n´ est ni tres clair ni tres facile a exprimé donc voila le Exe :
http://www.wikiupload.comom/download_page.php?id=100889
La sphere jaune represente l´ intersection plan / souris, pour resizer clicker sur un sommet et déplacer. Le probleme devient evident.
Voici le detail de ma proc :
1( jvous le mes pas y marche )
le resultat est dans un D3DXPLANE appelé plane.
2 :
D3DXVECTOR3 v;
v.x = ( Pos.x * 2.f / Rsx - 1 ) / matProj._11;
v.y = - ( Pos.y * 2.f / Rsy - 1 ) / matProj._22;
v.z = 1.f;
D3DXVECTOR3 ROri, RDir;
D3DXMATRIXA16 m;
m = matView;
D3DXMatrixInverse( &m, NULL, &m );
RDir.x = v.x*m._11 + v.y*m._21 + v.z*m._31;
RDir.y = v.x*m._12 + v.y*m._22 + v.z*m._32;
RDir.z = v.x*m._13 + v.y*m._23 + v.z*m._33;
ROri.x = m._41;
ROri.y = m._42;
ROri.z = m._43;
3 :
D3DXPlaneIntersectLine( &Intersection, &plane, &ROri, &RDir );
4 :
D3DXMatrixInverse( &m, NULL, &matWorld );
D3DXVec3TransformCoord( &Intersection, &Intersection, &m );
5 :
NewPos = Intersection - OldPos;
//lock
for(int c = 0;c < 24; c++)
{
if(vertices[c].x > 0) vertices[c].x += ax;
else vertices[c].x -= ax;
if(vertices[c].y > 0) vertices[c].y += ay;
else vertices[c].y -= ay;
if(vertices[c].z > 0) vertices[c].z += az;
else vertices[c].z -= az;
}
//unlock