57716

Add a vector to a position

Question:

I have an object in 2D space whose position is (A, B) and which has an orientation (between 0 and 360). I have a distance, say D. I would like to add D to the object's position, in the direction that the object is looking toward.

Mathematically, how would I go about doing that? Thank you.

Answer1:

The result would be:

(X,Y) = (A,B) + D*(cos(O),sin(O))

<em>Edit:</em> The vector equation is equivalent to:

X = A + D*cos(O)

Y = B + D*sin(O)

Recommend

  • Matrix3D for a positive rotation around z in WPF
  • How do I write Big O-notations
  • rgeos gIntersection in loop takes too long to clip path network
  • Flooring timestamp to second
  • Could be Text orientation of JTextArea changed by keyboard shortcut?
  • GCC Inconsistent compilation error 'has no member named ' [duplicate]
  • Passing unspecialized template as a template parameter
  • how to calculate distance between two points in google maps?
  • draw a B+ tree in latex
  • Put percent labels next to legend instead of in the slice
  • HABTM associations in Rails : collecting and counting the categories of a model's children
  • Complex Silverlight TreeView, is nested hierarchy possible?
  • C++ Armadillo Access Triangular Matrix Elements
  • Multibinding Multiselection ListView
  • Guava how to copy all files from one directory to another
  • runtime-check whether an instance (Base*) override a parent function (Base::f())
  • Using MouseListener to select a range of cells in a grid
  • Is it possible to define rest argument in OCaml?
  • Is there a package like bigmemory in R that can deal with large list objects?
  • Django model inheritance, filtering models
  • RxJava debounce by arbitrary value
  • How to determine if there are bytes available to be read from boost:asio:serial_port
  • GridView breaks while scrolling
  • Blackberry - Custom EditField Cursor
  • one Local Olampyad Questions on Informatic in 2011
  • How to avoid particles glitching together in an elastic particle collision simulator?
  • Body moving without any force applied? (Box2d)
  • Initializer list vs. initialization method
  • Splitting given String into two variables - php
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • 0x202A in filename: Why?
  • AT Commands to Send SMS not working in Windows 8.1
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Angular 2 constructor injection vs direct access
  • How do I configure my settings file to work with unit tests?
  • Java static initializers and reflection
  • Android Google Maps API OnLocationChanged only called once
  • How does Linux kernel interrupt the application?
  • Is it possible to post an object from jquery to bottle.py?
  • UserPrincipal.Current returns apppool on IIS