# calculating clip planes from matrices

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

## Recommended Posts

Does anyone see a problem with this? I'm suspecting maybe plain matrix4*vector4 multiplication doesn't transform planes correctly.
Vector4 p[6];
Matrix4 matWorld;
Matrix4 matView;
Matrix4 matProj;
Matrix4 z;
pDevice->GetTransform(D3DTS_WORLD,(struct D3DXMATRIX *)&matWorld);
pDevice->GetTransform(D3DTS_VIEW,(struct D3DXMATRIX *)&matView);
pDevice->GetTransform(D3DTS_PROJECTION,(struct D3DXMATRIX *)&matProj);
z=matWorld*matView*matProj;
z.Invert();
//Plane equation: ax+by+cz+d>0
p[0]=z.Transform(Vector4(0.0f,0.0f,1.0f,0.0f)); 	//Front:	z>0
p[1]=z.Transform(Vector4(0.0f,0.0f,-1.0f,1.0f)); 	//Back:		z<1
p[2]=z.Transform(Vector4(1.0f,0.0f,0.0f,1.0f)); 	//Left:		x>-1
p[3]=z.Transform(Vector4(-1.0f,0.0f,0.0f,1.0f)); 	//Right:	x<1
p[4]=z.Transform(Vector4(0.0f,-1.0f,0.0f,1.0f)); 	//Top:		y<1
p[5]=z.Transform(Vector4(0.0f,1.0f,0.0f,1.0f)); 	//Bottom:	y>-1
[/SOURCE]

1. 1
Rutin
41
2. 2
3. 3
4. 4
5. 5

• 16
• 18
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633362
• Total Posts
3011527
• ### Who's Online (See full list)

There are no registered users currently online

×