Skip to main content
Version: Next

polygonTangents

Description

Finds the tangents of a (Multi)Polygon from a Point.

Parameters

NameTypeDescription
ptCoordto calculate the tangent points from
polygonFeature<Polygon | MultiPolygon>to get tangents from

Returns

FeatureCollection<Point> Feature Collection containing the two tangent points

Examples

var polygon = turf.polygon([
[
[11, 0],
[22, 4],
[31, 0],
[31, 11],
[21, 15],
[11, 11],
[11, 0],
],
]);
var point = turf.point([61, 5]);

var tangents = turf.polygonTangents(point, polygon);

Installation

$ npm install @turf/polygon-tangents

import { polygonTangents } from "@turf/polygon-tangents";
const result = polygonTangents(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.polygonTangents(...);