dr-geo
[Top][All Lists]
Advanced

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

Re: [Dr. Geo] how to use a input parameter in DrGeo SmalltalkSketch


From: H. Fernandes
Subject: Re: [Dr. Geo] how to use a input parameter in DrGeo SmalltalkSketch
Date: Mon, 15 Apr 2024 13:14:46 +0200 (CEST)

Hi David,

It is fine too without input parameter :) Your Smalltalk sketch below exposes clearly the added value of Smalltlak sketch by using iterators like do:

I have many examples exposing the added value of Smalltalk programmed sketch in this book in French "Programmer avec Dr. Geo", https://www.gnu.org/software/dr-geo/doc/fr/programming

Dr. Geo -- http://gnu.org/s/dr-geo



As I wrote before, you already have a good example (Cobweb-Diagram with an input parameter).

I think I'll first try to write simple sketches - (very simple sketches) without input parameter - at least, at first, to further experiment and test DrGeo.

For example I just wrote the following sketch, which uses no input parameter, but just draws the sketch for different values of "radius", so by drawing for several values (programmatically by using a Smalltalk block and the do: message), it is good enough.

It does not have to be interactively at first.

|sketch origin |
sketch _ DrGeoSketch new.
sketch text:'Hippocrates Circle Segments' at:-4@-4.
sketch gridOn.
sketch axesOn.
origin _ 0@0.
{ 1. 2. 3. 4} do:[  :radius |
        sketch arcCenter: origin from: radius@0 to:(-1 * radius)@0.
        sketch regularPolygonCenter: origin vertex: radius@0 sides: 3.
].

Regards,
David Stes

----- Op 13 apr 2024 om 11:36 schreef Hilaire Fernandes hfern@free.fr:

> Hi David,
>
> You can fetch the latest commit of DrGeo. I have implemented the issue
> #31 value defined by block. It results in much simpler Smalltalk sketch
> to write. See this example:
>
>|f ruler a |
> f  :=  DrGeoFigure  new  axesOn.
> ruler  :=  f  float:  1.5  at:  0@0  from:  0  to:  10.
> (f  value:  ruler  parents:  {}at:  -2@4)name:  'value from a ruler'.
> a  :=  f  value:  [ruler  value  /  3].
> f  circleCenter:  0@0  radius:  a
>
> In the class DrGeoSketch you can browse the "value" method category to
> see the existing method.
>
> Testing is more than welcome, I have not entirely tested it; for example
> when a value by block also receive parent parameters..
>
> Hilaire
>
> --
> GNU Dr. Geo
> http://gnu.org/s/dr-geo/
> http://gnu-drgeo.blogspot.com/



reply via email to

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