PDA

View Full Version : Line-Curve intersection with Maxscript


sergo.pogosyan
03-10-2009, 01:21 PM
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.

j-man
03-10-2009, 01:40 PM
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.

sergo.pogosyan
03-10-2009, 03:33 PM
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.

drdubosc
03-10-2009, 04:32 PM
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.

CGTalk Moderation
03-10-2009, 04:32 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.