Fork me on GitHub
#quil
<
2024-03-28
>
Duminda09:03:19

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?

Duminda09:03:38

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

p-himik09:03:51

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
Duminda09:03:25

ok let me try

Duminda14:03:29

Is it possible to specify absolute screen position for defsketch ?

Charles Comstock11:03:44

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?

Duminda05:04:09

Positioning the applet window.

Charles Comstock21:04:17

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 Comstock21:04:44

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 Comstock21:04:40

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.