Tag Info

Hot answers tagged

4

The D3DX function D3DXMatrixOrthoOffCenterRH constructs an orthographic projection matrix based on the top/left/right/bottom coordinates of the view volume. Per the documentation, the formula used is: 2/(r-l) 0 0 0 0 2/(t-b) 0 0 0 0 1/(zn-zf) 0 (l+r)/(l-r) (t+b)/(b-t) zn/(zn-zf) ...


3

I will explain it line by line: var time = new Date().getTime() * 0.002; new Date().getTime() returns the current time in milliseconds (1 second = 1000 milliseconds). This is multiplied by 0.002 to scale the time -- slow it down, in this case. var x = Math.sin( time ) * 192 + 256; Scaling down the time is important, because it is used in this ...


2

Say the object is 10 meters above ground. Assume that our dt (delta t) is 1 second. The object goes to the height of 9 meters at the end of the first iteration Here lies your problem. It is true that the velocity at the end of the first iteration is 1 m.s¯¹. However during that time the object has not travelled 1 m. In fact, since the acceleration is ...


2

Rather than use the legacy D3DXMath, consider using DirectXMath instead Plus you get all the source in the header. This computes the matrix as a row-major, right-handed matrix: inline XMMATRIX XMMatrixOrthographicOffCenterRH ( float ViewLeft, float ViewRight, float ViewBottom, float ViewTop, float NearZ, float FarZ ) { ...


1

Get the object's Normal as vector (X,Y,Z). I guess that will be (0,0,1) in your case. Construct rotation matrix from your angles (e.g. euler-to-matrix or any other "Euler to Matrix" instructions that suit you). Order of rotations is important. Multiply your Normal with Rotation matrix


1

I know this is a pretty late reply but I just thought I should throw it out here for anyone with similar questions. I did econ major undergrad in UC Berkeley too. But after I finish, I wish I did a technical/science/math major because Economics is very general. You have to go to PhD to really make it worth it. Unless, you're planning on going to graduate ...


1

You can do the trig functions yourself if you want, but it's a lot easier to use a rotation matrix. In the background it will do the exact same sin/cos stuff, but it's already programmed for you, so why redo it? I'm not too familiar with Irrlicht (or C++), but adapting some code I found on their forums, it'll probably look something like this: ...


1

You may run into trouble if you're writing an algorithm which requires that you compute an optimized position. For example, let's say you had a set of objects, and you were trying to compute the position with the smallest total distance from all of the objects. Just for a concrete example, say we're trying to power three buildings, and we want to figure ...


1

Short answer: by smart compositing rotation and translation. In the image below you can see the process (radius r is distance of your planet from star). If you rotate the moon by rot_m degrees(updated in main loop), it will circle the origin point. If you first rotate and then translate by radius r it will circle in right distance but wont follow your ...


1

I posted recently a response to a similar question http://stackoverflow.com/questions/24231389/struct-or-class-for-matrix-4x4-object Basically valuetypes are the way to go for storing matrices, more benefits than downsides. You may also organize a matrix to be more GPU friendly by transposing the fields directly into the matrix struct (SharpDX is not doing ...


1

Your code is only sampling the corner texels, so is only valid for a 2x2 filter. Sample all the texels within your filter shape to achieve correct results.



Only top voted, non community-wiki answers of a minimum length are eligible