p5.js icon indicating copy to clipboard operation
p5.js copied to clipboard

curvePoint does not adjust to curveTightness

Open hapiel opened this issue 3 years ago • 3 comments
trafficstars

Most appropriate sub-area of p5.js?

  • [ ] Accessibility (Web Accessibility)
  • [ ] Build tools and processes
  • [ ] Color
  • [X] Core/Environment/Rendering
  • [ ] Data
  • [ ] DOM
  • [ ] Events
  • [ ] Friendly error system
  • [ ] Image
  • [ ] IO (Input/Output)
  • [ ] Localization
  • [ ] Math
  • [ ] Unit Testing
  • [ ] Typography
  • [ ] Utilities
  • [ ] WebGL
  • [ ] Other (specify if possible)

p5.js version

1.4.0

Web browser and version

ff97

Operating System

win10

Steps to reproduce this

Steps:

The curvePoint() function does not adjust for curveTightness(). If this is set to a value other than 0 (default), there is no way to find the right point on a curve.

Demo sketch: https://editor.p5js.org/hapiel/sketches/Pezi3jPfn

The proposed solution would be to check for curve tightness in the curvePoint() function and adjust accordingly. I have not double checked if this unexpected behaviour is also present in curveTightness() but it seems so.

Snippet:


function setup() {
  createCanvas(100, 100);
}

function draw() {
  background(255);
  curveTightness(-1);
  curve(5, 26, 73, 24, 73, 61, 15, 65);
  x = curvePoint(5, 73, 73, 15, 0.5);
  y = curvePoint(26, 24, 61, 65, 0.5);
  circle(x, y, 5);
}

Result: afbeelding

hapiel avatar Feb 13 '22 18:02 hapiel

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

welcome[bot] avatar Feb 13 '22 18:02 welcome[bot]

@hapiel can I work on this issue ?

Yash621 avatar Feb 19 '22 22:02 Yash621

Of course! I had a quick look if I could fix it myself but I think it's beyond what I'm capable of. So yes, please :)

On Sat, Feb 19, 2022, 23:08 Yash Goel @.***> wrote:

@hapiel https://github.com/hapiel can I work on this issue ?

— Reply to this email directly, view it on GitHub https://github.com/processing/p5.js/issues/5601#issuecomment-1046112986, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCNR6OPJWHGBY42ZE6YK3DU4AIE5ANCNFSM5OJO4O3Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

hapiel avatar Feb 19 '22 22:02 hapiel