Skip to content

lineQuadratic() not finding one specific intersection #3

@hamoid

Description

@hamoid

Hi,

I'm working with intersections in OPENRNDR and I have the following design made out of 4 segments (two lines and two curves):

image

There should be 5 intersections detected but only 4 are found. The original program simplified to only use the two involved segments looks like this:

fun doTest() {
    val l = Line2.line(Vec2(512.0, 96.0), Vec2(128.0, 384.0))
    val c = Bezier2.curve(Vec2(128.0, 384.0), Vec2(320.0, 168.0), Vec2(512.0, 384.0)) as Bezier2.QuadraticBezier2?
    println(l)
    println(c)
    val i = Intersections.lineQuadratic(l, c)
    println(i.size)
    i.forEach { println(it) }
}

This is the output of the program:

a=[x=512.0, y=96.0], b=[x=128.0, y=384.0]
p0=[x=128.0, y=384.0], p1=[x=320.0, y=168.0], p2=[x=512.0, y=384.0]
0

Zero intersections are found.

This is a visualization of those vertices using Inkscape. Even if the blue line should be a curve, I think it shows that there should be an intersection:

image

Any ideas why this happens?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions