[Tutor] Python & algorithms (Lang line simplification algorithm)
Ben Finney
ben+python at benfinney.id.au
Tue Apr 15 02:23:09 CEST 2014
Laura Kauria <lacation at gmail.com> writes:
> Thanks a lot for all the help! I got the courage to start at least..
Congratulations! Courage is a necessary ingredient when starting :-)
Could you please avoid top-posting, and instead use interleaved style
<URL:https://en.wikipedia.org/wiki/Posting_style#Interleaved_style> for
your replies, so the conversation is in a natural order.
> I started by converting the pseudocode I had to python.
If it's short and simple, please post it here so we can discuss it in
context.
> Still I have problems with perpendicular distance and creating a line
> with python.
> I need to create a line between two points and then check what is the
> distance between a line and intermediate points which were between lines
> start and end point. If someone could help me with this? I could not
> understand can I do this without math library or not?
The ‘math’ module in the standard library has trigonometric functions
<URL:http://docs.python.org/3/library/math.html#trigonometric-functions>.
If you have co-ordinate data and know how to use trigonometry, then
those functions will do what you expect.
--
\ “If I melt dry ice, can I swim without getting wet?” —Steven |
`\ Wright |
_o__) |
Ben Finney
More information about the Tutor
mailing list