Commit c33aa535 authored by Boris Mühmer's avatar Boris Mühmer
Browse files

switched from float64 to float32

parent cbc7870e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -22,11 +22,11 @@ const (

var (
	// Phi is the "golden ratio" ( https://en.wikipedia.org/wiki/Golden_ratio ).
	Phi float64
	Phi float32
)

func init() {
	Phi = 0.5 * (1.0 + math.Sqrt(5.0))
	Phi = float32(0.5 * (1.0 + math.Sqrt(5.0)))
}

// Icosahedron holds the information for an icosahedron in one place.
@@ -113,7 +113,7 @@ func (v Vertex) sub(a Vertex) Vertex {
	return r
}

func (v Vertex) scale(s float64) Vertex {
func (v Vertex) scale(s float32) Vertex {
	var r Vertex
	r.x = v.x * s
	r.y = v.y * s
@@ -121,7 +121,7 @@ func (v Vertex) scale(s float64) Vertex {
	return r
}

func calculateMidPoint(va Vertex, vb Vertex, r float64) (Vertex, error) {
func calculateMidPoint(va Vertex, vb Vertex, r float32) (Vertex, error) {
	vr := va.add(vb.sub(va).scale(r))

	return vr, nil
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ package icosahedron

// Vertex is the tuple (x,y,z).
type Vertex struct {
	x, y, z float64
	x, y, z float32
}

// Vertices of a regular icosahedron.