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

Side by Side Diff: third_party/go/src/golang.org/x/mobile/f32/vec3.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 Vec3 [3]float32
10
11 func (v Vec3) String() string {
12 return fmt.Sprintf("Vec3[% 0.3f, % 0.3f, % 0.3f]", v[0], v[1], v[2])
13 }
14
15 func (v *Vec3) Normalize() {
16 sq := v.Dot(v)
17 inv := 1 / Sqrt(sq)
18 v[0] *= inv
19 v[1] *= inv
20 v[2] *= inv
21 }
22
23 func (v *Vec3) Sub(v0, v1 *Vec3) {
24 v[0] = v0[0] - v1[0]
25 v[1] = v0[1] - v1[1]
26 v[2] = v0[2] - v1[2]
27 }
28
29 func (v *Vec3) Add(v0, v1 *Vec3) {
30 v[0] = v0[0] + v1[0]
31 v[1] = v0[1] + v1[1]
32 v[2] = v0[2] + v1[2]
33 }
34
35 func (v *Vec3) Mul(v0, v1 *Vec3) {
36 v[0] = v0[0] * v1[0]
37 v[1] = v0[1] * v1[1]
38 v[2] = v0[2] * v1[2]
39 }
40
41 func (v *Vec3) Cross(v0, v1 *Vec3) {
42 v[0] = v0[1]*v1[2] - v0[2]*v1[1]
43 v[1] = v0[2]*v1[0] - v0[0]*v1[2]
44 v[2] = v0[0]*v1[1] - v0[1]*v1[0]
45 }
46
47 func (v *Vec3) Dot(v1 *Vec3) float32 {
48 return v[0]*v1[0] + v[1]*v1[1] + v[2]*v1[2]
49 }
OLDNEW
« no previous file with comments | « third_party/go/src/golang.org/x/mobile/f32/table.go ('k') | third_party/go/src/golang.org/x/mobile/f32/vec4.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698