Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


apatriarca

Member Since 03 Jul 2006
Online Last Active Today, 08:54 AM

#5140688 Inverse Proportion and Zero

Posted by apatriarca on 20 March 2014 - 09:57 AM

I'm not sure I understood your post. Anyway, what about (10 - x)*25.5 ? It is equal to 255 when x is zero and equal to 0 when x is 10.




#5134720 This is what atan2() does if given two Vector2D points on 2D plane?

Posted by apatriarca on 26 February 2014 - 05:07 AM

There is no need to convert these vectors to angles to compute a rotation matrix. All you need to compute a rotation matrix in 2D are the cosine and sine of the angle and you already have them encoded in the direction of the difference vector. You indeed simply have to normalize the difference vector:

 

(cos(angle), sin(angle) ) = normalize(P2 - P1).

 

If you think you have to compute the angle to compare them between different fingers positions, then it is not true again. If P3 and P4 are different positions of your fingers, then you can compute the cosine and sine of the rotation angle between the two vectors by simply using a complex division. If do not know complex numbers I suggest to learn about them, but you can implement the division using the following formula:

 

(a, b) / (c, d) = ( a*c + b*d, b*c - a*d ) / (c*c + d*d).




#5125823 .obj file loader

Posted by apatriarca on 23 January 2014 - 03:30 AM

Is there any reason you are using (*model).GetIndices() instead of model->GetIndices() ? 




#5125637 Barycentric coordinates of circumcenter of tetrahedron

Posted by apatriarca on 22 January 2014 - 08:10 AM

The steps in the derivation are very similar to the steps in the triangle case and you should get:

 

Dot(B-A,B-A)*s + Dot(B-A,C-A)*t + Dot(B-A,D-A)*u = (1/2)*Dot(B-A,B-A)
Dot(C-A,B-A)*s + Dot(C-A,C-A)*t + Dot(C-A,D-A)*u = (1/2)*Dot(C-A,C-A)

Dot(D-A,B-A)*s + Dot(D-A,C-A)*t + Dot(D-A,D-A)*u = (1/2)*Dot(D-A,D-A)

 

which you can then solve using Cramer's rule (or something else). 




#5125616 Mathematics for 3D programming - Exercises

Posted by apatriarca on 22 January 2014 - 05:01 AM

Making a simple 3D game/tech demo or a ray tracer or .. is IMHO probably one of the best way to exercise those math skills.




#5123310 Need a design advice on a Mesh Class

Posted by apatriarca on 13 January 2014 - 10:53 AM

If Context::CreateBuffer calls Mesh::CreateBuffer you have an infinite loop. This is in my opinion the main reason to avoid doing that.




#5123269 shadows in 2d

Posted by apatriarca on 13 January 2014 - 07:18 AM

I guess it depends on the type of game you are working on (i.e. where is the camera and the relative positions of lights and objects) but it can be done. For example, this article on gamedev explains a technique to implement soft shadows in 2D. 




#5117517 Genetic algorithm in a game

Posted by apatriarca on 17 December 2013 - 02:44 AM

You may find this paper interesting. The paper describes an experiment in which player weapons were procedurally generated at the beginning of each match. The players were able to choose between their current weapons and new procedurally generated one and their choices and performance were used to evolve the weapon generation algorithm.


#5115643 OpenGl as a blitter

Posted by apatriarca on 09 December 2013 - 07:43 AM

The modern way of drawing stuffs using the GPU is to simply draw a set of textured quads. There is no reason to flush after each quad (it would be extremely slow) and it is usually easier to simply draw everything each frame. There are several ways to draw a quad in OpenGL: you can draw two triangles, you can use the GL_QUADS constant (in legacy versions of OpenGL), you can use point sprites, you can use a geometry shader, you can use instancing, etc. In a simple 2D game, the method used is probably not so important.

P.S. If you really want to learn about OpenGL, I suggest to start using the modern APIs. The programmable pipeline is now common in the mobile and Web world too.


#5114300 Using one instance of Behaviour Tree for many agents?

Posted by apatriarca on 04 December 2013 - 07:07 AM

I think there was a video tutorial on AiGameDev.com discussing these topics. Probably this video.


#5114262 Quaternions and matrices

Posted by apatriarca on 04 December 2013 - 03:14 AM

It is possible to send a quaternion to a shader and use it directly. This may be useful for skinning or to reduce memory requirements. For example you can see this presentation by Crytek as an example of quaternion use in shaders.


#5110747 question about quadratic bezier patch

Posted by apatriarca on 20 November 2013 - 07:12 AM

It is a point on a curve, but that curve does not belongs to the surface.. The blue curve in cadjunkie post is not contained in the surface. It is the set of the middle control points of the isoparametric curves.


#5110713 question about quadratic bezier patch

Posted by apatriarca on 20 November 2013 - 03:02 AM

Drawing and intuition are often useful, but sometimes they are an obstacle in seeing the truth. I suggest to write the general equation of a surface Bézier patch and follows the advices we have already given. When you fix one of the two coordinates, the corresponding Bernstein polynomials becomes constants and you can rewrite the terms of the sums to get the equation of a Bézier curve. The control points of this new curve are simply obtained evaluating the curves I have written in my last post. C(P(1,0), P(1,1), P(1,2), 0.7) is not contained in the surface.


#5110503 question about quadratic bezier patch

Posted by apatriarca on 19 November 2013 - 10:51 AM

Let P(i, j) be the control points of the quadratic Bézier surface patches, C(P0, P1, P2, t) represents a quadratic Bézier curve with control points P0, P1 and P2 with parameter t and S(u, v) the quadratic Bézier surface patch equation. We are trying to explains to you that

 

S(u, 0.7) = C(   C(P(0,0), P(0, 1), P(0,2), 0.7)  ,   C(P(1,0), P(1, 1), P(1,2), 0.7)   ,   C(P(2,0), P(2, 1), P(2,2), 0.7)   , u).




#5110435 question about quadratic bezier patch

Posted by apatriarca on 19 November 2013 - 05:45 AM

That's latex code. It look like it is less readable than I assumed. I don't know how to write equations in this forum anymore (the eqn tag does not seem to work and I can't upload images from 3rd party services).

 

If you fix one of the two coordinates (for example v = 0.7 as in your example), the corresponding basis polynomials B_j(v) becomes constants. You can thus sum the terms P_ij B_j(v) for 0 <= j <= 2 to obtains the control points for a quadratic curve depending only on the parameter u.






PARTNERS