← All procedures

predicates.rayEdge

This function gives the exact test of the edge from `a` to `b`, moved by `t = (tx, ty)`, and the ray from `(x, y)` to the east. The result has no error, also when a float sum of a position and `t` rounds.

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

From the command line

$ mark predicates rayEdge --ax <number> --ay <number> --bx <number> --by <number> --x <number> --y <number>

As data, in a program

{
  "$proc": ["predicates", "rayEdge"],
  "input": { "ax": 1, "ay": 1, "bx": 1, "by": 1, "x": 1, "y": 1 }
}

Input

FieldTypeRequiredDefaultDescription
axnumberyesThe x of the end `a`.
aynumberyesThe y of the end `a`.
bxnumberyesThe x of the end `b`.
bynumberyesThe y of the end `b`.
xnumberyesThe x of the point.
ynumberyesThe y of the point.
txnumbernoThe move of the edge on the x axis. The default is 0.
tynumbernoThe move of the edge on the y axis. The default is 0.

Output

The schema does not list fields ("boundary" | "crosses" | "misses").

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "ax": {
        "type": "number",
        "description": "The x of the end `a`."
      },
      "ay": {
        "type": "number",
        "description": "The y of the end `a`."
      },
      "bx": {
        "type": "number",
        "description": "The x of the end `b`."
      },
      "by": {
        "type": "number",
        "description": "The y of the end `b`."
      },
      "x": {
        "type": "number",
        "description": "The x of the point."
      },
      "y": {
        "type": "number",
        "description": "The y of the point."
      },
      "tx": {
        "type": "number",
        "description": "The move of the edge on the x axis. The default is 0."
      },
      "ty": {
        "type": "number",
        "description": "The move of the edge on the y axis. The default is 0."
      }
    },
    "required": [
      "ax",
      "ay",
      "bx",
      "by",
      "x",
      "y"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "string",
    "enum": [
      "boundary",
      "crosses",
      "misses"
    ]
  }
}