angle

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: LGPL-2.1 Imports: 4 Imported by: 0

Documentation

Overview

Package angle define angel calculation function.

Index

Constants

View Source
const (
	// PiTimes2 The value of 2*Pi
	PiTimes2 = 2.0 * math.Pi
	// PiOver2 The value of Pi/2
	PiOver2 = math.Pi / 2.0

	// PiOver4 PI_OVER_4The value of Pi/4
	PiOver4 = math.Pi / 4.0

	// None Constant representing no orientation
	None = 0

	// PiDegrees ...
	PiDegrees = 180.0
)
View Source
const (
	NE = iota + 1
	NW
	SW
	SE
)

Quadrant four const

Variables

This section is empty.

Functions

func Angle

func Angle(p0, p1 matrix.Matrix) float64

Angle Returns the angle of the vector from p0 to p1, relative to the positive X-axis. The angle is normalized to be in the range [ -Pi, Pi ].

func Between

func Between(tip1, tail, tip2 matrix.Matrix) float64

Between Returns the smallest angle between two vectors. The computed angle will be in the range [0, Pi).

func BetweenOriented

func BetweenOriented(tip1, tail, tip2 matrix.Matrix) float64

BetweenOriented Returns the oriented smallest angle between two vectors. The computed angle will be in the range (-Pi, Pi].

A positive result corresponds to a counterclockwise

(CCW) rotation

func Diff

func Diff(ang1, ang2 float64) float64

Diff Computes the smallest difference between two angles. The angles are assumed to be normalized to the range [-Pi, Pi]. The result will be in the range [0, Pi].

func InteriorAngle

func InteriorAngle(p0, p1, p2 matrix.Matrix) float64

InteriorAngle Computes the interior angle between two segments of a ring. The ring is

assumed to be oriented in a clockwise direction. The computed angle will be
in the range [0, 2Pi]

func IsAcute

func IsAcute(p0, p1, p2 matrix.Matrix) bool

IsAcute Tests whether the angle between p0-p1-p2 is acute. An angle is acute if it is less than 90 degrees.

func IsObtuse added in v1.0.1

func IsObtuse(p0, p1, p2 matrix.Matrix) bool

IsObtuse Tests whether the angle between p0-p1-p2 is obtuse. An angle is obtuse if it is greater than 90 degrees.

func MatrixAngle

func MatrixAngle(p matrix.Matrix) float64

MatrixAngle Returns the angle of the vector from (0,0) to p, relative to the positive X-axis. The angle is normalized to be in the range [ -Pi, Pi ].

func Normalize

func Normalize(angle float64) float64

Normalize Computes the normalized value of an angle, which is the equivalent angle in the range ( -Pi, Pi ].

func NormalizePositive

func NormalizePositive(angle float64) float64

NormalizePositive Computes the normalized positive value of an angle, which is the

equivalent angle in the range [ 0, 2*Pi ).

func Quadrant added in v1.0.1

func Quadrant(p0, p1 matrix.Matrix) (int, error)

Quadrant Returns the quadrant of a directed line segment from p0 to p1.

func QuadrantFloat added in v1.0.1

func QuadrantFloat(dx, dy float64) (int, error)

QuadrantFloat Returns the quadrant of a directed line segment (specified as x and y displacements, which cannot both be 0).

func ToDegrees

func ToDegrees(radians float64) float64

ToDegrees Converts from radians to degrees.

func ToRadians

func ToRadians(angleDegrees float64) float64

ToRadians Converts from degrees to radians.

func Turn

func Turn(ang1, ang2 float64) int

Turn Returns whether an angle must turn clockwise or counterclockwise to overlap another angle.

Types

This section is empty.

Jump to

Keyboard shortcuts

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