# Golden ratio pointClosedPublicActions

Authored by bourquin on May 16 2018, 1:06 AM.

# Details

Reviewers
 paolini
Commits
R331:cf7aa5dccf79: Golden ratio point
Summary

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

# Diff Detail

Repository
R331 Kig
Lint
 Lint Skipped
Unit
 Unit Tests Skipped
bourquin created this revision.May 16 2018, 1:06 AM
Restricted Application added a project: KDE Edu. May 16 2018, 1:06 AM
Restricted Application added a subscriber: kde-edu.
bourquin requested review of this revision.May 16 2018, 1:06 AM

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.

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.

bourquin updated this revision to Diff 34298.May 16 2018, 3:12 PM

Update to switch convention.

bourquin updated this revision to Diff 34299.May 16 2018, 3:22 PM

Switch golden ratio convention

Updated the patch to switch the convention.

paolini accepted this revision.May 16 2018, 3:24 PM

I would not object in accepting this revision

This revision is now accepted and ready to land.May 16 2018, 3:24 PM

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

bourquin updated this revision to Diff 34338.May 16 2018, 11:54 PM
bourquin edited the test plan for this revision. (Show Details)

Fixed some spelling in midpoint and golden ratio point.
Added 'G' as a key shortcut for this construction.

kig/kigpartui.rc
40–41

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?

bourquin updated this revision to Diff 34549.May 20 2018, 7:50 PM

Remove golden point tool from toolbar.

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

1. construct a segment s = AB
2. construct the golden point G from the segment
3. circle of center C (somewhere) through G
4. position C such that the circle has two distinct intersections with the segment, one is G
5. 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)

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.

Sounds like a bug indeed, please report this on bugzilla and I will take a look.

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.

bourquin updated this revision to Diff 34941.May 26 2018, 9:44 PM

Tries to fix bug 394676 but without success so far.

bourquin updated this revision to Diff 34943.May 26 2018, 9:48 PM

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.

bourquin updated this revision to Diff 34945.May 26 2018, 11:58 PM
This revision was automatically updated to reflect the committed changes.