23 lines
325 B
Go
23 lines
325 B
Go
package clockface
|
|
|
|
import (
|
|
"math"
|
|
"time"
|
|
)
|
|
|
|
type Point struct {
|
|
X float64
|
|
Y float64
|
|
}
|
|
|
|
func secondsInRadians(t time.Time) float64 {
|
|
return math.Pi / (30 / (float64(t.Second())))
|
|
}
|
|
|
|
func secondHandPoint(t time.Time) Point {
|
|
angle := secondsInRadians(t)
|
|
x := math.Sin(angle)
|
|
y := math.Cos(angle)
|
|
return Point{x, y}
|
|
}
|