Python Forum

Full Version: Getting list of co-ordinates.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I'm quite new to Python so bear with me....
I am trying to get the co-ordinates of a semicircle (or semi-oval) with numpy (maybe I need some other module too/instead(?)) and output those numbers with e.g. numpy.savetxt, for the purpose of using them (the co-ordinates) as the inputs for a particular parameter (in an external graphics program command-line interface).
So for instance, if the start of my semicircle is at position '50,50' (of a 100x100 grid) and I wish the line of the arc to end at '100,75' - I would want the output to show me the co-ordinates of each pixel that the line (arc) goes through.
Hopefully that's understandable, can anyone help please?
Thanks.

I have had a look at the np.arctan2 function but can't work out if that's what I need..
It's ok I came up with the solution using np.linspace

ie, something like:

import numpy as np
x = np.linspace(50,100,1000)
y = np.linspace(50,75,1000)
np.savetxt('coords.txt', (x,y), fmt='%10.5f')

* although it doesn't describe an arc, merely a straight line (diagonal) any help with the semi-circle problem would be appreciated.