• Advertisement
Sign in to follow this  

interesting problem - help !!

This topic is 4804 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi all, i've an interesting problem to be solved - i've described my solution also but would like to hear if therez a simple one to that. here is the problem, Within a circle, find whether a moving pt. has passed the target pt.; moving pt. can either rotate in anti-clockwise (+ve rotation) or clockwise (-ve rotation). but it is given that the moving pt. is always to the left of target pt. during +ve rotation and it is to the right of target pt. during -ve rotation when viewed from outside the circle. solution:: if (+ve rotation) { assume the target is always 2pi; if (initial target is 2Pi or 0 ) { untouch the moving pt.; } else { displace the moving pt. by targetPt. value; // if target is in 1st quadrant & moving pt. in 4th quadrant if (moving pt. < 0) { moving pt. += 2Pi;} } if (moving pt. > 360) { moving pt. passed target pt. } } else if (-ve rotation) { do the other way with target value assumed to 0.... } appreciate ur inputs.... .kavitha

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement