| 05:58 | AnasHaddad[m] | <mstenta[m]> "If you want to start a forum..." <- we can use this discussion farmos.discourse.group/t/migrating-from- |
| 15:50 | 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. :-) |
| 15:51 | mstenta[m] | @room dev call in 10 minutes here: meet.jit.si/farmos-dev |
| 15:53 | symbioquine[m] | Bummer, hope you feel better soon! |
| 15:53 | mstenta[m] | Getting there... both kids had it already and are on the mend - I'm just a day or two behind them :-) |
| 15:54 | mstenta[m] | (obligatory "not covid") |
| 17:14 | 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: github.com/farmOS/farmOS/blob/509cfb2e92 |
| 17:15 | mstenta[m] | I had to do some clever stuff with rotations to simplify it... |
| 17:16 | * | sent a code block: libera.ems.host/_matrix/media/r0/downloa |
| 17:16 | symbioquine[m] | This is the meat of how I'm doing it in the land drawing tool; github.com/symbioquine/farmOS_land_drawi |
| 17:16 | mstenta[m] | i really like the UI of yours |
| 17:16 | mstenta[m] | and that it can do more than 1xN |
| 17:17 | mstenta[m] | (grids) |
| 17:17 | 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. |
| 17:18 | FarmerEd[m] | I was just going to say that 😂 |
| 17:19 | symbioquine[m] | The main tricky thing I'm doing is normalizing for distance =/= map units due to distortion of the projection. |
| 17:19 | mstenta[m] | oh wow, so it corrects for projection distortion? |
| 17:20 | symbioquine[m] | yeah, in a rudimentary way... |
| 17:20 | symbioquine[m] | github.com/symbioquine/farmOS_land_drawi |
| 17:21 | mstenta[m] | wowza |
| 17:22 | 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. |
| 17:23 | symbioquine[m] | I originally had to figure that out to make the snapping grid produce accurate area values... |
| 17:23 | 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) |
| 17:23 | mstenta[m] | github.com/farmOS/farmOS/blob/509cfb2e92 |
| 17:24 | symbioquine[m] | Hah, I'm glad OpenLayers takes care of that bit :) |
| 17:24 | mstenta[m] | yes! me too. glad we haven't had to port that code to v2 :-) |
| 17:24 | mstenta[m] | although maybe we will... if we need areas in PHP eventually |
| 17:25 | mstenta[m] | that was always a bit odd in v1, though... the slight difference between OL and PHP calculations |
| 17:26 | symbioquine[m] | Could be different rounding of the coefficients/constants or different floating point handling even |
| 17:26 | mstenta[m] | perhaps we can avoid it in PHP though and just provide a way to store a value (eg: www.drupal.org/project/farm/issues/30519) |
| 17:26 | mstenta[m] | yeaa |
| 17:27 | mstenta[m] | (that value could be calculated client side, or wherever... just not in PHP, if we can avoid it) |
| 17:31 | mstenta[m] | makes me wonder if anyone's made a JS parser in PHP 😆 |
| 17:32 | symbioquine[m] | I was just thinking that |
| 17:32 | mstenta[m] | ha! www.php.net/manual/en/book.v8js.php |
| 17:32 | mstenta[m] | ... because of course |
| 17:32 | mstenta[m] | > This extension embeds the V8 Javascript Engine into PHP. |
| 19:46 | symbioquine[m] | A bit off-topic, but one can certainly go off the deep-end with embedding JS runtimes; github.com/emscripten-core/emscripten/is |
| 19:48 | symbioquine[m] | ... and also www.figma.com/blog/how-we-built-the-figm |