Heads-I-Lose

Check-in [915a1fb3d0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge branch 'master' into osrm

Noticed the nth_wrap problem whilst developing this osrm branch as
building the list of winds would be incomplete.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | origin/master
Files: files | file ages | folders
SHA3-256: 915a1fb3d0c60c731485d0633baf7a76e5f54b91b684e3b84850991873e49693
User & Date: base@atomicules.co.uk 2014-11-29 17:42:05
Context
2014-11-29
17:52
Yay! Working prototype. Will sum up the distances of headwinds...

...for a polyline route.

I'd made silly mistakes like forgetting which order the list of tuples
were in. I.e {Distances, Wind} or {Wind, Distances}. It doesn't really
matter which order I use, but I should back sure it is consistent and
matches the variable naming.

Now need to extend this to sum up all wind directions and check for
other bugs (such as sum of distances making sense, headwinds are
actually headwinds and not tailwinds, etc). check-in: 289839a15d user: base@atomicules.co.uk tags: trunk, origin/master

17:42
Merge branch 'master' into osrm

Noticed the nth_wrap problem whilst developing this osrm branch as
building the list of winds would be incomplete. check-in: 915a1fb3d0 user: base@atomicules.co.uk tags: trunk, origin/master

17:34
Bug fix - nth_wrap didn't work for last items in a list

I only noticed this just recently, which means it has been wrong for
about a year! I think it's just luck I'd never come across an issue with
it not working.

I don't know if I'd got half way through writing this and forgot to
finish it off, or whether I was just being an imbecile: If the remainder
is 0 then that should return the last item in a list, not just the
number 1. Leaf check-in: 76eac348fc user: base@atomicules.co.uk tags: trunk, v1.1.0

2014-11-28
21:29
Make use of atan2 unsigned

Hadn't realised it returns negative numbers. check-in: 0fe524de48 user: base@atomicules.co.uk tags: trunk, origin/master

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to headsilose.erl.

110
111
112
113
114
115
116
117

118
119
120
121
122
123
124


nth_wrap(N, List) ->
	Rem = N rem (length(List)),
	if Rem > 0 ->
		lists:nth(Rem, List);
	Rem =:= 0 ->
		1

	end.


find_next_day(Date_today) ->
	%get in seconds
	Seconds_today = calendar:datetime_to_gregorian_seconds(Date_today),
	Date_tomorrow = calendar:gregorian_seconds_to_datetime(Seconds_today+86400),







|
>







110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125


nth_wrap(N, List) ->
	Rem = N rem (length(List)),
	if Rem > 0 ->
		lists:nth(Rem, List);
	Rem =:= 0 ->
		%Get last of list
		hd(lists:reverse(List))
	end.


find_next_day(Date_today) ->
	%get in seconds
	Seconds_today = calendar:datetime_to_gregorian_seconds(Date_today),
	Date_tomorrow = calendar:gregorian_seconds_to_datetime(Seconds_today+86400),