Python Forum
Getting list of co-ordinates.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting list of co-ordinates.
#1
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..
Reply
#2
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Create a list of co-ordinates from Mouse press events Jagruthi 0 1,475 Mar-12-2020, 08:46 AM
Last Post: Jagruthi

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020