Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 03 Jul 2006
Offline Last Active Today, 09:48 AM

#5233168 Moving around a sphere with quaternions

Posted by on 06 June 2015 - 11:00 AM

Quaternion multiplication is not a rotation. Quaternions rotate a vector through conjugation qvq-1. Your function multiplyQuat is thus either named wrong or it has been used in the wrong way.

#5227301 Nav mesh determining neighbours efficiently

Posted by on 05 May 2015 - 07:53 AM

If the two polygons share their vertices, you simply have to search if the two polygons have two adjacent vertices in common. If this is not the case, you should probably first merge the vertices and then use the method above. The better way to solve T-junction IMHO is to cut the edges at the T-junction. You increase the number of edge/vertices of the polygons but it makes everything much simpler.

#5204711 [Solved] Vector prime notation, what does it mean?

Posted by on 16 January 2015 - 08:25 AM

I haven't read the paper, but I think it is the derivative (with respect of time I guess).

#5202488 inverted GJK --- you're a genius if you can solve this

Posted by on 06 January 2015 - 10:31 PM

I would simply subdivide the mothership's concave shape in the union of a set of (not necessarily disjoint) convex shapes. If the small ship intersect any of them, it intersects the mothership. This is simpler to implement than trying to add additional steps to handle each hole or inset separately. 

#5201003 Bezier triangle partial second-order derivatives

Posted by on 31 December 2014 - 10:52 AM

It is difficult to write the entire derivation here in the forum, but AFAIK the second order derivatives should be the following ones:


EDIT: To arrive at this result you have to use the observation at the end of Shnoutz post in the discussion you have linked. You first derivate the Bernestein polynomials and then change the indices.
EDIT2: The derivatives in the gamasutra article are clearly wrong since partial derivatives are vectors while that formula defines a point. In the formulas above each "control point" is a vector since it is a linear combination of point whose coefficients sum to zero. In computer graphics we usually use vectors and points interchangeably, but they are different mathematical objects and it is sometimes useful to consider their differences when verifying an equation.

#5196265 Matrix right hand to left hand problem

Posted by on 04 December 2014 - 10:03 AM

You also have to flip the order of all multiplications. In fact, (A*B)^T = B^T * A^T != A^T * B^T.

#5185230 Is upper division Linear Algebra a good idea or necessary?

Posted by on 06 October 2014 - 01:49 AM

In Opengl, the operation is component wise multiply, though it has no sence to be used in manner of geomteric need, it ields a vector space where column and row vectors are the same, implying certain inpropriatness of talking about transposing a matrix, since it transposes by its order with multiply operation (that is impossible in linear algebra becouse of NxM demand in mutipling matricies/vectors, implying also vectors to be nx1x1xm, but that algebra has its definition of operation, that opengl does differ in (it will multiply vectors without their dimension introduced), thus opengl has a vector space of different properties- where multiplication is not associative- but it is a vector space).

OpenGL uses the same data type for several different things, not just geometric vectors. In particular, it uses them for colors. The component-wise multiplication is in fact very useful in this case. Code implementations of mathematical concepts are rarely completely equivalent to their theoretical version.

#5181038 OIT (Order Independent Transparency)

Posted by on 17 September 2014 - 10:10 AM

The Intel solution is based on a quite recent and, as far as I know, Intel-only extension. The Weighted Blended OIT is more general, but it is an approximation. There are also other methods (A-buffers for example). I don't think this is a solved problem and in many cases sorting is still probably the way to go. The best method depends on what you are trying to do and the scene you are trying to display.

#5180962 Formulas, Math, and theories for RPG combat/leveling systems?

Posted by on 17 September 2014 - 04:09 AM

IMHO If you want low level players/monsters to have a chance against higher level ones, then you should rely less on stats and add more depth and strategy to your combat system. This is in fact the only way a weaker individual can beat a stronger one in real life too. If you have to fight with a boxer, you try to stay at the distance. If you are fighting with someone with a gun, you hide and try to disarm or use surprise or.. 

#5162268 Editing Bezier Splines while maintaining C1 Continuity

Posted by on 23 June 2014 - 01:46 AM

To maintain C1 continuity between consecutive (cubic) Bézier splines you have to maintain the following equations:


P3(i-1) - P2(-1) = P1(i) - P0(i)

P3(i-1) = P0(i)


where the index in the parenthesis represents the index of the curve in the spline. The derivative/tangent at the beginning (end) of Bézier curve is in fact parallel to the edge between the first two (last two) control points. If the two curves have different degree you have to multiply each part of the equation with the degree of the corresponding curve.

#5148706 Can you quickly visualize how a quaternion would look on top of your head?

Posted by on 22 April 2014 - 06:48 AM

If you take a general quaternion like 0.6 + 0.3*i + 0.2*j -  0.71*k you may first look at the real part and observe this should be equal to cos(alpha/2) for some angle alpha. 0.6 is greater than 0.5 which is the cosine of 60 degrees, but less then sqrt(2)/2 ~= 0.71 which is the cosine of 45 degrees. It should then be something in between, let's say 52.5 which is in the middle (the correct angle is 53.13 degrees) and thus we have a rotation of approximately 105 degrees around the axis defined by its imaginary part. This is basically how you can get a rough idea of what a quaternion does.

#5145766 Quaternions rotation code

Posted by on 09 April 2014 - 02:49 PM

I do not know the Unity API, but I think it is the rotation around the axis cross((0, 1, 0), mFrontWheelNormal) with angle equal to the angle between the two vectors. The effect of the rotation should be to move something aligned with (0,1,0) to something aligned with mFrontWheelNormal.

#5145703 Quaternions rotation code

Posted by on 09 April 2014 - 09:55 AM

When you multiply two quaternions you are composing the two transformations together. The resulting rotation is the rotation obtained by first rotating according to right-most quaternion and then according to the left-most one. In your case, your first rotation maps (0, 1, 0) to mFrontWheelNormal and you then rotate around the normal vector by the angle Source.rotation.eulerAngles.y.

#5145085 Rotate a quaternion

Posted by on 07 April 2014 - 10:44 AM

If you want to combine rotations, you have to multiply together the two quaternions. If q_1 is the first rotation and q_2 is the second rotation, then q_2*q_1 is the rotation obtained by first rotating using q_1 and then q_2. q_1*q_2 is the rotation obtained by first rotating using q_2 and then q_1. Indeed, q_2*q_1*v*(q_2*q_1)^{-1} = q_2*(q_1*v*q_1^{-1})*q_2^{-1}.

#5142607 draw 2d line with clipping

Posted by on 27 March 2014 - 09:56 AM

There is no need to execute the loop to obtain the correct values of x, y and error. The error is simply the vertical distance from the line to the current pixel. If (x_0, y_0) the better approximation of the first pixel to draw on the screen and y = m*x + q is the line equation, then error = m*x_0 + q - y_0. You should then be able to draw the following pixels without problems.