[01:58:58] | <AnasHaddad[m]> | <mstenta[m]> "If you want to start a forum..." <- we can use this discussion https://farmos.discourse.group/t/migrating-from-farmos-v1-to-farmos-v2/1243 |
[11:50:38] | <mstenta[m]> | Hey all - I've got a sore throat/cough. I may join the dev call today, but I probably won't talk much. Or at least I will try not to. :-) |
[11:51:31] | <mstenta[m]> | @room dev call in 10 minutes here: https://meet.jit.si/farmos-dev |
[11:53:16] | <symbioquine[m]> | Bummer, hope you feel better soon! |
[11:53:56] | <mstenta[m]> | Getting there... both kids had it already and are on the mend - I'm just a day or two behind them :-) |
[11:54:05] | <mstenta[m]> | (obligatory "not covid") |
[13:14:31] | <mstenta[m]> | symbioquine: FYI here is the PHP function in v1 that was responsible for generating beds, given a bounding polygon, number of beds, and orientation: https://github.com/farmOS/farmOS/blob/509cfb2e928ef7537977a0f53eb93ee12a... |
[13:15:17] | <mstenta[m]> | I had to do some clever stuff with rotations to simplify it... |
[13:16:06] | <mstenta[m]> | ACTION sent a code block: https://libera.ems.host/_matrix/media/r0/download/libera.chat/4cd45e3f3f... |
[13:16:27] | <symbioquine[m]> | This is the meat of how I'm doing it in the land drawing tool; https://github.com/symbioquine/farmOS_land_drawing_tool/blob/73300ea948b... |
[13:16:47] | <mstenta[m]> | i really like the UI of yours |
[13:16:58] | <mstenta[m]> | and that it can do more than 1xN |
[13:17:05] | <mstenta[m]> | (grids) |
[13:17:51] | <symbioquine[m]> | I basically calculate two unit basis vectors given the two anchor points (origin/rotation), then iterate over the grid and use those basis vectors to calculate the corner coordinates of each of the polygons. |
[13:18:29] | <FarmerEd[m]> | I was just going to say that 😂 |
[13:19:23] | <symbioquine[m]> | The main tricky thing I'm doing is normalizing for distance =/= map units due to distortion of the projection. |
[13:19:50] | <mstenta[m]> | oh wow, so it corrects for projection distortion? |
[13:20:09] | <symbioquine[m]> | yeah, in a rudimentary way... |
[13:20:58] | <symbioquine[m]> | https://github.com/symbioquine/farmOS_land_drawing_tool/blob/73300ea948b... |
[13:21:41] | <mstenta[m]> | wowza |
[13:22:38] | <symbioquine[m]> | The spherical distance of going one map unit South or West isn't always 1 meter depending where on the map you are. In some places it can make a pretty big difference. |
[13:23:06] | <symbioquine[m]> | I originally had to figure that out to make the snapping grid produce accurate area values... |
[13:23:11] | <mstenta[m]> | oh man this reminds me of something similar i needed to learn when i was coding the "calculate area of a polygon" in v1 (in PHP) |
[13:23:31] | <mstenta[m]> | https://github.com/farmOS/farmOS/blob/509cfb2e928ef7537977a0f53eb93ee12a... |
[13:24:31] | <symbioquine[m]> | Hah, I'm glad OpenLayers takes care of that bit :) |
[13:24:49] | <mstenta[m]> | yes! me too. glad we haven't had to port that code to v2 :-) |
[13:24:58] | <mstenta[m]> | although maybe we will... if we need areas in PHP eventually |
[13:25:17] | <mstenta[m]> | that was always a bit odd in v1, though... the slight difference between OL and PHP calculations |
[13:26:34] | <symbioquine[m]> | Could be different rounding of the coefficients/constants or different floating point handling even |
[13:26:43] | <mstenta[m]> | perhaps we can avoid it in PHP though and just provide a way to store a value (eg: https://www.drupal.org/project/farm/issues/3051971) |
[13:26:45] | <mstenta[m]> | yeaa |
[13:27:06] | <mstenta[m]> | (that value could be calculated client side, or wherever... just not in PHP, if we can avoid it) |
[13:31:34] | <mstenta[m]> | makes me wonder if anyone's made a JS parser in PHP 😆 |
[13:32:02] | <symbioquine[m]> | I was just thinking that |
[13:32:07] | <mstenta[m]> | ha! https://www.php.net/manual/en/book.v8js.php |
[13:32:19] | <mstenta[m]> | ... because of course |
[13:32:54] | <mstenta[m]> | > This extension embeds the V8 Javascript Engine into PHP. |
[15:46:06] | <symbioquine[m]> | A bit off-topic, but one can certainly go off the deep-end with embedding JS runtimes; https://github.com/emscripten-core/emscripten/issues/9314 |
[15:48:04] | <symbioquine[m]> | ... and also https://www.figma.com/blog/how-we-built-the-figma-plugin-system/ |