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.
 Home
 » Viewing Profile: Reputation: quasar3d
quasar3d
Member Since 01 Dec 2001Offline Last Active Dec 03 2014 10:44 AM
Community Stats
 Group Members
 Active Posts 1,186
 Profile Views 2,861
 Submitted Links 0
 Member Title Member
 Age Age Unknown
 Birthday Birthday Unknown

Gender
Not Telling
#5188546 point & Octahedron relationship
Posted by quasar3d on 22 October 2014  10:39 AM
#5173371 Quaternion angle with itself > 0.001
Posted by quasar3d on 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 axisangles) 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.
#5114256 Quaternions and matrices
Posted by quasar3d on 04 December 2013  02:44 AM
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.
#5113366 Homogenous coordinates
Posted by quasar3d on 30 November 2013  05:11 PM
#5041813 Cross Product of Many Vectors
Posted by quasar3d on 11 March 2013  06:21 AM
This is exactly what least squares solves.
#5017425 Calculating the required rotation.
Posted by quasar3d on 04 January 2013  07:34 AM
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
#4896536 Math challenge (no particular purpose, prize = a 50% coupon on steam)
Posted by quasar3d on 22 December 2011  09:03 AM
#4887303 find rectangle around points on plane
Posted by quasar3d on 24 November 2011  10:46 AM
Also, right now you do the transpose after you add the translation part, even though you do use the last column instead of the last row for it. To fix this, either add the rotation to the last row, or do the transpose before you add the translation.
#4886910 Fourier transform on image  problem with sharpening filter
Posted by quasar3d on 23 November 2011  10:04 AM
#4886590 find rectangle around points on plane
Posted by quasar3d on 22 November 2011  09:38 AM
Yes, Kryzon gave an explanation how to switch betwen these two spaces.
Kryzon gave an explanation how to switch a space which has the plane with the points aligned on the x,y plane. This doesn't turn the bounding rect into an axis aligned one though.
#4879457 Create a sphere that intersects another at right angles
Posted by quasar3d on 01 November 2011  05:27 PM
#4870894 Fixed Point vs. Fractional Integers
Posted by quasar3d on 09 October 2011  04:44 PM
#4851730 LookAt matrix
Posted by quasar3d on 20 August 2011  03:28 PM
#4838001 Converting a polygon into the least number of triangles possible?
Posted by quasar3d on 20 July 2011  09:49 AM
#4817652 Gödelization  help needed.
Posted by quasar3d on 30 May 2011  02:38 PM
for example, the sequence of the first 4 squares (1,4,9,16) can be encoded as
2^1 * 3^4 * 5^9 * 7^16 = 10515106938037816406250