Add the construction of the (inner) golden ratio point between two given points or equivalently on a single segment.

# Details

# Diff Detail

- Repository
- R331 Kig
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.

I have one remark. Since the result is different depending on how we orient the segment (say) AB we have to decide if the construction

gives the point on the segment nearest to A or the one nearest to B. The proposed solution:

a + (3 - sqrt(5)) * (b - a) / 2

gives the point nearest to A, whereas it seems to me more natural to construct the point nearest to B:

a + (sqrt(5) - 1) * (b - a) / 2

This seems to be closer to the usual definition as that portion of AB that is "mean proportional" between the whole segment and the remaining part, which I would interpret as: find C in AB such as |AB| : |AC| = |AC| : |CB| (i.e. we construct the golden section starting from A, not from B).

Actually a good question, which point we want to return. We should take the most usual convention. In natural language, I'd define the ratio as: 'short to long equals long to whole'. OTOH doing the well known construction [1] results in the other point. Personally, I don't have a preference.

We could return both points, but I'm not sure how good this is, especially for teaching.

Then, in principle there is also the outer ratio point. I'm not sure what to do with that one.

[1]: https://en.wikipedia.org/wiki/File:Goldener_Schnitt_Konstr_beliebt.svg

As you see... most (if not all) of the figures representing the golden section show the larger segment on the left. And when you say

"short to long equals long to whole", this is simply the result of a phrase where the subject is actually the "long", something like

"the long is 'in between' the whole and the rest".

Moreover you could as well say

"whole to long equals long to short" (and I would prefer this latter phrasing as more corresponding to the definition:

"A straight line is said to have been cut in extreme and mean ratio when, as the whole line is to the greater segment, so is the greater to the lesser"

[taken from https://en.wikipedia.org/wiki/Golden_ratio - I guess this is from Euclid's "elements"]

Concerning the external point... I would *not* add a construction for it... I am afraid that such construction would be somewhat confusing.

Thanks for the patch, @bourquin, please fix the casing issue I pointed out and I think it is ready for landing. From what I can tell, this is not addressing any particular bug or wish so I would say this (or any convention) is a good start and if uses want to change/extend it we will see a bug report in the wishlist.

misc/special_constructors.cc | ||
---|---|---|

2115 | Casing (lower/upper) here is inconsistent |

Fixed some spelling in midpoint and golden ratio point.

Added 'G' as a key shortcut for this construction.

kig/kigpartui.rc | ||
---|---|---|

40 | Sorry for not mentioning this earlier but I just noticed this button in the toolbar reduces spaces for other tools that are used more frequently. In my screen size, this for instance hides the perpendicular line tool. Would you agree to removing this from the point toolbar? |

I get a crash with a construction involving the new 'golden ratio' point:

- construct a segment s = AB
- construct the golden point G from the segment
- circle of center C (somewhere) through G
- position C such that the circle has two distinct intersections with the segment, one is G
- contruct the intersections between the segment and the circle

--> kig crashes

About the crash above: the problem resides in AbstractLineImp::isPropertyDefinedOnOrThroughThisImp...

However it involves more than the new Golden Point. Perhaps the right action should be to file a bug

report.

It seems that the implementation of this property is wrong with respect to the hierarchy of objects

AbstractLine -> Segment

The first contains 2 properties to which we add the 6 properties of a Segment, whereas the aforementioned

property defines 4 properties for AbstractLine (and none for a Segment)

I just filed a bug report for the problem mentioned above: https://bugs.kde.org/show_bug.cgi?id=394676

in that report there is no mention of the new GoldenRatio property; it would raise the number of properties

of a segment from 5 to 6, the method mentioned in the bug report should return "true" for the GoldenRatio

property, since the constructed point is contained in the segment.

I can reproduce this bug as you described it above.

It does not occur however if I construct the golden ratio point from two single points, insert a line segment between the endpoints and then compute the intersection with the circle. In that case, the ratio point depends on the endpoints and not on the line segment.

As I said, this is not a probem specific of the Golden Ratio. You should have a look at the bug report https://bugs.kde.org/show_bug.cgi?id=394676

This is a consequence of a somewhat obscure information that can (should) be associated to a construction.

I know this very well since I am responsible for it.

I think that we should wait for that bug to be solved, then you can simply update the (new) method

SegmentImp::isPropertyDefinedOnOrThroughThisImp to incorporate the GoldenPoint property.