← All procedures

geo.toUnitVector

This function gives the unit vector of a point, from the center of a sphere to the point. A drawing in 3D multiplies the vector by its radius.

CLI
Package
@procedures/geo · README
Path
["geo","toUnitVector"]
CLI
mark geo toUnitVector --point <object>
As data
{"$proc":["geo","toUnitVector"],"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","toUnitVector"], { point: {} });
console.log(JSON.stringify(result));

From the command line

$ mark geo toUnitVector --point <object>

As data, in a program

{ "$proc": ["geo", "toUnitVector"], "input": { "point": {} } }

Input

FieldTypeRequiredDefaultDescription
pointobjectyes

Output

FieldTypeRequiredDefaultDescription
xnumberyes
ynumberyes
znumberyes
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "point": {
        "type": "object",
        "properties": {
          "lat": {
            "type": "number",
            "description": "The latitude in degrees, from -90 to 90."
          },
          "lon": {
            "type": "number",
            "description": "The longitude in degrees. A normalized longitude is from -180 to less than 180."
          }
        },
        "required": [
          "lat",
          "lon"
        ],
        "additionalProperties": {}
      }
    },
    "required": [
      "point"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "x": {
        "type": "number"
      },
      "y": {
        "type": "number"
      },
      "z": {
        "type": "number"
      }
    },
    "required": [
      "x",
      "y",
      "z"
    ],
    "additionalProperties": {}
  }
}