|
Hi
I have a bit of a math problem (related to graphics)
If i have three vectors and an origin representing an orthonormal system, how do i get the rotation matrix that would rotate the regular orthonormal system to this new one?
(by regular i mean at O(0,0,0) through i(1,0,0), j(0,1,0), and k(0,0,1) )
thanks for your time
|
|
|
|
|
The columns of the matrix are the orthonormal vectors of the new basis. So if the transformation is
i->V1
j->V2
k->V3
where {V1,V2,V3} are an orthonormal set, then the matrix
R={V1,V2,V3}
where V1 is the first column etc, is want you want. Check by using R to transform each of the original basis vectors i,j,k and check they end up in the right place.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Add Mathworld[^] to your bookmark. Been some time since I've done matrices :->
|
|
|
|
|
You need to apply a unitary matrix transform to your coordinates (http://en.wikipedia.org/wiki/Unitary_matrix). that is, if you have a point in R3 represented by the vector v_o, then v = U v_o is a rotated coordinate. You need a unitary matrix so that no coordinate in the new basis is scaled with respect to the original basis. Concretely, if you start with an orthonormal system you want to end with an orthonormal system.
See rotation matrices on wikipedia: http://en.wikipedia.org/wiki/Rotation_matrix for more details of making the appropriate R3 rotation matrix.
good luck
|
|
|
|
|
Why are you making this complicated? If he has the three new basis vectors then these are simply the columns of the transformation matrix. Simple matrix multiplication shows that the vector (1,0,0) goes to a vector equal to the first column of the matrix, (0,1,0) to the second etc. So if he has these three vectors (normalized) then he has his matrix.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Matrix Rotation
Rotation of the plane at the origin by angle @ has the following form
x |--> R@x
where R@ is the matrix
( cos@ -sin@ )
( sin@ cos@ )
This is a 2 x 2 matrix on for a unit square (0,0), (0,1) , (1,0) and (1,1).
|
|
|
|
|
I need a solution to a tedious problem please. I need to find a suitable equation that will model the Gateway Arch in St. Louis using suitable axes. I can use what is known as a catenary which is y=a/2(e^(x/a)+e^(-x/a)). Can you help me? I am desperate!!!!
|
|
|
|
|
Jbones wrote: I need to find a suitable equation
Sounds like you have found it:
Jbones wrote: y=a/2(e^(x/a)+e^(-x/a))
What's the problem?
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
if you need to fit catenary parameters then use least squares.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Have you tried regression
|
|
|
|
|
maybe was for the OP...wasn't it?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
There was me talking about linear regression and trend lines
|
|
|
|
|
Frank Kerrigan wrote: Grady Booch: I told Google to their face...what you need is some serious adult supervision.
|
|
|
|
|
I hate to admit that you don't get the best advice here, but if you google "Gateway Arch in St. Louis equation" and take the first hit....
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
I'm interested in earth map programming .
For instance , on a rectangular projected earth map ,
its easy to place cities by lat & long ,
but harder to draw great & small earth circles
like sunlight perimeters .
Also for earth pictures taken from space :
? what is "map" projection
? math for lat&long points
? math for earth circles
Please recommend good sphere math book for this .
Thanks , Jim D
|
|
|
|
|
|
I disagree. Well, not completelly, but suficiently.
In a growing civilization we are bound to always find people ready to go beyond. Their number will never reach zero. And I propose that the ability to solve problems and imagine solutions to problems is increasing not because people are becoming smarter but, instead, because generation upon generation we are allowed to build where others left off.
My proposition is not a simple one. Even the definition of "smartness" (is this a word??) is hard to define in this context. We need not only traditional "smartness" but also large amounts of memory, speed of reasoning, ability to correlate the uncorrelated, and (depending on the area of interest) a close contact to physics and the real world or the largest possible distance from it. We also need to find science interesting, and very often we have to be "smart enough" to select the right topic to research on.
Anyway, my proposition implies that as science (including mathematics) becomes more complex, we will always find people that are able to understand it and expand it. This is simple, we just have to start where others left off and resist the temptation of understanding everything from scratch. Many are good at that. This makes me confident that science as an art is not destined to disapear.
However, science as an art is becoming less and less important in our society. Today I see a booming necessity for the pragmatics. I call them that because they are people who know enough to get things to work, have a very developed intuition about where to focus their attention, and an extremely important ability to take complex abstract results that others developed and strip them down to the point where it becomes practical to do something with them (this strip down is an expansion in knowledge, not a reduction).
Please note that what I meant is that science as an art will probably never disapear, but there will be a breed that will be ready to take control of the progress of our civilization by using scientific results and findings and expanding them to aplicability.
Anyway, even if you (or your source) were right, if science as an art disapeared that would simply mean that it had become useless and uninteresting to absolutely everyone. That has not happened yet to the disco sound, so what is the real possibility of science as an art becoming useless and uninteresting to absolutely everyone?
Rilhas
|
|
|
|
|
I don't think I confused anything... you meant continuous [number system] as oposed to discrete [number system], right? If so then I stand by my argument. I don't think it is destined to come to an end, and I don't say that only about mathematics but about science in general (I was just trying to make a "larger" point).
Discrete mathematics has its own dificulties, it just avoids the problem of the "infinitely small". Who will address those issues if not continuous mathematics? Will someone ever say "I've reached the infinitely small, and now I find it boring... I'll just stop ellaborating on it". I don't think so, unless we find that the universe is not continuous. That could make continuous mathematics come to a halt when it reaches "that minimum". Do you believe that?
Although the first few words of your post address the issue of continuity, all the remaining text addresses the issue of exagerated complexity as a "show stopper". Even the conclusion of the message sugests that it is meant to be applied to mathematics as a whole. Anyway, I thought you were posting your message as a means of exchanging ideas, and not of publicizing books (please take no ofense). So I think that this is where I confused your post, since I didn't realize that your post was confined to continuity (for me there is no real issue there).
Anyway, I'm not a mathematician, just a guy sharing his thoughts.
Rilhas
|
|
|
|
|
guys, is there a function in C++ that shifts the elements of an array? lets say that i have an array of 20 elemetns and i need to shift it by one element to the right, then the last element should become the first and the first one will be the second and so on.....am not sure if its called circular shift or rotation or something like that. sorry
if there is no function, then how would you go about it? you need to save memory and processing time on small controllers.. thanks!!!
|
|
|
|
|
Hi,
AFAIK there is no such function available in the standard libraries.
The operation should be called rotation.
A buffer that gets used from 0 till dim-1 then back to 0 etc is called a circular
buffer.
Are you sure you need to move the data around, a circular buffer is used for
many purposes (e.g. between a producer and a consumer, using a put and a get pointer);
circular buffers may be optimized by using a dimension that equals a power of two
(so you dont need to test for wrapping around, you simply mask away the overflowing
bit).
If you must move the data over an arbitrary shift amount, you could use an existing
copy function twice:
-once for the part that moves to the right, and once for the part that moves to
the left; since source and destination overlap, you would need a temp buffer for
one of the moves.
Moving over only one position only needs one memcpy or similar, and one temp variable.
|
|
|
|
|
std::rotate from <algorithm>.
Steve
|
|
|
|
|
If U want to save memory and processing time,U should not shift the entire array.
Instead U can have a variable say idxStart.It must be first set to ZERO.
If U want to shift to the right do like this:
idxStart=(--idxStart+arrayLength)%arrayLength;
While referring the array elements always refer like:
for(i=0;i<arrayLength;i++)
cout<<array[(i+idxstart)%arraylength];
hope, this="" will="" help="" u.
=""
=""
<div="" class="ForumSig">Regards,
Arun Kumar.A
|
|
|
|
|
// CommandLine.cpp : Defines the entry point for the console application.
//
#include "StdAfx.h"
#include <iostream>
#include <algorithm> // for 'std::rotate' and 'std::copy'
#include <iterator> // for 'ostream_iterator'
int main()
{
using namespace std;
int numbers[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
int *pOnePastEnd = numbers + sizeof(numbers)/sizeof(numbers[0]);
cout << "Before rotate:" << endl;
copy(numbers, pOnePastEnd, ostream_iterator<int>(cout, " "));
cout << endl;
// Rotate left.
rotate(numbers, numbers+1, pOnePastEnd);
cout << "After rotate left:" << endl;
copy(numbers, pOnePastEnd, ostream_iterator<int>(cout, " "));
cout << endl;
// Rotate right.
rotate(numbers, pOnePastEnd-1, pOnePastEnd);
cout << "After rotate right:" << endl;
copy(numbers, pOnePastEnd, ostream_iterator<int>(cout, " "));
cout << endl;
return 0;
}
Steve
|
|
|
|
|
Thank you all for all the responses.. much appreciated..
I think i'll go with Arun's method of changing the index. Steve, i got a question.. how do i know about the functions in a library? dumb question, sorry! but not evrything is mentioned in the documentation. oh, yeah and thanks for the code...
|
|
|
|
|
I read a book on the STL. You could also look through the <algorithm> header file. C++ programmers should get acquainted with STL. I also recommend studying the Boost libraries.
Steve
|
|
|
|
|