Skip to content

Line

Module Geometry.Lines

In ixfx, a Line is two Points

type Line = {
a: Point
b: Point
}

Once you have that there are a bunch of functions to help you work with circles.

Manipulating

Comparison with other shapes

  • distance - distance from point to nearest point on line
  • nearest -nearest point on line to another point
  • withinRange - returns true if point is within a given range of line

Conversions

Math

Etc

  • isEmpty - Checks if line is empty
  • empty - Returns an empty point
// Sub module
import { Lines } from "@ixfx/geometry.js"
// Eg: Lines.nearest();
// Whole module
import * as Geometry from "@ixfx/geometry.js"
// Eg: Geometry.Lines.nearest();
// From bundle
import { Geometry } from "@ixfx"
// Eg: Geometry.Lines.nearest();
// And within your HTML's <HEAD> </HEAD> block:
<script type="importmap">{ "imports": { "@ixfx":"/ixfx/index.js", "@ixfx/": "/ixfx/" } }</script>