Sign in to follow this  

[.net] What is proj(0, 0) for projection matrix?

This topic is 4765 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

Hello, I'm trying to work out pick ray method using a bounding sphere and sometimes in the C++ examples online I see "proj(0, 0)" for a projection matrix, what is the (0,0) for and what would the conversion of it be in VB.Net or C#? Thanks!

Share this post


Link to post
Share on other sites
Calculate Picking Ray Converted from Game Programming Book.

VB.Net Sample:
Public Function CalculatePickingRay(ByVal x As Integer, ByVal y As Integer) As Ray
Dim px As Single = 0.0F
Dim py As Single = 0.0F
Dim vp As Microsoft.DirectX.Direct3D.Viewport = Direct3DDevice.Viewport

'The default view transformation matrix is the identity matrix.
Dim proj As Matrix = mobjDX9.Transform.Projection

'This may be a problem...
'==CODE HERE INVALID==.
px = (((2.0F * x) / vp.Width) - 1.0F) / proj(0, 0)
py = (((-2.0F * y) / vp.Height) + 1.0F) / proj(1,1)

'Note:
'proj(0, 0) and proj(1, 1) cannot be used in the lines above therefore it is invalid.
'==END OF INVALID CODE==.

Dim ray As Ray
ray.origin = New Vector3(0.0F, 0.0F, 0.0F)
ray.direction = New Vector3(px, py, 1.0F)
Return ray
End Function

Share this post


Link to post
Share on other sites

This topic is 4765 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this