geometry

package
v0.0.0-...-c0736c2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcAngleBetweenPoints

func CalcAngleBetweenPoints(x1, y1, x2, y2 float64) float64

ebiten 游戏引擎坐标体系: | ^ y | -3 | | -2 | | -1 | 1 2 3 x ------------+------------> | -3 -2 -1 | 1 | | 2 | | 3

CalcAngleBetweenPoints 计算两个点之间的夹角(+90 转换成顺时针角度, +360 确保非负数)

func CalcDistance

func CalcDistance(x1, y1, x2, y2 float64) float64

CalcDistance 计算两个点之间的距离

func CalcWeaponFireAngle

func CalcWeaponFireAngle(
	curX, curY, bulletSpeed, enemyX, enemyY, enemySpeed, enemyRotation float64,
) (angle float64, targetX float64, targetY float64)

CalcWeaponFireAngle 计算武器发射角度

func IsPointInRotatedRectangle

func IsPointInRotatedRectangle(x, y, cx, cy, length, width, angle float64) bool

示例:length 4, width 1, angle 0

——

| | | | 3 | |

——
1

示例:length 4, width 1, angle 90

——————

| | 1

——————
  3

IsPointInRotatedRect 判断点 (x, y) 是否在由中心点 (cx, cy),旋转角度 angle,长度 length 和宽度 width 的长方形内

Types

This section is empty.

Jump to

Keyboard shortcuts

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