Mercurial > gemma
comparison pkg/octree/vertex.go @ 3770:71164b817d6e simplify-sounding-results
Calculate distance from planes.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 25 Jun 2019 21:04:16 +0200 |
parents | a6c671abbc35 |
children | 4233570de212 |
comparison
equal
deleted
inserted
replaced
3769:6838526df94c | 3770:71164b817d6e |
---|---|
106 } | 106 } |
107 | 107 |
108 func (p Plane3D) Z(x, y float64) float64 { | 108 func (p Plane3D) Z(x, y float64) float64 { |
109 // p.A*x + p.B*y + p.C*z + p.D = 0 | 109 // p.A*x + p.B*y + p.C*z + p.D = 0 |
110 return -(p.A*x + p.B*y + p.D) / p.C | 110 return -(p.A*x + p.B*y + p.D) / p.C |
111 } | |
112 | |
113 func (p Plane3D) Eval(v Vertex) float64 { | |
114 return p.A*v.X + p.B*v.Y + p.C*v.Z + p.D | |
111 } | 115 } |
112 | 116 |
113 func (v Vertex) Normalize() Vertex { | 117 func (v Vertex) Normalize() Vertex { |
114 s := 1 / v.Length() | 118 s := 1 / v.Length() |
115 return Vertex{ | 119 return Vertex{ |