Skip to content

curvePoint does not adjust to curveTightness #5601

@hapiel

Description

@hapiel

Most appropriate sub-area of p5.js?

  • Accessibility (Web Accessibility)
  • Build tools and processes
  • Color
  • 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions