From 97bf78219fb94f8a6490f7cd0d72de37f6965549 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 8 Jan 2017 23:05:09 +0100 Subject: pen --- patch.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'patch.go') diff --git a/patch.go b/patch.go index e7aca39..0401588 100644 --- a/patch.go +++ b/patch.go @@ -30,26 +30,26 @@ func (p Patch) Z() []float64 { return f } -func rot(deg float64) (float64, float64) { - rad := deg * math.Pi / 180.0 +func rot(deg int) (float64, float64) { + rad := float64(deg) * math.Pi / 180.0 return math.Sin(rad), math.Cos(rad) } -func (v Vertex) RotX(deg float64) Vertex { +func (v Vertex) RotX(deg int) Vertex { sin, cos := rot(deg) v.Y = cos*v.Y - sin*v.Z v.Z = sin*v.Y + cos*v.Z return v } -func (v Vertex) RotY(deg float64) Vertex { +func (v Vertex) RotY(deg int) Vertex { sin, cos := rot(deg) v.X = cos*v.X + sin*v.Z v.Z = -sin*v.X + cos*v.Z return v } -func (v Vertex) RotZ(deg float64) Vertex { +func (v Vertex) RotZ(deg int) Vertex { sin, cos := rot(deg) v.X = cos*v.X - sin*v.Y v.Y = sin*v.X + cos*v.Y @@ -63,9 +63,9 @@ func (v Vertex) Zoom(zoom float64) Vertex { return v } -func (v Vertex) Project(p Plotter) { +func (v Vertex) Project(p Plotter, rx, ry, rz int) { dist := 100000.0 - v = v.Zoom(1000).RotZ(-15).RotX(-60) + v = v.Zoom(1000).RotZ(rz).RotY(ry).RotX(rx) w, h := p.Dim() v.X *= dist / (2*dist - v.Z) -- cgit v1.2.3