geo.ringWinding
This function gives the winding of a ring in the plane of longitude and latitude: the sign of its exact signed area. The sum uses exact dyadic numbers, so a rounding error cannot change the result. For a ring that crosses itself, the result is the sign of the sum of the signed areas of its loops.
CLI- Package
- @procedures/geo · README
- Path
["geo","ringWinding"]- CLI
mark geo ringWinding --ring <any[][]>- As data
{"$proc":["geo","ringWinding"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/geo/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["geo","ringWinding"], { ring: [] });
console.log(JSON.stringify(result));From the command line
$ mark geo ringWinding --ring <any[][]>
As data, in a program
{ "$proc": ["geo", "ringWinding"], "input": { "ring": [] } }Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
ring | any[][] | yes |
Output
The schema does not list fields ("clockwise" | "counterclockwise" | "degenerate").
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"ring": {
"type": "array",
"items": {
"type": "array",
"items": [
{
"type": "number"
},
{
"type": "number"
},
{
"type": "number"
}
],
"additionalItems": {},
"minItems": 2
}
}
},
"required": [
"ring"
],
"additionalProperties": false
},
"output": {
"type": "string",
"enum": [
"clockwise",
"counterclockwise",
"degenerate"
]
}
}