Skip to content

Commit a7720eb

Browse files
committed
Update readme
1 parent ebef5e7 commit a7720eb

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ type HexLayout struct {
3434
FromPixel geom.Matrix
3535
}
3636

37-
// FromPoint converts a pixel point to a fractional hex (Q, R)
38-
func (l HexLayout) FromPixel(point geom.Point[float64]) (Q, R float64) {
39-
return point.Subtract(l.Origin).DivideXY(l.Size.XY()).Transform(l.FromPixel).XY()
37+
func (l HexLayout) FromPixel(pixel geom.Point[float64]) (Q, R float64) {
38+
return pixel.Subtract(l.Origin).DivideXY(l.Size.XY()).Transform(l.FromPixel).XY()
4039
}
4140
```
4241

@@ -46,7 +45,7 @@ All types and methods are generic and can be used with any numeric type.
4645

4746
```go
4847
type Number interface {
49-
~int | ~int8 | ~int16 | ~int32 | ~int64 | ~float32 | ~float64
48+
~int | ~int8 | ~int16 | ~int32 | ~int64 | ~float32 | ~float64
5049
}
5150
```
5251

@@ -115,6 +114,7 @@ func (v Vector[T]) Cross(vector Vector[T]) T
115114
func (v Vector[T]) Length() float64
116115
func (v Vector[T]) LengthSquared() T
117116
func (v Vector[T]) Angle() float64
117+
func (v Vector[T]) Lerp(vector Vector[T], t float64) Vector[T]
118118

119119
// Transformations
120120
func (v Vector[T]) Rotate(angle float64) Vector[T]
@@ -135,9 +135,9 @@ func (v Vector[T]) String() string
135135

136136
```go
137137
type Matrix struct {
138-
A, B, C float64 // scale X, shear Y, translate X
139-
D, E, F float64 // shear X, scale Y, translate Y
140-
// [0 0 1] implicit third row
138+
A, B, C float64 // scale X, shear Y, translate X
139+
D, E, F float64 // shear X, scale Y, translate Y
140+
// [0 0 1] implicit third row
141141
}
142142

143143
// Operations
@@ -186,8 +186,8 @@ func (s Size[T]) String() string
186186

187187
```go
188188
type Circle[T Number] struct {
189-
Center Point[T]
190-
Radius T
189+
Center Point[T]
190+
Radius T
191191
}
192192

193193
// Properties
@@ -219,8 +219,8 @@ func (c Circle[T]) String() string
219219

220220
```go
221221
type Rectangle[T Number] struct{
222-
Center Point[T]
223-
Size Size[T]
222+
Center Point[T]
223+
Size Size[T]
224224
}
225225

226226
// Properties
@@ -266,8 +266,8 @@ func (r Rectangle[T]) String() string
266266

267267
```go
268268
type Line[T Number] struct{
269-
Start Point[T]
270-
End Point[T]
269+
Start Point[T]
270+
End Point[T]
271271
}
272272

273273
// Transformations
@@ -291,7 +291,7 @@ func (l Line[T]) String() string
291291

292292
```go
293293
type Polygon[T Number] struct{
294-
Vertices []Point[T]
294+
Vertices []Point[T]
295295
}
296296

297297
// Properties
@@ -311,10 +311,10 @@ func (p Polygon[T]) Empty() bool
311311

312312
```go
313313
type RegularPolygon[T Number] struct {
314-
Center Point[T]
315-
Size Size[T]
316-
N int
317-
Angle float64
314+
Center Point[T]
315+
Size Size[T]
316+
N int
317+
Angle float64
318318
}
319319

320320
// Properties

0 commit comments

Comments
 (0)