<!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">
Just pushed to GitHub. Apologies for the delay.<br>
<br>
Thanks!<br>
<br>
On 3/5/2025 7:42 PM, Mark Volkmann via Cuis-dev wrote:
<blockquote
cite="mid:CAFfRWnUsHEO_oZcV=1mT9kEh1sPNG4icnxYPLweUA1Ugc_2=jQ@mail.gmail.com"
type="cite">
<div dir="ltr">Yes, I love it! I think I was taught the wrong
meaning of the word "oval" in grade school and never learned the
correct definition despite having a B.S. in Math. ;-)
<div>Stadium it is!</div>
<div><br>
</div>
<div>Let me know when your version is pushed and I'll change my
Switch morph to use the stadium method.</div>
</div>
<br>
<div class="gmail_quote gmail_quote_container">
<div dir="ltr" class="gmail_attr">On Wed, Mar 5, 2025 at 3:14 PM
Juan Vuletich <<a moz-do-not-send="true"
href="mailto:juan@cuis.st">juan@cuis.st</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div bgcolor="#ffffff"> Hi Mark,<br>
<br>
I expected more what <a moz-do-not-send="true"
href="https://en.wikipedia.org/wiki/Oval" target="_blank">https://en.wikipedia.org/wiki/Oval</a>
describes as a "technical drawing oval". This could perhaps
be called a 'Stadium'. Additionally, in VectorCanvas,
coordinates describe the points that the pen goes through,
not a rectangle where the figure is contained.<br>
<br>
I suggest this:<br>
<br>
stadium: aRectangle<br>
"<br>
| r |<br>
r := 500@150 extent: 100@250.<br>
(VectorCanvas onForm: Display)<br>
strokeWidth: 2.0 color: Color red do: [ :canvas |<br>
canvas stadium: r ].<br>
(VectorCanvas onForm: Display)<br>
geometryTransformation: (AffineTransformation
withRadians: 1 scale: 1.2 position: 200@100);<br>
strokeWidth: 2.0 color: Color red do: [ :canvas |<br>
canvas<br>
stadium: r ].<br>
Display forceToScreen<br>
"<br>
| height p1 p2 p3 p4 radius width x1 x2 y1 y2 |<br>
width := aRectangle width.<br>
height := aRectangle height.<br>
radius := (width min: height) / 2.<br>
height < width<br>
ifTrue: [<br>
x1 := aRectangle left + radius.<br>
x2 := aRectangle right - radius.<br>
y1 := aRectangle top.<br>
y2 := aRectangle bottom.<br>
p1 := x1 @ y1.<br>
p2 := x2 @ y1.<br>
p3 := x2 @ y2.<br>
p4 := x1 @ y2 ]<br>
ifFalse: [<br>
x1 := aRectangle left.<br>
x2 := aRectangle right.<br>
y1 := aRectangle top + radius.<br>
y2 := aRectangle bottom - radius.<br>
p1 := x1 @ y2.<br>
p2 := x1 @ y1.<br>
p3 := x2 @ y1.<br>
p4 := x2 @ y2].<br>
self<br>
moveTo: p1;<br>
lineTo: p2;<br>
arcTo: p3 radius: radius angleOfXAxis: 0 largeFlag:
false sweepFlag: true;<br>
lineTo: p4;<br>
arcTo: p1 radius: radius angleOfXAxis: 0 largeFlag:
false sweepFlag: true.<br>
<br>
Would this work?<br>
<br>
On 3/5/2025 4:19 PM, Mark Volkmann via Cuis-dev wrote:
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">
<div>Below is the <font face="monospace">AbstractVectorCanvas</font>
method I mentioned in the meetup today for drawing
an oval. Here is an example of using it from a <font
face="monospace">drawOn:</font> method of a morph.
See the TODO comment below related to getting the
stroke width. I'm open to suggestions for improving
this.</div>
<div><br>
</div>
<div><font face="monospace">aCanvas strokeWidth: 5
color: Color red fillColor: Color yellow do: [<br>
aCanvas drawOval: rect strokeWidth: 5.<br>
].</font><br>
</div>
<div><br>
</div>
<div>---</div>
<div><br>
</div>
<div><font face="monospace">drawOval: aRect
strokeWidth: aStrokeWidth<br>
| diameter halfStrokeWidth height p1 p2 p3 p4<br>
radius strokeWidth width x1 x2 y1 y2 |<br>
<br>
width := aRect width.<br>
height := aRect height.<br>
<br>
</font><span style="font-family: monospace;"> <span> </span></span><font
face="monospace">"TODO: Why does this give the
wrong value?"<br>
</font><span style="font-family: monospace;"> <span> </span></span><font
face="monospace">"strokeWidth := engine
strokeWidth."<br>
</font><span style="font-family: monospace;"> <span> </span></span><font
face="monospace">strokeWidth := aStrokeWidth.<br>
</font><span style="font-family: monospace;"> <span> </span></span><font
face="monospace">halfStrokeWidth := strokeWidth /
2.<br>
</font><span style="font-family: monospace;"> <span> </span></span><font
face="monospace">diameter := (height min: width) -
strokeWidth.<br>
</font><span style="font-family: monospace;"> <span> </span></span><font
face="monospace">radius := diameter / 2.<br>
<br>
</font><span style="font-family: monospace;"> <span> </span></span><font
face="monospace">height < width<br>
</font><span style="font-family: monospace;"> <span> </span></span><font
face="monospace">ifTrue: [<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;">x1 :=
halfStrokeWidth + radius.</span></div>
<div><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">x2 := width - x1.<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">y1 := halfStrokeWidth.<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">y2 := height - y1.<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">p1 := x1 @ y1.<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">p2 := x2 @ y1.<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">p3 := x2 @ y2.<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;">p4 := x1 @ y2.</span></div>
<div><span style="font-family: monospace;"> <span> </span></span><font
face="monospace">]<br>
</font><span style="font-family: monospace;"> <span> </span></span><font
face="monospace">ifFalse: [<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">x1 := halfStrokeWidth.<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">y1 := halfStrokeWidth + radius.<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">x2 := width - x1.<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">y2 := height - y1.<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">p1 := x1 @ y2.<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">p2 := x1 @ y1.<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">p3 := x2 @ y1.<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">p4 := x2 @ y2.<br>
</font><span style="font-family: monospace;"> <span> </span></span><font
face="monospace">].<br>
<br>
</font><span style="font-family: monospace;"> <span> </span></span><font
face="monospace">self<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">moveTo: p1;<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">lineTo: p2;<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">arcTo: p3 radius: radius
angleOfXAxis: 0 largeFlag: false sweepFlag: true;<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">lineTo: p4;<br>
</font><span style="font-family: monospace;"> <span> </span></span><span
style="font-family: monospace;"> </span><span
style="font-family: monospace;"> </span><font
face="monospace">arcTo: p1 radius: radius
angleOfXAxis: 0 largeFlag: false sweepFlag: true.</font><br>
</div>
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div><font face="arial, helvetica,
sans-serif">R. Mark Volkmann</font></div>
<div><span style="font-size: 12.8px;"><font
face="arial, helvetica,
sans-serif">Object Computing, Inc.</font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
<br>
<pre cols="72">--
Juan Vuletich
<a moz-do-not-send="true" href="http://cuis.st" target="_blank">cuis.st</a>
<a moz-do-not-send="true" href="http://github.com/jvuletich" target="_blank">github.com/jvuletich</a>
<a moz-do-not-send="true" href="http://researchgate.net/profile/Juan-Vuletich" target="_blank">researchgate.net/profile/Juan-Vuletich</a>
<a moz-do-not-send="true" href="http://independent.academia.edu/JuanVuletich" target="_blank">independent.academia.edu/JuanVuletich</a>
<a moz-do-not-send="true" href="http://patents.justia.com/inventor/juan-manuel-vuletich" target="_blank">patents.justia.com/inventor/juan-manuel-vuletich</a>
<a moz-do-not-send="true" href="http://linkedin.com/in/juan-vuletich-75611b3" target="_blank">linkedin.com/in/juan-vuletich-75611b3</a>
<a moz-do-not-send="true" href="http://twitter.com/JuanVuletich" target="_blank">twitter.com/JuanVuletich</a></pre>
</div>
</blockquote>
</div>
<div><br clear="all">
</div>
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div><font face="arial, helvetica, sans-serif">R.
Mark Volkmann</font></div>
<div><span style="font-size: 12.8px;"><font
face="arial, helvetica, sans-serif">Object
Computing, Inc.</font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich</pre>
</body>
</html>