Heads-I-Lose

Check-in [3022ce9541]
Login

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

Overview
Comment:Commit in haste: Repent at leisure. Fix reverse journey Had not actually tried out my changes, or, it seems, used my brain at all in making them. - Can't simply just add Pi on, need to keep it within 2*Pi limit - Also forgot to get compass direction
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | origin/master
Files: files | file ages | folders
SHA3-256: 3022ce9541de760391006547badd28ad90eea9e6b1837e2ddc4b8d2e3093ec5c
User & Date: base@atomicules.co.uk 2014-12-12 12:49:17
Context
2014-12-12
12:49
Bug fix - Forgetting than list indexes start at 1 Which means I also need to wrap around the list if I get 16 segments. I.e. both 0 rads and 2*Pi rads are valid. This means I probably could have just simply added Pi (previous commit) to reverse the journey as I can just keep wrapping around. Oh well. check-in: 598ec92c32 user: base@atomicules.co.uk tags: trunk, origin/master
12:49
Commit in haste: Repent at leisure. Fix reverse journey Had not actually tried out my changes, or, it seems, used my brain at all in making them. - Can't simply just add Pi on, need to keep it within 2*Pi limit - Also forgot to get compass direction check-in: 3022ce9541 user: base@atomicules.co.uk tags: trunk, origin/master
2014-12-11
22:37
Handle the reverse route I don't want to have to query OSRM for th ereverse route - it's pointless. Instead reverse the route we already have - because I don't actually need a properly ordered reverse route, just a list of directions and distances. In order to do this made sense to re-jig some of the functions a bit: - Need date and time at top level, not buried in get_weather since reverse route or normal route is also dependent on time of day - Don't convert to distances and compass directions in one swoop since it is easier to reverse the heading angles rather than compass points check-in: 935d1fbeae user: base@atomicules.co.uk tags: trunk, origin/master
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to headsilose.erl.

188
189
190
191
192
193
194
195








196
197
198
199
200
201
202
203
204
		end,
		Distance_headings_list).


reverse_journey(Distance_headings_list) ->
	%Don't actually need a correctly ordered reverse route, as long as we have directions and distances.
	lists:map(
		fun({Distance, Compass_direction}) ->








			Reverse_direction = Compass_direction + math:pi(),
			{Distance, Reverse_direction}
		end,
		Distance_headings_list).


get_compass_direction_for(Heading) ->
	%In a way this is a waste of time as could just do headwind, etc based on angles, but since already have some code, why not?
	Segment = 2*math:pi()/16,







|
>
>
>
>
>
>
>
>
|
<







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204

205
206
207
208
209
210
211
		end,
		Distance_headings_list).


reverse_journey(Distance_headings_list) ->
	%Don't actually need a correctly ordered reverse route, as long as we have directions and distances.
	lists:map(
		fun({Distance, Heading}) ->
			%Because can't have functions in guards
			Pi = math:pi(),
			Reverse_heading = if Heading < Pi ->
				Heading + Pi;
			Heading >= Pi ->
				Heading - Pi
			end,
			Compass_direction = get_compass_direction_for(Reverse_heading),
			{Distance, Compass_direction}

		end,
		Distance_headings_list).


get_compass_direction_for(Heading) ->
	%In a way this is a waste of time as could just do headwind, etc based on angles, but since already have some code, why not?
	Segment = 2*math:pi()/16,