← All procedures

predicates.classifySegments

This function gives the exact relation of the closed segments `ab` and `cd`. The inputs must be finite.

CLI
Package
@procedures/predicates · README
Path
["predicates","classifySegments"]
CLI
mark predicates classifySegments --ax <number> --ay <number> --bx <number> --by <number> --cx <number> --cy <number> --dx <number> --dy <number>
As data
{"$proc":["predicates","classifySegments"],"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","classifySegments"], { ax: 1, ay: 1, bx: 1, by: 1, cx: 1, cy: 1, dx: 1, dy: 1 });
console.log(JSON.stringify(result));

From the command line

$ mark predicates classifySegments --ax <number> --ay <number> --bx <number> --by <number> --cx <number> --cy <number> --dx <number> --dy <number>

As data, in a program

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

Input

FieldTypeRequiredDefaultDescription
axnumberyes
aynumberyes
bxnumberyes
bynumberyes
cxnumberyes
cynumberyes
dxnumberyes
dynumberyes

Output

FieldTypeRequiredDefaultDescription
relation"cross" | "disjoint" | "overlap" | "touch"yes
collinearbooleanyesThe value is `true` when the four points are on one line. Then the comparisons of the floats give the relation. A segment of length 0 is on each line through its point.
stage"exact" | "filter"yesThe value is `exact` when the exact stage decided one of the orientation signs that the answer used.
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "ax": {
        "type": "number"
      },
      "ay": {
        "type": "number"
      },
      "bx": {
        "type": "number"
      },
      "by": {
        "type": "number"
      },
      "cx": {
        "type": "number"
      },
      "cy": {
        "type": "number"
      },
      "dx": {
        "type": "number"
      },
      "dy": {
        "type": "number"
      }
    },
    "required": [
      "ax",
      "ay",
      "bx",
      "by",
      "cx",
      "cy",
      "dx",
      "dy"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "relation": {
        "type": "string",
        "enum": [
          "cross",
          "disjoint",
          "overlap",
          "touch"
        ]
      },
      "collinear": {
        "type": "boolean",
        "description": "The value is `true` when the four points are on one line. Then the comparisons of the floats give the relation. A segment of length 0 is on each line through its point."
      },
      "stage": {
        "type": "string",
        "enum": [
          "exact",
          "filter"
        ],
        "description": "The value is `exact` when the exact stage decided one of the orientation signs that the answer used."
      }
    },
    "required": [
      "relation",
      "collinear",
      "stage"
    ],
    "additionalProperties": {}
  }
}