[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Dr. Geo] DrGWrappedPoint versus Point
From: |
address@hidden |
Subject: |
Re: [Dr. Geo] DrGWrappedPoint versus Point |
Date: |
Sun, 21 Apr 2024 12:46:56 +0200 (CEST) |
I was not aware of the hide and show messages, I'll first test that.
So I was not asking to change anything ... but I was just surprised to see that
the points are actually instances of a class named DrGWrappedPoint
(this makes sense of course, as it is a layer of DrGeo on top of the basic
Smalltalk or Cuis Point class).
I'll first test some other examples ...
Regards,
David Stes
----- Op 21 apr 2024 om 12:34 schreef Hilaire Fernandes hfern@free.fr:
> Hi David,
>
> As you have observed, when creating a segment with the message
> #segment:to:, the argument can be both a Smalltalk point object (5@4) or
> a DrGeo Point instance you will have created with the #point: message
> (figure point: 5@4).
>
> In the first case, underneath the argument (5@4) is used to create a
> DrGeo point, but because the user did not create the point through
> DrGeo, it is kept hidden. The DrGeo point is implicitly created because
> it's needed in the DrGeo model to create the subsequent segment. Hidding
> the implicit point is a trade-off I did so you can create a lof lines
> without having the implicit point visible, it avoids noise in the sketch
>
> If you want to make visible an implicit point, you can do it afterward.
> Observe:
>
> sketch segment: 0@0 to: 5@5.
> (sktech point: 5@5)show
>
> In DrGeo, there is a factory of objects, so when you ask for a new
> object (here point), the factory first check if the object already
> exist. That's why you don't have duplicate point at 5@5 in the example
> above. At the second line, the existing DrGeo point 5@5 is returned,
> then it can be revealed to the user with the #show message.
>
> This behavior of the implicit point is implemented there:
>
> DrGeoSketch>>wrappedPoint: aPointOrWrappedPointItem
> "ensure a wrapped point"
> ^ aPointOrWrappedPointItem isPoint
> ifTrue: [(self point: aPointOrWrappedPointItem)hide]
> ifFalse: [aPointOrWrappedPointItem]
>
> It explains that whenever your a pass a Smalltalk point as argument,
> even it already exists, it will be hidden.
>
> So if you need to reveal one specific point you can write something like
> that:
>
> sketch segment: 0@0 to: ((sketch point: 5@5)name: 'A')
>
> I could add an option to the DrGeoSketch to let this behavior adjusted
> by the user. For example:
>
> sketch showImplicitPoint.
> sketch segment: 0@0 to: 5@5.0
>
> both implicit points will be visible.
>
> If you are interested by such a feature, open a ticket.
>
> Hilaire
>
> Le 20/04/2024 à 20:33, stes@telenet.be a écrit :
>> AB _ sketch segment: A to: B.
>>
>> to
>>
>>
>> AB _ sketch segment: a to: b.
>>
>> and use Point instances as arguments for the segment:to: message,
>> the labels (names) of the points disappear for me.
>>
>> So is it recommended to always use DrGWrappedPoint instances instead of Point
>> instances ?
>
> --
> GNU Dr. Geo
> http://gnu.org/s/dr-geo/
> http://gnu-drgeo.blogspot.com/