Technical questions
Post by iconPost by toxcct | 2017-11-10 | 14:58:56

Hi Cvetan & everybody reading this,

As you may be aware, I'm working on integrating your devs into a "much readable" (no offense though) polars chart, based on zezo's data.

Currently, I don't know yet how to get/extract source data from VR directly, and to rebuild a full polars dataset I could rely on, so I'm still using zezo's "ideal.png" files as a source.
So, if anyone willing to share how it can be done to rebuild a CSV file from what we can read in VR WebSockets packets, I'm interrested.


Anyway, as I'm changing my polars form to integrate the different options as you did with the 4 checkboxes replacing the later "Pro Sails", I have a few technical questions for you Cvetan.

Why did you choose the binary values 16/32/64/128 for the options Foils/LS/C0/HS respectively, instead of 1/2/4/8 for instance ?
I see that because of this, you have to do an additional bits shifting to get the right options set in load_polars() which I don't get why ((options >> 5) & 7).

Also, I noticed that you hardcoded the foils working frame in the foil_c() function, but don't you think it may vary from one boat to another ?

Another question I had in mind since weeks now is :
What the hell is this dubious factor '1.852' that I can find in several places in your code ?
I only understand that it's related to wind speed, but where does it come from actually ?


I'll share my work as soon as I have a stable version implemented, probably by the end of the week.


Thanks & best regards !
toxcct

commenticon 3 Comments
Post by iconPost by zezo | 2017-11-10 | 15:23:38
You are not a skipper in real life, no? ;-)

1.852 is the length of nautical mile in kilometers. I use kilometers because previous versions of the game used integer km/h for the wind speed and you could make the speed function simple table lookup and minimize rounding errors in the same time. Keeping it now because of the static definition of best sail - it's more precise this way, less error at crossover points.

For the source data you can use the native format unchanged - it's a 2D json array for each sail. I'll send you few samples. Actually equivalent to the old CSV

The other answers are consequence of my development process. You can't keep clean design if you want to hack together something like the separate sail feature in 4 hours or so)

The code is spit into 4 parts:

1) Broser javascript
2) Web server front-end (chart.pl)
3) Web server back-end (also perl) which draws the pngs and prepares the web page
4) highly optimized c program that does the actual calculation and outputs a coma separated list of lat/lon pairs.

When you make a change it propagates in all 4 places.

So the bits are 128, 64 and 32 because 1 2 and 4 were already taken by the friends (obsolete), timeshift and 4 was pro sails.

Oh, there is also
5) SQL Database where the text output is cached for reuse when you zoom in/out
The options are single number in the table and are checked to avoid caching problems when you change something, but not your origin/target points. And I have to keep backward compatibility because of the 6 different races/versions running right now.

A lot of stuff is hardcoded. I avoid doing unnecessary work, so if and when the foil coefficient changes I'll make it a config variable and propagate it via backend and frontend.

Hope that answers most of your questions. I'll send you email with few files soon.
Post by iconPost by toxcct | 2017-11-10 | 15:51:09
Yes it does, thanks for the quick answer.

And regarding your guess, I only sail my windsurf board, so I don't really deal with speed IRL:)

for the bitwise matter, I totally understand your explanation. Early optimization is the source of great pain :)

Thanks
Post by iconPost by zezo | 2017-11-10 | 16:13:13
Damn Google won't let me send a zip with js in it cuz it could be a virus.

So here it comes http://zezo.org/json_polars.zip

Contains original and/or formatted data. Unfortunately one of the formatters I used actually uglifies the vpp arrays (1 element/line).
border
Topics list
Posts
border
4
border
border
6
border
border
8
border
border
48
border
border
17
border
border
4
border
border
48
border
border
12
border
border
Copyright 2009 by ZEZO.ORG. All Rights Reserved.