# bezierDetail() doesn't work in bezierVertex()

**URL:** https://discourse.processing.org/t/bezierdetail-doesnt-work-in-beziervertex/44173
**Category:** p5.js
**Created:** [March 29, 2024, 8:10am UTC](https://discourse.processing.org/t/bezierdetail-doesnt-work-in-beziervertex/44173 "2024-03-29T08:10:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![unfootbird](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unfootbird](https://discourse.processing.org/u/unfootbird)
#### Post date: [March 29, 2024, 8:10am UTC](https://discourse.processing.org/t/bezierdetail-doesnt-work-in-beziervertex/44173/1 "2024-03-29T08:10:40Z")

</div>

When I was exploring bezier curves. I realized that these two lines of code:  
detail = 2 \* int(map(mouseY, 0, height, 1, division \* 5));  
bezierDetail(detail);  
works perfectly when I define bezier curve through bezier() function but not work within bezierVertext(), anyone have any idea?

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [March 29, 2024, 1:07pm UTC](https://discourse.processing.org/t/bezierdetail-doesnt-work-in-beziervertex/44173/2 "2024-03-29T13:07:50Z")

</div>

please note: This function is only useful when using the **P2D** or **P3D** renderer; the default (JAVA2D) renderer does not use this information.

Otherwise, I don’t know why you have this.

Maybe curveVertex doesn’t use bezierVertex

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [March 29, 2024, 8:15pm UTC](https://discourse.processing.org/t/bezierdetail-doesnt-work-in-beziervertex/44173/3 "2024-03-29T20:15:55Z")

</div>

Hello @unfootbird,

> [@unfootbird](#):
>
> works perfectly when I define bezier curve through bezier() function but not work within bezierVertext(), anyone have any idea?

No idea! I would have to explore source code but not inclined to do so.

I explored this with examples below.

`bezierDetail()` in Processing Java works with `bezier()` and `bezierVertex()`:

```auto
void setup() {
  size(400, 400, P2D);
}

void draw() 
  {
  background(220);
  //translate(-width/2, -height/2);
  strokeWeight(2);
  
  int detail = 2* (int)(map(mouseY, 0, height, 1, 20));
  bezierDetail(detail);
  println(detail);  
    
  noFill();
  beginShape();
  //bezierDetail(detail); // Just testing!
  vertex(30, 20);
  bezierVertex(580, 200, 180, 175, 130, 175);
  endShape();

  translate(0, height/2);
  bezier(30, 20, 580, 200, 180, 175, 130, 175);  
  }

```

`bezierDetail()` in P5.js works with `bezier()` but does not work with `bezierVertex()`:

```auto
function setup() {
  createCanvas(400, 400, WEBGL);
}

function draw() 
  {
  background(220);
  translate(-width/2, -height/2);  
  
  let detail = 2 * (int)(map(mouseY, 0, height, 1, 20));
  bezierDetail(detail);
  console.log(detail);  
    
  noFill();
  beginShape();
  //bezierDetail(detail); // Just testing!
  vertex(30, 20);
  bezierVertex(580, 200, 180, 175, 130, 175);
  endShape();

  translate(0, height/2);
  bezier(30, 20, 580, 200, 180, 175, 130, 175);  
  }

```

Processing Java references:  
_[Reference / Processing.org](https://processing.org/reference)_

P5.js references:  
_[reference | p5.js](https://p5js.org/reference/)_

`:)`

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [March 29, 2024, 9:32pm UTC](https://discourse.processing.org/t/bezierdetail-doesnt-work-in-beziervertex/44173/4 "2024-03-29T21:32:33Z")

</div>

## bezierDetail()

Note, This function is only useful when using the WEBGL renderer as the default canvas renderer does not use this information.

> **[Reference](https://p5js.org/reference/#/p5/bezierDetail)**
>
> Find easy explanations for every piece of p5.js code.

---

<div class="post-metadata">

### Author: ![unfootbird](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@unfootbird](https://discourse.processing.org/u/unfootbird)
#### Post date: [March 30, 2024, 3:26am UTC](https://discourse.processing.org/t/bezierdetail-doesnt-work-in-beziervertex/44173/5 "2024-03-30T03:26:50Z")

</div>

I did similar work as you did, bezierDetail() did nothing within the scope of beginShape() and endShape()
