Documentation ¶
Index ¶
- Constants
- func Clamp(value float64, min float64, max float64) float64
- func ClampInt(value int, min int, max int) int
- func Degrees(radians float64) float64
- func Distance(x1, y1, x2, y2 float64) float64
- func Distance2(x1, y1, x2, y2 float64) float64
- func GetAdjacentHypotenuseTriangleLeg(angle, hypotenuseLength float64) float64
- func GetOppositeTriangleBase(angle, oppositeLength float64) float64
- func GetOppositeTriangleLeg(angle, baseLength float64) float64
- func LineIntersection(l1, l2 Line) (float64, float64, bool)
- func MaxInt(x, y int) int
- func NearlyEqual(a, b, epsilon float64) bool
- func Radians(degrees float64) float64
- type Circle
- type Line
- type Vector2
Constants ¶
const ( Pi = 3.14159 Pi2 = Pi * 2 HalfPi = Pi / 2 )
Variables ¶
This section is empty.
Functions ¶
func Clamp ¶
Clamp - converted C# method MathHelper.ClampInt Restricts a value to be within a specified range.
func GetAdjacentHypotenuseTriangleLeg ¶
GetAdjacentHypotenuseTriangleLeg gets the leg length adjacent the hypotenuse for angle in a right triangle
func GetOppositeTriangleBase ¶ added in v1.11.0
GetOppositeTriangleBase gets the base length opposite the non-hypotenuse leg in a right triangle
func GetOppositeTriangleLeg ¶
GetOppositeTriangleLeg gets the leg length opposite the non-hypotenuse base in a right triangle
func LineIntersection ¶
LineIntersection calculates the intersection of two lines.
func NearlyEqual ¶
Types ¶
type Line ¶
type Line struct {
X1, Y1, X2, Y2 float64
}
Line implementation for Geometry applications
func LineFromAngle ¶
LineFromAngle creates a line from a starting point at a given angle and length
type Vector2 ¶
type Vector2 struct {
X, Y float64
}
2-Dimensional point
func LineCircleIntersection ¶
LineCircleIntersection gets the intersection points (if any) of a circle, and either an infinite line or a line segment.