3
$\begingroup$

I feel like this is just as much a mathematics question as it is a programming question so I figured it couldn't hurt to cross post my question here.

Original Post: https://stackoverflow.com/questions/10000590/detect-kinks-in-parallel-lines-to-bezier-curves

I was hoping someone could help me figure out a computationally inexpensive method for detecting kinks in a line drawn parallel to a Bezier curve as you can see here

Kink in Line Parallel to Bezier Curve

What I would like to do is be able to determine the intersection of the kink, the segment with a starting point before the intersection and the first segment with an ending point after the kink. This way I can simply remove any unnecessary segments and adjust the first and last segments to meet at the intersection.

Apologies if I'm using the incorrect terms. But as far as I understand it the way I'm positioning these segments is by determining the unit vector of the segments for the Bezier curve (yellow) and multiplying it by the offset and finding the normal vector to create two new start and end points for the offset segment (white).

Mathematics isn't my strong suit so I'm hoping someone can give me a push in the right direction.

EDIT: The image has actually been resized by HTML so if you're having a hard time seeing what I'm talking about here's the direct link: http://i.stack.imgur.com/xtils.png

  • 0
    Trimming offsets is not trivial. See for instance, Farouki, R. T. and C. A. Neff: 1990, ‘Algebraic properties of plane offset curves’. *Computer Aided Geometric Design* 7(1-4), 101–127 and ‘Analytic properties of plane offset curves’. *Computer Aided Geometric Design* 7(1-4), 83–99.2012-04-03
  • 0
    Is this still the case even when accuracy isn't a big concern? I don't need the trims to be perfect just "better".2012-04-03
  • 0
    Once you define "better", it'll get complicated...2012-04-03
  • 0
    See also I. K. Lee, M. S. Kim, and G. Elber. Planar Curve Offset Based on Circle Approximation. *Computer-Aided Design*, Vol 28, No 8, pp 617–630, August 1996.2012-04-03
  • 0
    Perhaps you can suggest an alternative for me then. What I really need is a way to estimate distance and detect "significant" changes in direction. I'll take a look at the resources you've suggested but if my approach results in such complexities perhaps I'm going about this the wrong way.2012-04-03

1 Answers 1