geometry

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package geometry provides helpers to work with geometry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance added in v1.0.49

func Distance(a Coordinate2D, b Coordinate2D) float64

Distance returns the distance between coordinate a and coordinate b.

func Distance3D

func Distance3D(a Coordinate3D, b Coordinate3D) float64

Distance3D returns the distance of coordinates a and b in three-dimensional space.

func EndPoint3D

func EndPoint3D(a Coordinate3D, m Coordinate3D) (float64, float64, float64)

EndPoint3D returns the coordinate b with given coordinate a and midpoint m.

func Midpoint

func Midpoint(a Coordinate2D, b Coordinate2D) (float64, float64)

Midpoint returns the midpoint of coordinate a and coordinate b.

func Midpoint3D

func Midpoint3D(a Coordinate3D, b Coordinate3D) (float64, float64, float64)

Midpoint3D returns the midpoint of coordinates a and b in three-dimensional space.

func Slope

func Slope(a Coordinate2D, b Coordinate2D) float64

Slope returns the slope of coordinate a and coordinate b.

Types

type Coordinate2D

type Coordinate2D struct {
	X float64
	Y float64
}

Coordinate2D represents a coordinate in two-dimensional space.

func (Coordinate2D) Distance added in v1.0.49

func (a Coordinate2D) Distance(b Coordinate2D) float64

Distance returns the distance between coordinate a and coordinate b.

func (Coordinate2D) Midpoint

func (a Coordinate2D) Midpoint(b Coordinate2D) (float64, float64)

Midpoint returns the midpoint of coordinate a and coordinate b.

func (Coordinate2D) Slope

func (a Coordinate2D) Slope(b Coordinate2D) float64

Slope returns the slope of coordinate a and coordinate b.

type Coordinate3D

type Coordinate3D struct {
	X float64
	Y float64
	Z float64
}

Coordinate3D represents a coordinate in three-dimensional space.

func (Coordinate3D) Distance

func (a Coordinate3D) Distance(b Coordinate3D) float64

Distance returns the distance of coordinates a and b in three-dimensional space.

func (Coordinate3D) EndPointB

func (a Coordinate3D) EndPointB(m Coordinate3D) (float64, float64, float64)

EndPointB returns the coordinate b with given coordinate a and midpoint m.

func (Coordinate3D) Midpoint

func (a Coordinate3D) Midpoint(b Coordinate3D) (float64, float64, float64)

Midpoint returns the midpoint of coordinates a and b in three-dimensional space.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL