angleBisector: Given 3 sets of coordinates defining two line segments...

Description Usage

Description

Given 3 sets of coordinates defining two line segments (middle point is intersection), find line bisecting the angle through middle point. This is not vectorized. It only works with 3 sets of coordinates. Note that it is necessary to correctly find the compass direction theta, which the slope alone does not establish:

  1. If slope is negative and x2 >= x1 (travel is toward Quadrant IV), then theta = atan(slope)

  2. If slope is negative with x2 < x1 (travel is toward Quadrant II), then theta = atan(slope) + pi

  3. If slope is positive with x2 >= x1 (travel is toward Quadrant I), then theta = atan(slope)

  4. If slope is positive with x2<x1 (travel is toward Quadrant III), then theta = atan(slope) - pi

This returns theta in (-pi, pi). Then the turn is calculated, ie the change in direction between the two segments as the difference in theta, but it is reset to be on (-pi, pi) as well in order to correctly estimate the mean direction of travel (half the turn added to theta[1]).

Usage

1
angleBisector(corners)

forestgeo/ctfs documentation built on May 3, 2019, 6:44 p.m.