mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 15:06:46 +08:00
1 parent
28175723e6
commit
32585c6343
46 files changed
+84
-168
No files matched your search
@@ -96,7 +96,7 @@ func (p GeometryPath) Bounds() (Box, error) {
|
||||
}
|
||||
|
||||
// geometryRoots 稳定求解一元二次方程的实根
|
||||
// 入参: a、b、c 方程系数
|
||||
// 入参: a 二次项系数, b 一次项系数, c 常数项
|
||||
// 返回: []float64 实根
|
||||
func geometryRoots(a, b, c float64) []float64 {
|
||||
scale := math.Max(math.Abs(a), math.Max(math.Abs(b), math.Abs(c)))
|
||||
@@ -122,7 +122,7 @@ func geometryRoots(a, b, c float64) []float64 {
|
||||
}
|
||||
|
||||
// geometryLerp 线性插值坐标
|
||||
// 入参: a、b 端点, t 插值比例
|
||||
// 入参: a 起点, b 终点, t 插值比例
|
||||
// 返回: Point 插值坐标
|
||||
func geometryLerp(a, b Point, t float64) Point {
|
||||
return Point{(1-t)*a.X + t*b.X, (1-t)*a.Y + t*b.Y}
|
||||
|
||||
Reference in new issue
Block a user