Calculating a coordinate from 2 given 1-dimensional lines [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What is the and optimal method, if not the best, for doing it?
Assume that I have an object that has 2 wheels. The only information I have available is how far the wheels have rolled at any time.
Basically, I want to know how to calculate the coordinates (x2,y2)
I put this question on the programming section because I want to solve this with an algorithm or plainly put, by programming (in c++).

Given that you have how far the wheels have rolled at any time, it means that you have two functions of time w1(t) w2(t) giving the distance covered by the wheels.
from that you may by derivation get the scalar velocity of each wheel as v1(t) and v2(t).
As your object position is the mean between the position of those two wheels, the velocity of your object is the mean of those two velocities, but the difference of the velocities gives the speed of rotation of the object. So you have essentially a velocity described as a scalar velocity plus a rotation speed.
By integrating that vectorial quantity you may arrive to the current position of your object.
Details must be thought carefully, but the idea I think is that.

Related

OpenGL - How to track a moving object? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I want to learn how I can track a moving object in OpenGL. The position of the object will be a continuous input. Also, what if when the object moves out of the screen?
You have to position and orient your camera towards the object. That means you will have to provide the correct View Matrix.
You can use functions such as gluLookAt() to generate a View Matrix that points towards a specific object.
If you don't know what a view matrix is, I suggest looking at this tutorial (http://learnopengl.com). Check out this page which explains cameras matrices work in openGL

Is there any further steps to calculate phase after dft? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am trying to find magnitude and phase of fourier transform. There is an tutorial Opencv.
After using this formula, we are going to switch to a logarithmic scale and shifting normalizing. But I could not find for phase. Phase formule is :
Here is the question after arctan calculation, do I need to do extra stuff like magnitude(log scale,shifting,normalizing)? Or what is the logic behind it I could not understand? I am programmer guy and I am very far from these Math stuff.
The arctan range is (−π, π]. Hint: use std::atan2. You may indeed shift this to [0, 2*π) if you like. This is in no way necessary, it just avoids negative numbers.
Scaling to 360 degrees is also possible, but very rare - math is always done in radians, degrees are only for human consumption, and which human is going to look at FFT magnitudes?
Log scales are utterly pointless for angles, as they are modulo 2π.

Interpolation of geographical coordinates c++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm searching for solution of my problem.
I have some geographical coordinates like this:
Lat. 32.5327 Lon. 95.5019 time 15:44:44
Lat. 32.5339 Lon. 96.1439 time 15:48:31
It's position of some object and time when it was in that position.
What i need is to check in some interval of time(30 seconds for example), what was the position of the object between these points.
Interpolating over a sphere and finding the shortest path between two points would require for example Slerp.
But for distances less than 100km you will end up with a line (more or less) so do not bother and do a linear interpolation.
As #chux pointed out: linear interpolation will exibit significant artifacts when interpolating near the poles.

Choice between 1-dimensional and 2-dimensional array [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm implementing the Chessboard class to represent the chessboard. I've to implement the transformations (reflections and rotations) on the chess board possible.
The possible transformations includes the combination of:
1. Vertical Reflection
2. Horizontal Reflection
3. Diagonal Reflection
Thus, we've 8 possible transformations for chess board.
There are 64 squares on the Chessboard numbered [0..63].
Thus, to represent the total resulting values after the transformations is 8*64 (No.of Transformations * Chessboard_Size).
There are two fundamental ways to represent the transformed_board using Arrays:
One-Dimensional Array with transformed_board[8*64]
Two-Dimensional Array with transformed_board[8][64]
Questions:
Which approach is better?
What are the pros and cons of each approach?
How will effect the performance with respect to time factor?
The memory layout is the same for both, so there isn't really any "real" difference whatsoever. It's just a matter if whether you want the compiler to do the offset calculation for you or not, so just go with the syntax you like better.

C++ comparing two value to find which is closest to user input value [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have been looking on the internets for a while to find a solution to my problem. First some back ground. I'm writing a program that calculates catapult trajectory. The user must first type in a distance. Then I loop through the combinations of angle degrees and velocity to find which combination will give a distance that will come the closest to the users input. I don't quite know how to do the variable comparison to find which combination of degrees and velocity produces a distance closest to a users input of distance. I'm just trying to keep it simple and easy as possible. Also, I'm not using any kind of array to store the values. I want it done on the fly inside my for loops if possible. Any suggestions?
Well, the answer to this depends on the complexity of your trajectory formula. I'm guessing that you're not taking fluid dynamics or gravity differentials into consideration. In fact, what I imagine is that you're using a basic parabolic equation...
That equation can be solved directly by rearranging. But the thing is, you're solving for two variables that are actually co-dependent. There are infinite solutions if you allow both angle and velocity to vary, so you need to restrict the 'best' answer by some criteria (for example, desired angle or desired velocity).
If you have more variables, like lift, drag, spin, incident shape, non-constant gravity, air pressure and humidity, then you will need to employ a minimization algorithm which is non-trivial. One of the most basic, but a little unstable, is the Nelder-Mead algorithm.
If this has not been helpful enough, you should provide more information about your problem, and show some code.