Documentation
¶
Overview ¶
Package angle define angel calculation function.
Index ¶
- Constants
- func Angle(p0, p1 matrix.Matrix) float64
- func Between(tip1, tail, tip2 matrix.Matrix) float64
- func BetweenOriented(tip1, tail, tip2 matrix.Matrix) float64
- func Diff(ang1, ang2 float64) float64
- func InteriorAngle(p0, p1, p2 matrix.Matrix) float64
- func IsAcute(p0, p1, p2 matrix.Matrix) bool
- func IsObtuse(p0, p1, p2 matrix.Matrix) bool
- func MatrixAngle(p matrix.Matrix) float64
- func Normalize(angle float64) float64
- func NormalizePositive(angle float64) float64
- func Quadrant(p0, p1 matrix.Matrix) (int, error)
- func QuadrantFloat(dx, dy float64) (int, error)
- func ToDegrees(radians float64) float64
- func ToRadians(angleDegrees float64) float64
- func Turn(ang1, ang2 float64) int
Constants ¶
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 )
const ( NE = iota + 1 NW SW SE )
Quadrant four const
Variables ¶
This section is empty.
Functions ¶
func Angle ¶
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 ¶
Between Returns the smallest angle between two vectors. The computed angle will be in the range [0, Pi).
func BetweenOriented ¶
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 ¶
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 ¶
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 ¶
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
IsObtuse Tests whether the angle between p0-p1-p2 is obtuse. An angle is obtuse if it is greater than 90 degrees.
func MatrixAngle ¶
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 ¶
Normalize Computes the normalized value of an angle, which is the equivalent angle in the range ( -Pi, Pi ].
func NormalizePositive ¶
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
Quadrant Returns the quadrant of a directed line segment from p0 to p1.
func QuadrantFloat ¶ added in v1.0.1
QuadrantFloat Returns the quadrant of a directed line segment (specified as x and y displacements, which cannot both be 0).
Types ¶
This section is empty.