<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi Mark,<br>
    <br>
    I expected more what <a class="moz-txt-link-freetext" href="https://en.wikipedia.org/wiki/Oval">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
cite="mid:CAFfRWnU605znqPs4WY25i+Njt8PkF69MhthSv30p2bzhWckynw@mail.gmail.com"
      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"
            data-smartmail="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 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>