Ticket UUID: | fb4812f82b4894d5b80c0594944cffec516cd3d6 | |||

Title: | math::geometry::direction and octant counts clockwise instead of counterclockwise | |||

Type: | Bug | Version: | 1.20 | |

Submitter: | fredCAD | Created on: | 2020-08-15 14:01:08 | |

Subsystem: | math :: geometry | Assigned To: | ||

Priority: | 5 Medium | Severity: | Minor | |

Status: | Closed | Last Modified: | 2023-12-02 19:23:42 | |

Resolution: | None | Closed By: | arjenmarkus | |

Closed on: | 2020-09-20 12:25:10 | |||

Description: |
the math:geometry package determines 90° -> 0 -1 while sin(90°) is 1 270* -> 0 1 while sin(270°) is -1 Description for math::geometry::direction: Given the angle in degrees this command computes and returns the unit vector pointing into this direction. The vector for angle == 0 points to the right (up), and for angle == 90 up (north). examplee: foreach angle {0 90 180 270 360} { puts " $angle -> [::math::geometry::direction $angle]" } results in: 0 -> 1.0 -0.0 90 -> 6.123233995736766e-17 -1.0 180 -> -1.0 -1.2246467991473532e-16 270 -> -1.8369701987210297e-16 1.0 360 -> 1.0 2.4492935982947064e-16 question: is there a reason to go in the opposite of sin() behaviour? by an angle of 90° the sin() is positiv but [direction 90] gives a negative value for the y-coordinate. also the octant procedure behaves in this way, only to work together with the behaviour of the dircect procedure Could it be that this behaviour is motivated by the canvas origin on the top-left instead of bottom-left? | |||

User Comments: |
oehhar added on 2023-12-02 19:23:42:
(text/x-fossil-wiki)
Could someone remove the last comment? It is an online Casino. Take care, Harald arjenmarkus added on 2020-09-20 12:25:10: I have corrected the two procedures (and solved the problem with the adjacent/touching line segments). So closing this ticket. More to follow: extending the package with the contributions from fredCAD arjenmarkus added on 2020-09-20 10:57:19: I agree that this is wrong: the geometry package should use standard mathematical definitions. I do not know if the sign choice was made because of the canvas, it is quite possible, but it is unexpected from a mathematical point of view. The [octant] procedure gives the expected octants if you use the [angle] procedure to construct the required vector. So that is indeed consistent. |