quil

Duminda 2024-03-28T09:01:19.072409Z

Hi, This code:

(defn petal [[center-x center-y] r angle]
  (let [g (q/create-graphics 400 400 :p2d)]
    (q/with-graphics g
      (q/translate 200 200)
      (q/fill 160 20 20)
      (q/begin-shape)
      (q/bezier -50 -87 -100 -200 0 -180 0 -200)
      (q/bezier 50 -87 100 -200 0 -180 0 -200)
      (q/triangle -50 -87 0 -200 50 -87)
      (q/begin-contour)
      (q/arc 0 0 200 200 (* q/PI 1.33) (* q/PI 1.66) :open)
      (q/end-contour)
      (q/end-shape :close))
    (q/image g 0 0)
    (swap! shapes assoc :petal g)))
is then used to generate the image below. My question is how can I get rid of those filled arc slices inside the circle?

Duminda 2024-03-28T09:02:38.817129Z

begin/end-contour doesn't seem to help even though I thought it might

p-himik 2024-03-28T09:06:51.261159Z

I haven't used Quil in a while but my first thought is that it comes from the triangle, so maybe you can replace it with the contour of the two lines and the arc.

🙌 1
Duminda 2024-03-28T09:07:22.454879Z

oh

Duminda 2024-03-28T09:07:25.517889Z

ok let me try

Duminda 2024-03-28T14:41:29.337819Z

Is it possible to specify absolute screen position for defsketch ?

Charles Comstock 2024-03-31T11:26:44.939809Z

What do you mean by absolute? Do you mean repositioning the applet window? Do you mean position accounting for multiple monitors? Or do you mean something about coordinates within the sketch?

Duminda 2024-04-01T05:40:09.636059Z

Positioning the applet window.

Charles Comstock 2024-04-06T21:01:17.583389Z

Sorry I missed this, but you can do it calling the processing methods (.setLocation (.getSurface applet) x y) where applet is the applet object returned by q/sketch.

Charles Comstock 2024-04-06T21:06:44.327239Z

q/sketch returns a PApplet https://processing.github.io/processing-javadocs/core/processing/core/PApplet.html, and .getSurface() returns a https://processing.github.io/processing-javadocs/core/processing/core/PSurface.html which has .setLocation. Currently this is not exposed as a Quil API call directly.

Charles Comstock 2024-04-06T21:25:40.335499Z

I believe defsketch creates a named def with the applet, so that's also an option, but perhaps a little trickier as it should probably only be called after creation.