orx icon indicating copy to clipboard operation
orx copied to clipboard

[orx-shapes] operator `roundCorners` only works between straight segments

Open hamoid opened this issue 9 months ago • 0 comments

Operating System

Linux

OPENRNDR version

0.4.5-alpha8

ORX version

0.4.5-alpha8

Java version (if applicable)

No response

Describe the bug

contour.roundCorners(x) only rounds corners formed by pairs of straight segments.

I will investigate why.

Steps to reproduce the bug

import org.openrndr.application
import org.openrndr.extra.shapes.adjust.adjustContour
import org.openrndr.extra.shapes.operators.roundCorners
import org.openrndr.shape.Rectangle

fun main() = application {
    program {
        extend {
            val contours = listOf(
                Rectangle(100.0, 100.0, 100.0, 100.0).contour,
                adjustContour(Rectangle(400.0, 100.0, 100.0, 100.0).contour) {
                    selectVertex(0)
                    vertices.forEach { it.rotate(30.0) }
                }
            )

            val contoursRounded = contours.map {
                it.roundCorners(10.0)
            }

            drawer.contours(contours)
            drawer.translate(0.0, 150.0)
            drawer.contours(contoursRounded)
        }
    }
}

Image

hamoid avatar Mar 19 '25 08:03 hamoid