Documentation
¶
Index ¶
- func IntersectsInfiniteLineCircle(A, B, center F, radius float32) bool
- func IntersectsLineCircleInclusive(A, B, center F, radius float32) bool
- func IntersectsLineExclusive(A, B, C, D F) bool
- type D
- func (v D) Abs() D
- func (v D) Add(other D) D
- func (v D) AddScalar(scalar float64) D
- func (v D) AddScalars(x, y float64) D
- func (v D) Angle() float64
- func (v D) AngleBetweenLines(v2 D) float64
- func (v D) AngleTo(v2 D) float64
- func (v D) AsFloat() F
- func (v D) AsInt() I
- func (v D) Ceil() D
- func (v D) Clamp(low, high D) D
- func (v D) Components() (x, y float64)
- func (v D) Cross(other D) float64
- func (v D) DistanceTo(v2 D) float64
- func (v D) DistanceToLine(a, b D) float64
- func (v D) DistanceToSquared(v2 D) float64
- func (v D) Div(other D) D
- func (v D) DivScalar(scalar float64) D
- func (v D) DivScalars(x, y float64) D
- func (v D) Dot(other D) float64
- func (v D) Equals(other D) bool
- func (v D) Floor() D
- func (v D) IsBetweenInclusive(left, right D) bool
- func (v D) IsZero() bool
- func (v D) Magnitude() float64
- func (v D) MarshalJSON() ([]byte, error)
- func (v D) Max(v2 D) D
- func (v D) Min(v2 D) D
- func (v D) Mul(other D) D
- func (v D) MulScalar(scalar float64) D
- func (v D) MulScalars(x, y float64) D
- func (v D) NegatedY() D
- func (v D) Normalized() D
- func (v D) Perpendicular() D
- func (v D) Reflect(other D) D
- func (v D) Rotate(angle float64) D
- func (v D) Round() D
- func (v D) SideOfLine(a, b D) float64
- func (v D) String() string
- func (v D) Sub(other D) D
- func (v D) SubScalar(scalar float64) D
- func (v D) SubScalars(x, y float64) D
- func (v D) Swap() D
- func (v *D) UnmarshalJSON(data []byte) error
- func (v D) WithX(value float64) D
- func (v D) WithY(value float64) D
- type F
- func (v F) Abs() F
- func (v F) Add(other F) F
- func (v F) AddScalar(scalar float32) F
- func (v F) AddScalars(x, y float32) F
- func (v F) Angle() float32
- func (v F) AngleBetweenLines(v2 F) float32
- func (v F) AngleTo(v2 F) float32
- func (v F) AsDouble() D
- func (v F) AsInt() I
- func (v F) Ceil() F
- func (v F) Clamp(low, high F) F
- func (v F) Components() (x, y float32)
- func (v F) Cross(other F) float32
- func (v F) DistanceTo(v2 F) float32
- func (v F) DistanceToLine(a, b F) float32
- func (v F) DistanceToSquared(v2 F) float32
- func (v F) Div(other F) F
- func (v F) DivScalar(scalar float32) F
- func (v F) DivScalars(x, y float32) F
- func (v F) Dot(other F) float32
- func (v F) Equals(other F) bool
- func (v F) Floor() F
- func (v F) IsBetweenInclusive(left, right F) bool
- func (v F) IsZero() bool
- func (v F) Magnitude() float32
- func (v F) MarshalJSON() ([]byte, error)
- func (v F) Max(v2 F) F
- func (v F) Min(v2 F) F
- func (v F) Mul(other F) F
- func (v F) MulScalar(scalar float32) F
- func (v F) MulScalars(x, y float32) F
- func (v F) NegatedY() F
- func (v F) Normalized() F
- func (v F) Perpendicular() F
- func (v F) Reflect(other F) F
- func (v F) Rotate(angle float32) F
- func (v F) Round() F
- func (v F) SideOfLine(a, b F) float32
- func (v F) String() string
- func (v F) Sub(other F) F
- func (v F) SubScalar(scalar float32) F
- func (v F) SubScalars(x, y float32) F
- func (v F) Swap() F
- func (v *F) UnmarshalJSON(data []byte) error
- func (v F) WithX(value float32) F
- func (v F) WithY(value float32) F
- type I
- func (i I) Abs() I
- func (i I) Add(other I) I
- func (i I) AddScalars(x, y int32) I
- func (i I) Area() int32
- func (i I) AsDouble() D
- func (i I) AsFloat() F
- func (i I) Clamp(left, right I) I
- func (i I) Components() (x, y int32)
- func (i I) Equals(other I) bool
- func (i I) Index(width int32) int32
- func (i I) IsBetweenInclusive(left, right I) bool
- func (i I) IsZero() bool
- func (i I) Magnitude() float64
- func (v I) MarshalJSON() ([]byte, error)
- func (i I) Max(other I) I
- func (i I) Min(other I) I
- func (i I) MinMax(other I) (min_, max_ I)
- func (i I) String() string
- func (i I) Sub(other I) I
- func (i *I) UnmarshalJSON(data []byte) error
- type RotationKernel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IntersectsInfiniteLineCircle ¶
IntersectsInfiniteLineCircle returns true if an infinite line segment A-B intersects circle with given center and radius Based on https://mathworld.wolfram.com/Circle-LineIntersection.html
func IntersectsLineExclusive ¶
IntersectsLineExclusive returns true if line segments A-B and C-D intersect (excluding endpoints)
Types ¶
type D ¶
type D struct {
X, Y float64
}
func ClosestPointOnLineD ¶
ClosestPointOnLineD returns the point on the infinite line a-b closest to target
func ClosestPointOnLineSegmentD ¶
ClosestPointOnLineSegmentD returns the point on the line a-b closest to target. t is the ratio between a and b of that point
func NewPolarDFast ¶
func NewRandomD ¶
func (D) AddScalars ¶
func (D) AngleBetweenLines ¶
AngleBetweenLines calculates the angle between two lines starting at origo returns values in the range [-Pi, Pi].
func (D) Components ¶
func (D) DistanceTo ¶
func (D) DistanceToLine ¶
func (D) DistanceToSquared ¶
func (D) DivScalars ¶
func (D) IsBetweenInclusive ¶
func (D) MarshalJSON ¶
func (D) MulScalars ¶
func (D) Normalized ¶
func (D) Perpendicular ¶
func (D) SideOfLine ¶
SideOfLine calculates which side of the line A->B the point P lies on. Check the sign of the response.
func (D) SubScalars ¶
func (*D) UnmarshalJSON ¶
type F ¶
type F struct {
X, Y float32
}
func ClosestPointOnLineF ¶
ClosestPointOnLineF returns the point on the infinite line a-b closest to target
func ClosestPointOnLineSegmentF ¶
ClosestPointOnLineSegmentF returns the point on the line a-b closest to target. t is the ratio between a and b of that point
func LineIntersection ¶
LineIntersection calculates the (extended) intersection between lines A-B and C-D
func NewPolarFFast ¶
func NewRandomF ¶
func (F) AddScalars ¶
func (F) AngleBetweenLines ¶
AngleBetweenLines calculates the angle between two lines starting at origo returns values in the range [-Pi, Pi].
func (F) Components ¶
func (F) DistanceTo ¶
func (F) DistanceToLine ¶
func (F) DistanceToSquared ¶
func (F) DivScalars ¶
func (F) IsBetweenInclusive ¶
func (F) MarshalJSON ¶
func (F) MulScalars ¶
func (F) Normalized ¶
func (F) Perpendicular ¶
func (F) SideOfLine ¶
SideOfLine calculates which side of the line A->B the point P lies on. Check the sign of the response.
func (F) SubScalars ¶
func (*F) UnmarshalJSON ¶
type I ¶
type I struct {
X, Y int32
}
func (I) AddScalars ¶
func (I) Components ¶
func (I) IsBetweenInclusive ¶
func (I) MarshalJSON ¶
func (*I) UnmarshalJSON ¶
type RotationKernel ¶
type RotationKernel struct {
// contains filtered or unexported fields
}
func NewRotationKernel ¶
func NewRotationKernel(angle float32) (rk RotationKernel)
func (RotationKernel) Rotate ¶
func (rk RotationKernel) Rotate(v F) F