geometry

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AngleBetweenPoints added in v0.3.0

func AngleBetweenPoints(v1, v2 Point) float64

计算同坐标两个向量之间的角度

func AngleBetweenVectors added in v0.3.0

func AngleBetweenVectors(pA, pB, qA, qB Point) float64

已知两点在两平面坐标系中的坐标,求坐标系夹角,A旋转到B的度数,逆时针>0 AngleBetweenVectors

func IsPointInRectangle added in v0.1.9

func IsPointInRectangle(p Point, rCenter Point, w, h, angleDeg float64) bool

图片就是第四象限,角度90+θ

func NormalizeAngleDegrees added in v0.1.9

func NormalizeAngleDegrees(theta float64) float64

func RectangleCorners added in v0.1.12

func RectangleCorners(rCenter Point, w, h, angleDeg float64) [][]float64

func VectorAngle added in v0.3.0

func VectorAngle(p1, p2 Point) float64

VectorAngle 计算向量与 x 轴之间的角度(以度为单位)

func VectorLength added in v0.3.0

func VectorLength(p1, p2 Point) float64

VectorLength 计算两点之间的向量长度

Types

type AffineMatrix added in v0.3.0

type AffineMatrix [2][3]float64

定义一个2x3的仿射变换矩阵

func (AffineMatrix) Apply added in v0.3.0

func (m AffineMatrix) Apply(p Point) Point

应用仿射变换到点上

type Point

type Point struct {
	X float64
	Y float64
}

Point 结构体用于表示一个点

func RandomPoint added in v0.1.9

func RandomPoint(min, max Point) Point

func RotatePoint added in v0.1.9

func RotatePoint(p Point, center Point, angleDeg float64) Point

RotatePoint 计算点 (x, y) 绕点 (centerX, centerY) 旋转 angle 度后的新坐标

func TranslateRotationTransformByPointAndAngle added in v0.3.0

func TranslateRotationTransformByPointAndAngle(pA, qA, qB Point, angleDeg float64) (pB Point)

TranslateRotationTransformByPointAndAngle transforms a point from coordinate system a2 to a1 在数学和计算机图形学中,旋转角度的正负通常遵循右手定则。默认情况下,顺时针方向被认为是负的,而逆时针方向被认为是正的。 O2相对于O1旋转度数

func (*Point) Rotate added in v0.1.9

func (p *Point) Rotate(angleDeg float64)

type Point3D added in v0.3.0

type Point3D struct {
	X float64
	Y float64
	Z float64
}

type Rectangle

type Rectangle struct {
	DiagonalVertice1, DiagonalVertice2 Point
}

type Triangle added in v0.1.6

type Triangle struct {
	A, B, C Point
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL