This is exactly what least squares solves.
- Viewing Profile: Reputation: quasar3d
Community Stats
- Group Members
- Active Posts 1,178
- Profile Views 1,552
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
User Tools
Contacts
quasar3d hasn't added any contacts yet.
#5041813 Cross Product of Many Vectors
Posted by quasar3d
on 11 March 2013 - 06:21 AM
#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
#4802277 Total area of overlapping circles
Posted by quasar3d
on 24 April 2011 - 06:10 AM
If you actually need the area, then I think a simple way to do it is:
- compute the intersection points of all pairs of circles
- discard points that lie outside any other circle
- compute the convex hull of these points
- compute the area as the area of the convex hull polygon, plus the area of the parts between each edge of the convex hull, and the corresponding circular arc.
There are probably many ways to do the first two steps quicker than N^2
Let me know if this is clear. I can probably draw some pictures to clarify things a bit.
But if you only need to know whether they intersect at all, then there are probably easier solutions.
I want to calculate the overall unique coverage of my units' FOV (which are all circular). Luckly I don't need to do this every frame, but I can expect to have up to several dozens of circles that can overlap each other partially, fully ot not at all, although as a game-specific dynamic, there should not be any disjoint circles (that is, there can be, but I'm interested in the total coverage of all circles that are chain-connected to one control circle).
I'm having some trouble coming up with a a solution that is both fast and reasonably exact. Truth be told, since this is for a game, I'm not bound by any ground rules and could simply opt for a tile coverage count (which should be doable in linear time); however, the problem itself intrigues me and I'm wondering if I could do away with the N^2 intersection tests that I'm guessing I'm stuck with if I want an exact method.
PS - even though this might seem like a school assignment, it is not.
You don't have to do N^2 intersection tests if you have a scenegraph of some sort, for a 2D game you could simply split the level into section, then you simply only run tests against units in the same or neighbouring sections. (It will reduce the worst case scenario slightly, and depending on section size (Which would have to be atleast as big as the biggest FoV for the method to work).
also, checking if 2 circles intersect eachother is extremely fast (just compare the sqared distance with the squared sum of the circles radius) (The reason for comparing squared values is that it eliminates the need to calculate the square root in the distance calculation)
You can have a set of circles that all mutually intersect, but which still have an empty total intersection.
- Home
- » Viewing Profile: Reputation: quasar3d


Find content