CAD CAM EDM DRO - Yahoo Group Archive

Re: [CAD_CAM_EDM_DRO] Geometry Problem

Posted by Andy Anderson
on 2000-03-29 07:19:06 UTC
Ron,

You need to compute the cross-product of the vectors along the two line
segments. The sign of the cross product will tell you the direction of
the turn.

First compute

dx1 = x2-x1 (delta X of the first line)
dy1 = y2-y1 (delta Y of the first line)

dx2 = x3-x2 (delta X of the second line)
dy2 = y3-y2 (delta Y of the second line)

Now dx1,dy1 is the first vector (along the first line) and dx2,dy2 is
the second.

The cross product is

cp = dx1*dy2 - dy1*dx2

If cp is > 0, then the second line turns to the left. If cp < 0, the
second line turns to the right. If cp = 0, then the second line is
straight.

You can also compute the angle from the cross-product, but all you need
is the sign.

Andy Anderson

Discussion Thread

Jon Anderson 2000-03-29 06:46:48 UTC Re: [CAD_CAM_EDM_DRO] Geometry Problem Harrison, Doug 2000-03-29 07:17:19 UTC RE: [CAD_CAM_EDM_DRO] Geometry Problem Andy Anderson 2000-03-29 07:19:06 UTC Re: [CAD_CAM_EDM_DRO] Geometry Problem Harrison, Doug 2000-03-29 08:24:27 UTC RE: [CAD_CAM_EDM_DRO] Geometry Problem Jon Elson 2000-03-29 20:39:47 UTC Re: [CAD_CAM_EDM_DRO] Geometry Problem