Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: third_party/go/src/golang.org/x/mobile/f32/vec4.go

Issue 1275153002: Remove third_party/golang.org/x/mobile as it is no longer used with Go 1.5. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove golang.org/x/mobile Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package f32
6
7 import "fmt"
8
9 type Vec4 [4]float32
10
11 func (v Vec4) String() string {
12 return fmt.Sprintf("Vec4[% 0.3f, % 0.3f, % 0.3f, % 0.3f]", v[0], v[1], v [2], v[3])
13 }
14
15 func (v *Vec4) Normalize() {
16 sq := v.Dot(v)
17 inv := 1 / Sqrt(sq)
18 v[0] *= inv
19 v[1] *= inv
20 v[2] *= inv
21 v[3] *= inv
22 }
23
24 func (v *Vec4) Sub(v0, v1 *Vec4) {
25 v[0] = v0[0] - v1[0]
26 v[1] = v0[1] - v1[1]
27 v[2] = v0[2] - v1[2]
28 v[3] = v0[3] - v1[3]
29 }
30
31 func (v *Vec4) Add(v0, v1 *Vec4) {
32 v[0] = v0[0] + v1[0]
33 v[1] = v0[1] + v1[1]
34 v[2] = v0[2] + v1[2]
35 v[3] = v0[3] + v1[3]
36 }
37
38 func (v *Vec4) Mul(v0, v1 *Vec4) {
39 v[0] = v0[0] * v1[0]
40 v[1] = v0[1] * v1[1]
41 v[2] = v0[2] * v1[2]
42 v[3] = v0[3] * v1[3]
43 }
44
45 func (v *Vec4) Dot(v1 *Vec4) float32 {
46 return v[0]*v1[0] + v[1]*v1[1] + v[2]*v1[2] + v[3]*v1[3]
47 }
OLDNEW
« no previous file with comments | « third_party/go/src/golang.org/x/mobile/f32/vec3.go ('k') | third_party/go/src/golang.org/x/mobile/font/doc.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698