Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 01 Dec 2001
Offline Last Active Jun 13 2016 04:48 AM

Posts I've Made

In Topic: Quadratic equations trouble

27 July 2015 - 04:06 AM

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




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.

In Topic: Delaunay Traingulation

03 March 2015 - 06:43 AM

Just a quick question, do you want a Delaunay Triangulation, like your title suggests, or do you want a Voronoi mesh, like your post suggests? If you're calculating a Voronoi with the end goal of turning it into a Delaunay, then there are far easier ways to do it.


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

In Topic: Calculate volume of non-convex polyhedron

13 November 2014 - 08:35 AM

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/).

In Topic: point & Octahedron relationship

22 October 2014 - 10:39 AM

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.

In Topic: Quaternion angle with itself > 0.001

13 August 2014 - 10:58 AM

Hey guys,

I'm in the process of working out my math library, and so I was testing out a function that returns the angle between two quaternions..

{ return 2.0f * acos( Abs( Dot4( qa, qb ) ) ); }


.. but for some reason, I'm either getting a lot of floating point error in the result, or I'm not checking for a situation that I should be. While testing a quaternion (which was generated by a random axis+angle rotation and appears to be very close to normalized)..

{ x=0.0172970667 y=-0.0245058369 z=0.0205858145, w=-0.999337912    }

.. with itself, I'm getting a result angle of 0.00138106791 (or almost 0.1 degrees)..


I'm just wondering if this is acceptable error when working with float variables? And is there anything I can do to improve this issue other than switching to double type or something else as drastic?


edit note: After testing some more, the highest "error angle" I've been able to generate (through random axis-angles) is 0.001953125. And that was getting the angle (from itself) of a quaternion generated by the axis @ angle: { -0.833756,0.551120,-0.033417 @ 2.960138559341 } (quaternion result: { -0.830327,0.548853,-0.033279,0.090603 } )


Thank you


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.