You are not logged in.
ok tell me about -ve angle .. Does -ve angle not good ?
or There is not any -ve exist . i am not sure about that .
if so and i get -ve angle how can we make it +ve ???
ahh i see . ,,
Actually i want to apply angle because that may help me in future regarding this project ,.
That's way i am preferring angle..
I am online ., infact you appeared offline . .:(
Hi ,
Output :
program should print your direction of your particles according to quadrant where it leads .
like particles are at right side or left side . or Program should print particle location in a quadrant.s.
Hi bob bundy,
Well, i used like this
double deltaX = curntBar_x - prevBar_x;
double deltaY = curntBar_y - prevBar_y;
double x = pow( deltaX , 2 );
double y = pow( deltaY ,2 );
double distance = sqrt( x + y );
cout<< " Distance : " << distance << endl;
cout<< endl;
cout<<" deltaX : " << deltaX <<endl;
cout<<" deltaY : " << deltaY <<endl;
//double angle = curntBar_x - prevBar_x / distance ;
double angle = atan2 ( deltaY , deltaX );
angle = angle * ( 180 /PI ) ; //angle in degree
//angle = angle - 90;
cout<< " Angle: " << angle <<endl;
if ( ( (-5 < deltaX ) && ( deltaX < 5 ) ) && ( ( -5 < deltaY ) && ( deltaY < 5 ) ) )
{
cout<<" Hand not move .. "<<endl;
}
else if( ( ( deltaX > 5 ) || ( deltaX < -5 ) ) && ( ( deltaY > 5 ) || ( deltaY < -5 ) ) )
{
if( ( 135 > angle ) && ( angle > 0 ) )
{
move right
}
else if( ( 315 > angle ) && ( angle > 135 ) )
{
move left
}
}
just problem is the angle comes -ve .. what should i do if angle come -ve .
I ignored angle -ve problem .
bob bundy : I want to add you on face book .
I maked a maths community . i need mathematician like you in our community.
Can i please add you if you do't mind . Please thanks
also if i consider periodic function then
and if angle comes -ve and add 360 in that .. can angle then make +ve ?
Well i got an angle .,but some times my angle come -ve . .
Say , x and y can be -ve and +ve
but angle
ok for example
i have -x and -y
what could be angle
It should be in 3rd quadrent
Does it mean angle here is -ve
or more then 180 and less then 270 , comes in 3rd quadrentand make angle -ve
is ti ?
I need 1st and 3rd quadrant so say angle is in between 180 and 270 , that mean 3rd quadrant ,.
Does ti mean angle in 3rd quadrant is -ve ?
if angle can't be -ve then how can i make it +ve ?
I have detected my hand from center point of pal m.
I maintained current and previous location of my hand w.r.t center point .
I need to find angle of center point of palm . and then apply the condition for hand moved to left side or right side .
...
Problem is angle. I have tested two ways or method for finding an angle of center point of palm .
1. firstly , I tested angle using concept " change in y - axies w.r.t distance between current and previous location . " .
formula for that : SIN (angle) = abs(p1.y-p2.y)/sqrt(
(p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y))
but this method give me angle near to 0.0144454 or some thng like that which is almost near to 0 . either my hand move to left side or right side .
2. Secondl method :
If i consider the unit circle .then i tested angle using atan( y /x ) which give me result also -0.0545454 some thing like that .
So i am confus regarding angle .. for finding the hand direction ..
But i am thinking if i consider a reference point O ( 0 , 0) and then using vector concept , apply dot or cross product and get angle .
I am not sure . Can some one please guide me thanks
Please help me urgently thanks
Hi Bob,
Sorry, I did not read your recent message .
As i told you, I am doing project hand motion direction . i need to find an direction of my hand motion . like moving hand angle in which quadrant .
I got an idea .
If my hand have location current and previous say A(x1,y1) and B(x2,y2) .. then to find an angle i need third point in plane .
So, i am thinking that if we consider Origin as third point say O(x3,y3) .
then using vector concept . we can get the hand angle in plane .
Right ? ok ?
And we can get two vectors says OA and OB ,. and then we can find angle of hand motion . right ???
Is that ok ??
Please guide me thanks
Model
Hi Bob,
I did as you said . about the right and left side ,
But my finger is continuously moving from left to right in different angles.
and i set
if x1-x2 > 0 then Print 1( right side movement )
else if x1 -x2 < 0 then Print -1 ( left side movement mean)
else Print 0 (moment in no specific direction .)
But Since my hand or finger whatelse moving in different direction. So, i think angle is also important.
btw, Can you please tell me formula for angle between 4 points
i found this formula:
abs(p1.y-p2.y)/sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));
I think above formula is good to find the angle in specific direction and distance .
What do you say ?
Well @Bob , I changed my condition regarding angle direction to eat side or west side .
if( angleInDegree <=90 || angleInDegree > =0)
{
cout<<"move to right side.."<<endl;
}
else if ( angleInDegree <=180 || angleInDegree >= 91 )
{
cout<<"move to left side.."<<endl;
}
Is that now ok ?
Hi Bob,
I hope you are fine . Sorry, for late reply .
I am using c++ VS 2010.
Actually i need to find my hand motion direction.
So, i find the angle .. Is that correct ?
Then i need to detect the hand direction like right side mean East , or left side == west .
So, i applied condition by considering Cartesian coordinates . Is that condition right ?
yes angle is in double .
Your statement : "The function atan will return the 'principle value' ; most likely this will be an angle between -90 and +90."
if the atan return angle in between 90 and -90 . then i think its good to check that finger move to right(east side) or left(west side) .
What do you say ?
Please suggest me .
Thanks
Cheers,
Rabi...:)
Hi all,
Say my finger location is x1 = 236 , y1 = 105 , x2 = 126, y2 =123 .
where
x1.y1 ==> current location and
x2,y2==> previous location
And i have distance computed using
dis = sqrt( (x2-x1)^2 - (y2-y1)^2 )
say angle is 60 degree .
Now, How far my finger move w.r.t its angle and what is its spead at given time 1sec ???? ?
Angle in between two points with x , y coordinates
//two points with x and y coordinates
int x1 = 100 , y1 = 50, x2 =250, y2 =70;
//distance b/w them
int X = x1 - x2;
int Y = y1 - y2;
int x = pow((double)X,2);
int y = pow((double)Y,2);
int d = abs( sqrt( (double)x + (double)y ) );
int angleInRadian = atan2((double)Y,(double)X); //angle in radian
int angleInDegree = angleInRadian * 180 / PI;
cout<<"Radian Angle between two Points .."<< angleInRadian <<endl;
cout<<"Degree Angle between two Points .."<< angleInDegree <<endl;
Output:
Radian Angle between two Points ..-3
Degree Angle between two Points ..-171
Edited code:
Well I changed my condition ,..
if( angleInDegree >240 || angleInDegree > 45)
{
cout<<"move to right side.."<<endl;
}
else if ( angleInDegree <330 && angleInDegree > 91 )
{
cout<<"move to left side.."<<endl;
}
but i ma afraid if angle straight mean 180 or angle is < then 45 ... I did not consider that ...
Modified Condition :
Now i modify the condition that better handle all 4 quadrant.
modified condition for the above code:
if( angleInDegree <225 || angleInDegree > 0)
{
cout<<"move to right side.."<<endl;
}
else if ( angleInDegree <360 || angleInDegree > 91 )
{
cout<<"move to left side.."<<endl;
}
I think its better condition.. that cover complete quadrant ..
Well Is the condition still need to modify ?
Please help me thanks