<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 8/15/2021 5:49 PM, Juan Vuletich via Cuis-dev wrote:
<blockquote cite="mid:61197DC9.1080800@jvuletich.org" type="cite">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
Hi Hilaire,<br>
<br>
On 8/15/2021 7:14 AM, Hilaire Fernandes via Cuis-dev wrote:
<blockquote
cite="mid:4a0e0ea0-8567-93ae-60a4-0141b2797b35@drgeo.eu"
type="cite">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<p><font size="+1">Hi Juan, <br>
</font></p>
<p><font size="+1">I have noted that with a drawn circle[1], so
not filled contrary to a disc, the detection method in
subject respond true when the point is on any position <b>inside</b>
the circle. It should be true only when the circle is filled
(disc).<br>
</font></p>
</blockquote>
<br>
Well, we can detect with pixel precision only one morph, the
visible one. I think you had asked about detecting all the
(possibly overlapping) morphs that are at some point (or close to
it). Adding a stack of morphID at each pixel is extremely memory
intensive. We could easily need half a gigabyte of memory for a 4k
display. Then I came up with the contour idea, that only requires
a maximum of 16 kBytes per morph (i.e. most likely never more than
a couple of megabytes). But contours record, for each display
y(i.e. for each line) the leftmost and rightmost affected pixels.
It is a kind of "convex hull".<br>
<br>
I don't know a general, all-morphs solution that doesn't require a
ton of RAM. If you can live with detecting only the top morph,
then #containsGlobalPoint: (or a new method that also takes into
account a distance), is a possible solution.<br>
<br>
If you absolutely need detecting all morphs, but not at
"transparent" inner points, and, it is only for instances of a few
classes, like line and circle, then implementing a specific method
in those classes is an alternative. It would be quite complicated
if you also need, for example, Beziers.<br>
<br>
I'm sorry I don't know a better solution.<br>
<br>
<blockquote
cite="mid:4a0e0ea0-8567-93ae-60a4-0141b2797b35@drgeo.eu"
type="cite">
<p><font size="+1"> </font></p>
<p><font size="+1">Btw, when I insert an halt in the draw
method, it freezes the image. You fixed this issue
previously, may be it is a regression or something else.<br>
</font></p>
</blockquote>
<br>
Right now, #drawOn: is protected against Error, but not against
Halt. Just played a bit with an improvement. Will push it later.<br>
<br>
<blockquote
cite="mid:4a0e0ea0-8567-93ae-60a4-0141b2797b35@drgeo.eu"
type="cite">
<p><font size="+1"> </font></p>
<p><font size="+1">Best</font></p>
<p><font size="+1">Hilaire<br>
</font></p>
<p><font size="+1">[1] Draw as:<br>
</font></p>
<p>DrGCircleMorph>>drawCircleOn: aCanvas<br>
| center r |<br>
center _ self drawable worldToMorph: mathItem center.<br>
r _ self drawable worldToPixel: mathItem radius.<br>
style isFilled <br>
ifTrue: [ <br>
aCanvas strokeWidth: style borderWidth color:
borderColor fillColor: color do: [ <br>
aCanvas circleCenter: center radius: r]
]<br>
ifFalse: [<br>
aCanvas strokeWidth: style borderWidth color:
borderColor do: [<br>
aCanvas circleCenter: center radius: r] ]<br>
</p>
<pre class="moz-signature" cols="72">--
GNU Dr. Geo
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://drgeo.eu">http://drgeo.eu</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://blog.drgeo.eu">http://blog.drgeo.eu</a></pre>
</blockquote>
<br>
Cheers,<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="http://www.cuis-smalltalk.org">www.cuis-smalltalk.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://github.com/jvuletich">https://github.com/jvuletich</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://www.linkedin.com/in/juan-vuletich-75611b3">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
@JuanVuletich</pre>
</blockquote>
<br>
Just pushed to GitHub a new approach to tackle this issue. Please
check #shadow, senders, and all methods in M3Exp01Morph.<br>
<br>
I added a #shadow method that answers a 1bpp form telling affected
pixels, even if Morph not partially visible. As this is expensive,
it is computed on demand and cached.<br>
<br>
Cheers,<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
<a class="moz-txt-link-abbreviated" href="http://www.cuis-smalltalk.org">www.cuis-smalltalk.org</a>
<a class="moz-txt-link-freetext" href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a class="moz-txt-link-freetext" href="https://github.com/jvuletich">https://github.com/jvuletich</a>
<a class="moz-txt-link-freetext" href="https://www.linkedin.com/in/juan-vuletich-75611b3">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
@JuanVuletich</pre>
</body>
</html>