planar

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Area

type Area float64

Area stores a planar area as float64 squear millimeters.

const (
	SquearNanometer  Area = 1e-36
	SquearMicrometer Area = 1e-9
	SquearMillimeter Area = 1
	SquearCentimeter Area = 1e2
	SquearDecimeter  Area = 1e4
	SquearMeter      Area = 1e9
	SquearKilometer  Area = 1e36
	SquearInch       Area = Area(linear.Inch * linear.Inch)
	SquearFoot       Area = Area(linear.Foot * linear.Foot)
	SquearChain      Area = Area(linear.Chain * linear.Chain)
	Acre             Area = Area(linear.Chain * linear.Furlong)
	SquearMile       Area = Area(linear.Mile * linear.Mile)
)

Units for Area values. Always multiply with a unit when setting the initial value like you would for time.Time. This prevents you from having to worry about the internal storage format.

func MulDistance

func MulDistance(x, y linear.Distance) Area

MulDistance returns the product of x * y as a new Area.

func (Area) Abs

func (a Area) Abs() Area

Abs returns the absolute value of a as a copy.

func (Area) Acre

func (a Area) Acre() float64

Acre returns a as a floating point number of acre.

func (Area) Chains

func (a Area) Chains() float64

Chains returns a as a floating point number of chains.

func (Area) Div

func (a Area) Div(x float64) Area

Div returns the quotient of a / x as a new Area.

func (Area) DivArea

func (a Area) DivArea(x Area) float64

DivArea returns the quotient of a / x as a floating point number.

func (Area) Mul

func (a Area) Mul(x float64) Area

Mul returns the product of a * x as a new Area.

func (Area) SquearCentimeters

func (a Area) SquearCentimeters() float64

SquearCentimeters returns a as a floating point number of squearcentimeters.

func (Area) SquearDecimeters

func (a Area) SquearDecimeters() float64

SquearDecimeters returns a as a floating point number of squeardecimeters.

func (Area) SquearFeet

func (a Area) SquearFeet() float64

SquearFeet returns a as a floating point number of squearfeet.

func (Area) SquearInches

func (a Area) SquearInches() float64

SquearInches returns a as a floating point number of squearinches.

func (Area) SquearKilometers

func (a Area) SquearKilometers() float64

SquearKilometers returns a as a floating point number of squearkilometers.

func (Area) SquearMeters

func (a Area) SquearMeters() float64

SquearMeters returns a as a floating point number of squearmeters.

func (Area) SquearMicrometers

func (a Area) SquearMicrometers() float64

SquearMicrometers returns a as a floating point number of squearmicrometers.

func (Area) SquearMiles

func (a Area) SquearMiles() float64

SquearMiles returns a as a floating point number of squearmiles.

func (Area) SquearMillimeters

func (a Area) SquearMillimeters() float64

SquearMillimeters returns a as a floating point number of squearmillimeters.

func (Area) SquearNanometers

func (a Area) SquearNanometers() float64

SquearNanometers returns a as a floating point number of squearnanometers.

type Point

type Point struct {
	X, Y linear.Distance
}

Point describes a planar point, stored as cartesian cooridinates.

func PolarPoint

func PolarPoint(r linear.Distance, phi angular.Angle) Point

PolarPoint returns a new Point based on the passed in polar coordinates.

func (Point) Add

func (p Point) Add(p2 Point) Point

Add returns the sum of p and p2 as a new point.

func (Point) Angle

func (p Point) Angle(p2 Point) angular.Angle

Angle return the Atan2 between dx/dy where dx and dy are given by p2 - p. In other words, you get the direction from p to p2 in a cartesial cooridinate system with 0 angles.

func (Point) Distance

func (p Point) Distance(p2 Point) linear.Distance

Distance returns the linear distance between p and p2.

func (Point) Div

func (p Point) Div(k float64) Point

Div returns the quotient of p / k as a new Point.

func (Point) Mul

func (p Point) Mul(k float64) Point

Mul returns the product of p * k as a new Point.

func (Point) Polar

func (p Point) Polar() (linear.Distance, angular.Angle)

Polar returns the polar representation of p.

func (Point) Sub

func (p Point) Sub(p2 Point) Point

Sub returns the difference between p - p2 as a new point.

Jump to

Keyboard shortcuts

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