← All procedures

predicates.orient2d

This function gives the exact orientation sign of the points `a`, `b` and `c`, and the stage that decided it. The inputs must be finite.

CLI
Package
@procedures/predicates · README
Path
["predicates","orient2d"]
CLI
mark predicates orient2d --ax <number> --ay <number> --bx <number> --by <number> --cx <number> --cy <number>
As data
{"$proc":["predicates","orient2d"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/predicates/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["predicates","orient2d"], { ax: 1, ay: 1, bx: 1, by: 1, cx: 1, cy: 1 });
console.log(JSON.stringify(result));

From the command line

$ mark predicates orient2d --ax <number> --ay <number> --bx <number> --by <number> --cx <number> --cy <number>

As data, in a program

{
  "$proc": ["predicates", "orient2d"],
  "input": { "ax": 1, "ay": 1, "bx": 1, "by": 1, "cx": 1, "cy": 1 }
}

Input

FieldTypeRequiredDefaultDescription
axnumberyes
aynumberyes
bxnumberyes
bynumberyes
cxnumberyes
cynumberyes

Output

FieldTypeRequiredDefaultDescription
signnumber | number | numberyes
stage"exact" | "filter"yes
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "ax": {
        "type": "number"
      },
      "ay": {
        "type": "number"
      },
      "bx": {
        "type": "number"
      },
      "by": {
        "type": "number"
      },
      "cx": {
        "type": "number"
      },
      "cy": {
        "type": "number"
      }
    },
    "required": [
      "ax",
      "ay",
      "bx",
      "by",
      "cx",
      "cy"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "sign": {
        "anyOf": [
          {
            "type": "number",
            "const": -1
          },
          {
            "type": "number",
            "const": 0
          },
          {
            "type": "number",
            "const": 1
          }
        ]
      },
      "stage": {
        "type": "string",
        "enum": [
          "exact",
          "filter"
        ]
      }
    },
    "required": [
      "sign",
      "stage"
    ],
    "additionalProperties": {}
  }
}