Notifications
Clear all

[Closed] Line-Curve intersection with Maxscript

[color=white]Is there any way to find point3 (or point2 for flat curves) at straight line and curved line intersection or curved line-curved line intersection with maxscript? How ‘Shape Check’ utility does this checking?
I’ve tried with trim command, but in maxscript it turns on interactive picking mode.

Thank you.

[/color]

3 Replies

Prettypixel has compiled a useful set of geometric calculations, a sticky at the top of this forum. Geometrical calculations : points, lines, planes : intersections, distances, angles.

http://forums.cgsociety.org/showthread.php?f=98&t=295257

There is a formula for line / line intersections in that topic.

(BTW not as easy as if may first seem!)

J.

Thank you, but unfortunately this function doesn’t work with curved, non-straight splines, e.g. bezier or smooth.

There’s no simple formula for finding the intersection of a line and cubic Bezier, unfortunately. In 2D, It’s often done by iterative subdivision and line-line intersection.

Roughly:

If the line does not intersect any of the lines between the (ordered) control points, it does not intersect the curve.

Split the curve (using deCasteljau’s algorithm) , discarding all sections not intersected, creating new sets of control points for the remaining candidate sections.

Repeat, until the new control points approximate the curve closely enough. The last-found line-line intersections are your approximate line-curve intersections.