package
Version:
v0.0.4
Opens a new window with list of versions in this module.
Published: Mar 5, 2022
License: BSD-3-Clause
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package r2 provides 2D vectors and boxes and operations on them.
Cos returns the cosine of the opening angle between p and q.
Cross returns the cross product p×q.
Dot returns the dot product p·q.
Norm returns the Euclidean norm of p
|p| = sqrt(p_x^2 + p_y^2).
Norm2 returns the Euclidean squared norm of p
|p|^2 = p_x^2 + p_y^2.
type Box struct {
Min, Max Vec
}
Box is a 2D bounding box.
Rotation describes a rotation in 2D.
NewRotation creates a rotation by alpha, around p.
Rotate returns p rotated according to the parameters used to construct
the receiver.
Vec is a 2D vector.
Add returns the vector sum of p and q.
Rotate returns a new vector, rotated by alpha around the provided point, q.
Scale returns the vector p scaled by f.
Sub returns the vector sum of p and -q.
Unit returns the unit vector colinear to p.
Unit returns {NaN,NaN} for the zero vector.
Add returns the vector sum of p and q.
DEPRECATED: use r2.Add.
Cross returns the cross product p×q.
DEPRECATED: use r2.Cross.
Dot returns the dot product p·q.
DEPRECATED: use r2.Dot.
Rotate returns a new vector, rotated by alpha around the provided point, q.
DEPRECATED: use r2.Rotate.
Scale returns the vector p scaled by f.
DEPRECATED: use r2.Scale.
Sub returns the vector sum of p and -q.
DEPRECATED: use r2.Sub.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.