# quasar3d

Members

1188

## Community Reputation

814 Good

• Rank
Contributor

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.
2. ## 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.
3. ## 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/).
4. ## 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.
5. ## 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.
6. ## Calculating the polygon outline from the set of overlapping polygons

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.
7. ## Why is Guass method better for finding determinants of a 3x3 and 4x4 matrix?

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.
8. ## 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.
9. ## 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.
10. ## 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
11. ## 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.
12. ## Cross Product of Many Vectors

This is exactly what least squares solves.