atan2


Determine the coordinates of a segment


How can I use atan2 to determine the coordinates where a segment ends, knowing the coordinates where it starts (x, y), the angle of the segment and the length of the segment?
Can you tell me a solution it doesn't have to be only with atan2...
You have a right angled triangle and you can assume that the point A is at (x,y), this is much easier to explain with the use of some diagrams:
Now we know what the value for c is already because this is the length of the segment and we want to know the values for a and b because the final point is at (x+b, y+a)
From trigonometry we know what the relations between the angles and the ratios of the sides are
sin(theta) = opposite/hypotenuse and cos(theta) = adjacent/hypotenuse
Substituting in the values we know we get:
sin(theta) = opposite/c
c = opposite * sin(theta)
and
cos(theta) = adjacent/b
b = adjacent * cos(theta)
We know that the end point is at (x+b, y+a) which given the values for the edges we found is (x+adjacent * cos(theta), y+opposite * sin(theta))

Related Links

considering the second quadrant ( where x<0 and y>0) as the first quadrant how will i use the function atan2(y,x) to calculate the directions
Determine the coordinates of a segment
Limiting atan2 to specific angle ranges

Categories

HOME
url-redirection
notepad++
twitter-bootstrap-3
telegram
twig
character-encoding
flex
youtube-data-api-v3
battery
jwplayer
solaris
cq5
maxscript
azure-container-service
rtf
angular-dart
shared-libraries
do-while
altera
cgbitmapcontext
ios10.2
hta
epsilon
displaytag
siri
stackexchange
exchangewebservices
ceylon
xbox
postback
complex-numbers
rselenium
dsx-desktop
protege4
openproject
playframework-2.1
xcode7.3
zoomify
loading
news
doc
dbnull
logback-groovy
signal-strength
magic-draw
modelsim
headless
mach-o
stripe-connect
reporting-services-2012
lrs
adafruit
tooleap
kango-framework
redis-cluster
beanstalk
terracotta
rewrite
google-books
android-launcher
typemock
wso2greg
teamcity-9.1
kubuntu
ejb-2.x
uncaught-typeerror
metatrader5
ray
maven-scm
twitter-bootstrap-rails
koala
ecslidingviewcontroller
scrypt
script#
tlf
scringo
mvc-editor-templates
merb
actiondispatch
insert-id
fb.ui
web-notifications
android-loadermanager
tree-balancing
fragmenttransaction
box2d-iphone
saxparseexception
jqote
cdonts
uideviceorientation
ie-compatibility-mode
cruisecontrol.rb
asynchronous-wcf-call
escrow

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App