lib/geometry.js
function getPointLineSegmentState([ x, y ], [ [ beginX, beginY ], [ endX, endY ] ]) {
	if (!isPointInLine([ x, y ], [ [ beginX, beginY ], [ endX, endY ] ])) {
		return OUTSIDE;
	}
	if (beginX === endX) {
		if (roundToFiveSignificantDigits((y - beginY) * (y - endY)) < 0) {
			return INSIDE;
		} else if (roundToFiveSignificantDigits((y - beginY) * (y - endY)) === 0) {
			return TANGENT;
		} else {
			return OUTSIDE;
		}
	}
	if (beginY === endY) {
		if (roundToFiveSignificantDigits((x - beginX) * (x - endX)) < 0) {
			return INSIDE;
		} else if (roundToFiveSignificantDigits((x - beginX) * (x - endX)) === 0) {
			return TANGENT;
		} else {
			return OUTSIDE;
		}
	}
	if (roundToFiveSignificantDigits((x - beginX) * (x - endX)) < 0
		&& roundToFiveSignificantDigits((y - beginY) * (y - endY)) < 0) {
		return INSIDE;
	} else if (x === beginX && y === beginY || (x === endX && y === endY)) {
		return TANGENT;
	} else {
		return OUTSIDE;
	}
}
function getPointLineSegmentState([ x, y ], [ [ beginX, beginY ], [ endX, endY ] ]) {
	if (!isPointInLine([ x, y ], [ [ beginX, beginY ], [ endX, endY ] ])) {
		return OUTSIDE;
	}
	if (beginX === endX) {
		if (roundToFiveSignificantDigits((y - beginY) * (y - endY)) < 0) {
			return INSIDE;
		} else if (roundToFiveSignificantDigits((y - beginY) * (y - endY)) === 0) {
			return TANGENT;
		} else {
			return OUTSIDE;
		}
	}
	if (beginY === endY) {
		if (roundToFiveSignificantDigits((x - beginX) * (x - endX)) < 0) {
			return INSIDE;
		} else if (roundToFiveSignificantDigits((x - beginX) * (x - endX)) === 0) {
			return TANGENT;
		} else {
			return OUTSIDE;
		}
	}
	if (roundToFiveSignificantDigits((x - beginX) * (x - endX)) < 0
		&& roundToFiveSignificantDigits((y - beginY) * (y - endY)) < 0) {
		return INSIDE;
	} else if (x === beginX && y === beginY || (x === endX && y === endY)) {
		return TANGENT;
	} else {
		return OUTSIDE;
	}
}
function getPointLineSegmentState ( [ x , y ] , [ [ beginX , beginY ] , [ endX , endY ] ] ) { if ( ! isPointInLine ( [ x , y ] , [ [ beginX , beginY ] , [ endX , endY ] ] ) ) { return OUTSIDE ; } if ( beginX === endX ) { if ( roundToFiveSignificantDigits ( ( y - beginY ) * ( y - endY ) ) < 0 ) { return INSIDE ; } else if ( roundToFiveSignificantDigits ( ( y - beginY ) * ( y - endY ) ) === 0 ) { return TANGENT ; } else { return OUTSIDE ; } } if ( beginY === endY ) { if ( roundToFiveSignificantDigits ( ( x - beginX ) * ( x - endX ) ) < 0 ) { return INSIDE ; } else if ( roundToFiveSignificantDigits ( ( x - beginX ) * ( x - endX ) ) === 0 ) { return TANGENT ; } else { return OUTSIDE ; } } if ( roundToFiveSignificantDigits ( ( x - beginX ) * ( x - endX ) ) < 0 && roundToFiveSignificantDigits ( ( y - beginY ) * ( y - endY ) ) < 0 ) { return INSIDE ; } else if ( x === beginX && y === beginY || ( x === endX && y === endY ) ) { return TANGENT ; } else { return OUTSIDE ; } }
Get the state of a point in relationship to a line segment

@method getPointLineSegmentState
@param {Number[]} [ x, y ] - coordinates of the point
@param {Number[][]} [ [ beginX, beginY ], [ endX, endY ] ] - coordinates of begin and end points of the line segment
@return {String} - return the state of the point. Can only be one of: 'inside', 'outside' and 'tangent'
Get the state of a point in relationship to a line segment