Jump to content
  • Advertisement

quasar3d

Member
  • Content Count

    1189
  • Joined

  • Last visited

Community Reputation

814 Good

About quasar3d

  • Rank
    Contributor

Personal Information

  • Interests
    Programming
  1. quasar3d

    What are the physics algorithms used in this?

    "Reciprocal velocity obstacles" might be what you're looking for.
  2. quasar3d

    Quadratic equations trouble

    Are you sure those equations are correct? All 3 terms in each line are the same, so the first line is actually equivalent to 3 * (x - y)^2 = 2.   Besides that, I think it might be easier to let   a = x - y b = y - z c = a + b   Then   3a^2 = 2 3b^2 = 2 3(a + b)^2 = 2   So it doesn't have any solutions, since a, b = +/- sqrt(2 / 3), but these don't solve the 3rd equation.
  3. quasar3d

    Delaunay Traingulation

      What do you mean with that? They're each others dual, and in memory, they're often stored in the exact same way.
  4. quasar3d

    Calculate volume of non-convex polyhedron

    Alvaro's method does require that your polyhedron is represented as a triangle mesh, but if I understand you correctly, you only have a set of points, which lie on the boundary. This means that before you can use it, you'd have to create a triangle mesh from those points, which is possible, but really quite difficult (search for surface reconstruction from point clouds). If you don't mind using third party libraries, you could use CGAL for this though (see http://doc.cgal.org/latest/Surface_reconstruction_points_3/).
  5. quasar3d

    point & Octahedron relationship

    If it's a regular octahedron, just take the absolute value of each coordinate, add them, and see if the resulting value is less than a certain threshold (ie. the size of your octahedron). If so, then your point lies inside it, otherwise not.
  6. quasar3d

    Quaternion angle with itself > 0.001

      The reason why the error gets so big, is that the inverse cosine function is very steep around 1. This has the effect that the (even exact) inverse cosine of a dot product which is only a tiny bit off, will give a pretty big angle difference.   For example, the cosine of 0.1 degree is 0.99999847691, and so if your dot product would give 0.99999847691 (which is a pretty good approximation of 1), the angle you get will be around 0.1   I bet that the reason why, after renormalizing your quaternions, you did get the correct result, was that this gave a dot product of exactly 1, but I don't think this will work for all quaternions. There will certainly be normalized quaternions, which give a dot product with themselves not exactly equal to 1.   The good news is that it's only this bad when you're computing the angle between quaternions which are almost parallel. For quaternions which are not nearly parallel, the result will be more accurate.
  7. What you want is http://en.wikipedia.org/wiki/Boolean_operations_on_polygons with the union operations. It's definitely not an easy thing to implement though, so if you can find a way to do without this, it's probably preferable.
  8. But after Gaussian elimination, the elements in d,g,h are 0, and so all terms in aei + bfg + cdh - hfa - idb - gec vanish, except for aei. But indeed, for 3x3 matrices it's probably still faster to compute it using your formula, but the number of terms in that closed form is n!, with each term consisting of n factors (where n is the number of dimensions), so the complexity grows much faster than with gaussian elimination, where after bringing your matrix to reduced form, always just a single term remains.    The reason they put a negative sign before the determinant was probably because they did an odd number of row exchanges. Each time you exchange rows, the sign of the determinant changes.
  9. quasar3d

    Quaternions and matrices

    Another important reason is of course that you usually combine the translation, rotation, and any other transformations into a single matrix which you use to transform your points. So indeed, it's usual to use quaternions while animating, but once you have determined the transformation for a mesh, you create a matrix, and use that matrix to transform its vertices.
  10. quasar3d

    Homogenous coordinates

    An easy way to get a hang of 3D homogeneous coordinates (which consist of 4 coordinates) is to see them as a higher dimension analogue to fractions.   - A fraction $a/b$ represents a number on the 1D real axis, but really consists of 2 "coordinates", ie. (a,b). In a similar way, the 3D vector (x/w,y/w,z/w) corresponds to the 4D homogeneous vector (x,y,z,w). - Just as with fractions, multiplying all components by the same value doesn't change its value, ie. a/b = (sa)/(sb), or in coordinate form (a,b) = (sa,sb), for some scalar s. Similarly, since (x/w,y/w,z/w) = ((sx)/(sw),(sy)/(sw),(sz)/(sw)), the homogeneous vectors (x,y,z,w) and (sx,sy,sz,sw) are considered the same vector.    And then it just so happens that many operations on 3D vectors can be done much more elegantly on their homogeneous representation, most importantly, transformations like translation and projection become representable by just a matrix. Since for a 4x4 matrix a 4D vector and a scalar s, A(sx) = s(Ax), multiplying a homogeneous vector by a matrix is well defined, ie. if two vectors are equivalent (they represent the same 3D point, even while their 4D representation may be different), they will still be equivalent after they're multiplied with a matrix.
  11. quasar3d

    Quaternions products not preserving length

    Checking if lengths are multiplictive (ie. the length of a product is equal to the product of the lengths) is actually a very good way to check if your quaternion multiplication works well (if it's multiplicative, your multiplication code is either correct or very wrong, but not a little bit wrong:)). So this was already quite a hint that there was a problem with your multiplication.   Note that for any quaternion a * conj(a) gives the square euclidean length, and so   |a * b|^2 = a * b * conj(a * b) = a * (b * conj(b)) * conj(a) = a * |b|^2 * conj(a) = a * conj(a) * |b|^2 = |a|^2 * |b|^2
  12. quasar3d

    Does anyone use fixed point math anymore?

         I actually experienced floating-point determinism being varied across machines in an engine which 'planted' trees around terrain at game load time using a procedural method of creating potential points all over the terrain and checking the slope of the ground at those points one at a time before generating a new point to test, and in some cases it would throw off the scene generation algorithm so wildly that the two machines in the same game would be in two geometrically different worlds due to the PRN code becoming out of sync when some trees would get planted and others wouldn't based on floating point precision nuances in the slope check.   If both were running the same executable, then this really can't happen. The result of a floating point instruction is defined exactly (the rule is that it should return the nearest floating point number to the exact result, and round to even on ties). Also, if you don't have options like fast math enabled, then the same thing is true for C/C++ code (at least if it's IEEE 754 compliant), so it's likely that this difference was caused by something else.
  13. quasar3d

    Cross Product of Many Vectors

    This is exactly what least squares solves.
  14. quasar3d

    computer vision

    First hit on google for "computer vision book" gives<br /><br />http://szeliski.org/Book/<br /><br />where you can download a pdf for free!
  15. quasar3d

    Calculating the required rotation.

    There's indeed a most natural rotation. It's the one that leaves vectors perpendicular to the plane of A and B invariant. To derive such a matrix, note that any composition of 2 (or any even number of) reflections is a rotation. With this, you can easily construct a matrix that satisfies your requirements. Let S_1 be the matrix that reflects A to -A, and let S_2 be the matrix that reflects A + B to -(A + B). The composition S_2 S_1 is then your rotation matrix. In vectors, reflecting a vector x in a normal vector n is {eqn} x' = x - 2 n (n \cdot x) {/eqn} or in matrix notation, where vectors are column vectors {eqn} x' = x - n (n^T x) = (I - n n^T) x {/eqn} so your reflection matrix is then {eqn} I - n n^T {/eqn} so your rotation matrix, which rotates a to b {eqn} R = (I - \frac{(a + b) (a + b)^T}{|a + b|^2)(I + \frac{a a^T}{|a|^2}) {/eqn} EDIT: Can't get latex to work
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!