Manish Jha
Manish Jha

Reputation: 40

Generate a sequence of 2D coordinates which trace a curve. eg. a circle

While working on a simple Radar simulator, I wish to be able to stream (x,y) coordinates of objects position. Generating object positions moving in random directions does not generate palatable results as it does not look like a path any normal object would take. I think having points which trace curves (parabolas, circles, sine curves etc.) with random constants can generate realistic results. How does one achieve a sequence of points which in order trace a given curve. I am using c#, but no need for the answer to be limited in that sense.

Upvotes: 0

Views: 384

Answers (1)

user1196549
user1196549

Reputation:

A possible method is to use a sequence of quadratic or Bezier arcs, preferably choosing the control points to ensure G1 continuity (same tangent at the connection points).

Depending on your need, you can sample a few points along every arc, or join them by Bresenham line segments to trave every pixel.

https://github.com/MtnViewJohn/context-free/wiki/Path-Declarations#bezier-control-points

Upvotes: 1

Related Questions