dr-geo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Dr. Geo] proportionOf:to: method ?


From: address@hidden
Subject: Re: [Dr. Geo] proportionOf:to: method ?
Date: Sat, 18 May 2024 19:59:33 +0200 (CEST)

I've tested both methods.

In attach an example (SVG file which I obtained by "Save as an SVG image" in 
DrGeo).

It shows the medians of a triangle trisecting each other in the centroid,
where the proportion of the segments is as 2:1.

The value 2.0 is computed as you suggested using a line of code with a 
Smalltalk block.

Actually the proof in some books that the medians intersect in a single point 
(the centroid) is based on the constant of proportionality  argument.

The second method has nice 'cool' little dotted arrows pointing to the 
endpoints,
and has as possible advantage that it works on 4 endpoints, rather than on two 
segments.

Anyway, I still think a method like proportionOf: in the class DrGeoSketch 
would be useful,
regardless how it is implemented, with Smalltalk Blocks or not.

If the method would take 4 endpoints, the name could be proportionOf:A:B to:C:D

The choice of whether to compute proportion on line segments or rather on 
distances between 4 endpoints, is probably important for the design of the 
method name.

The choice how you implement a method like proportionOf: is yours of course.

The code you suggested is fine and is generic, but it would be shorter and more 
convenient if DrGeo provided a method to compute the constant of 
proportionality for either 2 line segments or for 4 endpoints ...

Regards,
David Stes

----- Op 18 mei 2024 om 10:25 schreef Hilaire Fernandes hfern@free.fr:

> Hi David,
> 
> What you want is something more generic, to compute a value from
> arbitrary code.
> 
> Remember about https://github.com/hilaire/drgeo/issues/31 related to a
> discussion we had on this mailing list.
> 
> So I appended these lines of code to your script to produce the
> expected  results:
> 
> (sketch  value:  [AC  mathItem  length  /  BC  mathItem  length])name:  'AC ÷
> BC'.
> 
> (sketch  value:  [:ptA  :ptD  :ptB  :ptE  |
>       (ptA  point  dist:  ptD  point)/  (ptB  point  dist:  ptE  point)]
>       parents:  {A  .D  .B  .E}
>       at:  0@5)name:  'AD ÷ BE'
>       
> 
> Observe in the code, two different ways to define the value by block.
> The second one with arguments, in the resulting sketch when you drag the
> value it shows you with red dotted arrows the objects used for the
> computation, here points A, D, B and E.
> 
> Please update to latest DrGeo with a pull. When restarting your DrGeo
> image the newer package should get load automatically, this is a new
> feature of Cuis 6.3. If not, use the FileList from the world menu and
> search for the DrGeo package and install it manually.
> 
> I append below a screenshot. Observe how the rendering of Cuis is far
> superior in quality to the rendered SVG file in your operating system:
> 
> view
> 
> 
> Le 17/05/2024 à 21:42, stes@telenet.be a écrit :
>>   There exists an instance method lengthOf: for the class DrGeoSketch
>> which returns the length of (for example) a segment of a line.
>>
>>   That works for me, and when I interactively change in the DrGeo
>> SmalltalkSketch Editor the segment between two points, the length value
>> is also updated automatically.
>>
>>   Is there an instance method which computes the constant of
>> proportionality for two segments ?
>>
>>   A method for DrGeoSketch :  proportionOf:segment1 to:segment2
> 
> --
> GNU Dr. Geo
> http://gnu.org/s/dr-geo/
> http://gnu-drgeo.blogspot.com/

Attachment: zwaartelijn-ratio.svg
Description: image/svg


reply via email to

[Prev in Thread] Current Thread [Next in Thread]