|
From: | Hilaire Fernandes |
Subject: | Re: [Dr. Geo] DrGWrappedPoint versus Point |
Date: | Sun, 21 Apr 2024 12:34:08 +0200 |
User-agent: | Mozilla Thunderbird |
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 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/ |
[Prev in Thread] | Current Thread | [Next in Thread] |