Documentation ¶
Index ¶
- func AngleDegrees(angleRadian float64) float64
- func AngleRadian(angleDegrees float64) float64
- func GaussJordanElimination(A [][]float64, b []float64) ([]float64, error)
- func InverseMatrix(m [3][3]float64) ([3][3]float64, error)
- func NormalizeAngleDegrees(theta float64) float64
- func NormalizeAngleRadian(theta float64) float64
- type AffineMatrix
- type Bounds
- type Circle
- type CircleInt
- type CircularArc
- type CircularArc2
- type CircularArcInt
- type Contour
- type Coord
- type Ellipse
- type EllipticalArc
- type GeneralFormLine
- type Interpolation
- type LineSegment
- func (l *LineSegment) ContainsPoint(p Point) bool
- func (l *LineSegment) IntersectionLineSegment(l2 *LineSegment) (Point, bool)
- func (l *LineSegment) IntersectionRay(r *Ray) (Point, bool)
- func (l *LineSegment) IntersectionStraightLine(sl *StraightLine) (Point, bool)
- func (l *LineSegment) ToSlopeInterceptFormLine() *SlopeInterceptFormLine
- func (l *LineSegment) Vector() Vector
- type LineSegmentInt
- type Point
- type Point3D
- type Point3DInt
- type PointInt
- type Polygon
- type PolynomialCurve
- type Ray
- type Rectangle
- type RectangleInt
- type RegularPolygon
- type Segment
- type SineWave
- type SlopeInterceptFormLine
- type StraightLine
- func (l *StraightLine) ContainsPoint(p Point) bool
- func (l *StraightLine) IntersectStraightLine(l2 *StraightLine) bool
- func (l *StraightLine) IntersectionStraightLine(l2 *StraightLine) (Point, bool)
- func (l *StraightLine) ToGeneralFormLine() *GeneralFormLine
- func (l *StraightLine) ToSlopeInterceptLine() *SlopeInterceptFormLine
- type Triangle
- type Vector
- type VectorInt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AngleDegrees ¶
func AngleRadian ¶
func GaussJordanElimination ¶
GaussJordanElimination 高斯-约旦消元法求解线性方程组 Ax = b
func InverseMatrix ¶ added in v0.3.5
InverseMatrix 计算 3x3 矩阵的逆
func NormalizeAngleDegrees ¶
func NormalizeAngleRadian ¶
Types ¶
type AffineMatrix ¶
type AffineMatrix [2][3]float64
定义一个2x3的仿射变换矩阵
func NewAffineMatrix ¶
func NewAffineMatrix(src, dst [3]Point) (AffineMatrix, error)
func NewRotationMat ¶
func NewRotationMat(center Point, angleDeg float64) AffineMatrix
func NewTranslateRotationMat ¶
func NewTranslateRotationMat(pA, pB Point, angleDeg float64) AffineMatrix
NewTranslateRotationMat transforms a point from coordinate system a2 to a1 在数学和计算机图形学中,旋转角度的正负通常遵循右手定则。默认情况下,顺时针方向被认为是负的,而逆时针方向被认为是正的。 O2相对于O1旋转度数
type Bounds ¶
func BoundsFromImageRect ¶
type CircleInt ¶
type CircleInt[T constraints.Integer] struct { Center PointInt[T] Diameter T }
type CircularArc ¶
counter clockwise if clockwise ,Start.X,Start.Y <-> endX, endY
func CircularArcFromPoints ¶
func CircularArcFromPoints(center, start, end Point) *CircularArc
func NewCircularArc ¶
func NewCircularArc(circle Circle, startAngle, endAngle float64) *CircularArc
func (*CircularArc) Bounds ¶
func (a *CircularArc) Bounds() *Bounds
func (*CircularArc) Sample ¶
func (a *CircularArc) Sample(samples int) []Point
type CircularArc2 ¶
func NewCircularArc2 ¶
func NewCircularArc2(center, start, end Point) *CircularArc2
func (*CircularArc2) ToCircularArc ¶
func (a *CircularArc2) ToCircularArc() *CircularArc
type CircularArcInt ¶
type CircularArcInt[T constraints.Integer] struct { Circle CircleInt[T] StartAngle float64 EndAngle float64 }
func ArcIntFromFloat64 ¶
func ArcIntFromFloat64[T constraints.Integer](e *CircularArc, factor float64) *CircularArcInt[T]
func (*CircularArcInt[T]) ToFloat64 ¶
func (e *CircularArcInt[T]) ToFloat64(factor float64) *CircularArc
type Ellipse ¶
type Ellipse struct { Centre Point MajorAxis float64 // Length of the major axis MinorAxis float64 // Length of the minor axis Angle float64 // Angle angle in degrees from the x-axis }
func (*Ellipse) GetHalfAxes ¶
GetHalfAxes returns the half lengths of the major and minor axes.
type EllipticalArc ¶
type GeneralFormLine ¶ added in v0.3.5
ax + by + c = 0
func NewGeneralFormLine ¶
func NewGeneralFormLine(a, b, c float64) *GeneralFormLine
func (*GeneralFormLine) ToSlopeInterceptLine ¶ added in v0.3.5
func (l *GeneralFormLine) ToSlopeInterceptLine() *SlopeInterceptFormLine
func (*GeneralFormLine) ToStraightLine ¶ added in v0.3.5
func (l *GeneralFormLine) ToStraightLine() *StraightLine
type Interpolation ¶
type Interpolation int
const ( InterpolationCCW Interpolation = iota InterpolationClockwise )
type LineSegment ¶
func NewLineSegment ¶ added in v0.3.5
func NewLineSegment(start, end Point) *LineSegment
func (*LineSegment) ContainsPoint ¶ added in v0.3.5
func (l *LineSegment) ContainsPoint(p Point) bool
func (*LineSegment) IntersectionLineSegment ¶ added in v0.3.5
func (l *LineSegment) IntersectionLineSegment(l2 *LineSegment) (Point, bool)
func (*LineSegment) IntersectionRay ¶ added in v0.3.5
func (l *LineSegment) IntersectionRay(r *Ray) (Point, bool)
func (*LineSegment) IntersectionStraightLine ¶ added in v0.3.5
func (l *LineSegment) IntersectionStraightLine(sl *StraightLine) (Point, bool)
func (*LineSegment) ToSlopeInterceptFormLine ¶ added in v0.3.5
func (l *LineSegment) ToSlopeInterceptFormLine() *SlopeInterceptFormLine
func (*LineSegment) Vector ¶
func (l *LineSegment) Vector() Vector
type LineSegmentInt ¶ added in v0.3.5
type LineSegmentInt[T constraints.Integer] struct { Start PointInt[T] End PointInt[T] }
func LineIntFromFloat64 ¶
func LineIntFromFloat64[T constraints.Integer](e *LineSegment, factor float64) *LineSegmentInt[T]
func (*LineSegmentInt[T]) ToFloat64 ¶ added in v0.3.5
func (l *LineSegmentInt[T]) ToFloat64(factor float64) *LineSegment
type Point ¶
Point 结构体用于表示一个点
func RandomPoint ¶
func (Point) Mirror ¶
func (p Point) Mirror(line *GeneralFormLine) Point
type Point3DInt ¶
type Point3DInt[T constraints.Integer] struct { X T Y T Z T }
func (*Point3DInt[T]) ToFloat64 ¶
func (l *Point3DInt[T]) ToFloat64(factor float64) *Point3D
type PolynomialCurve ¶ added in v0.3.5
func (*PolynomialCurve) ZeroAngleY ¶ added in v0.3.5
func (p *PolynomialCurve) ZeroAngleY(x float64) float64
type Ray ¶ added in v0.3.5
func (*Ray) IntersectRay ¶ added in v0.3.5
func (*Ray) IntersectionStraightLine ¶ added in v0.3.5
func (r *Ray) IntersectionStraightLine(l *StraightLine) (Point, bool)
func (*Ray) IsOnForwardRange ¶ added in v0.3.5
判断点是否在射线的正向范围内
type Rectangle ¶
func RectFromCorners ¶
func RectFromImageRect ¶
func RectNoRotate ¶
func RectNoRotate2 ¶
func (*Rectangle) ContainsPoint ¶
图片就是第四象限,角度90+θ
type RectangleInt ¶
type RectangleInt[T constraints.Integer] struct { Center PointInt[T] Width T Height T Angle float64 }
func NewRectInt ¶
func NewRectInt[T constraints.Integer](center PointInt[T], width, height T, angle float64) *RectangleInt[T]
func RectIntFromFloat64 ¶
func RectIntFromFloat64[T constraints.Integer](e *Rectangle, factor float64) *RectangleInt[T]
func (*RectangleInt[T]) ToFloat64 ¶
func (rect *RectangleInt[T]) ToFloat64(factor float64) *Rectangle
type RegularPolygon ¶
type Segment ¶
type Segment struct { Interpolation Interpolation End Point Centre Point }
A Segment is a stroked line.
type SineWave ¶ added in v0.3.5
type SineWave struct { Amplitude float64 Frequency float64 PhaseShift float64 VerticalShift float64 Angle float64 }
func (*SineWave) ZeroAngleY ¶ added in v0.3.5
type SlopeInterceptFormLine ¶ added in v0.3.5
y=mx+b
func NewSlopeInterceptLine ¶
func NewSlopeInterceptLine(m, b float64) *SlopeInterceptFormLine
func (*SlopeInterceptFormLine) IsVertical ¶ added in v0.3.5
func (l *SlopeInterceptFormLine) IsVertical() bool
func (*SlopeInterceptFormLine) ToGeneralFormLine ¶ added in v0.3.5
func (l *SlopeInterceptFormLine) ToGeneralFormLine() *GeneralFormLine
func (*SlopeInterceptFormLine) ToStraightLine ¶ added in v0.3.5
func (l *SlopeInterceptFormLine) ToStraightLine() *StraightLine
type StraightLine ¶
func NewStraightLine ¶ added in v0.3.5
func NewStraightLine(p Point, angle float64) *StraightLine
func (*StraightLine) ContainsPoint ¶ added in v0.3.5
func (l *StraightLine) ContainsPoint(p Point) bool
func (*StraightLine) IntersectStraightLine ¶ added in v0.3.5
func (l *StraightLine) IntersectStraightLine(l2 *StraightLine) bool
func (*StraightLine) IntersectionStraightLine ¶ added in v0.3.5
func (l *StraightLine) IntersectionStraightLine(l2 *StraightLine) (Point, bool)
func (*StraightLine) ToGeneralFormLine ¶ added in v0.3.5
func (l *StraightLine) ToGeneralFormLine() *GeneralFormLine
func (*StraightLine) ToSlopeInterceptLine ¶
func (l *StraightLine) ToSlopeInterceptLine() *SlopeInterceptFormLine
type Vector ¶
func (Vector) CrossProduct ¶ added in v0.3.5
Click to show internal directories.
Click to hide internal directories.