| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 <link rel="import" href="/tracing/base/base.html"> | 7 <link rel="import" href="/tracing/base/base.html"> |
| 8 <link rel="import" href="/tracing/base/math.html"> | 8 <link rel="import" href="/tracing/base/math/math.html"> |
| 9 <script> | 9 <script> |
| 10 'use strict'; | 10 'use strict'; |
| 11 | 11 |
| 12 tr.exportTo('tr.b', function() { | 12 tr.exportTo('tr.b.math', function() { |
| 13 var tmpVec2s = []; | 13 var tmpVec2s = []; |
| 14 for (var i = 0; i < 8; i++) | 14 for (var i = 0; i < 8; i++) |
| 15 tmpVec2s[i] = vec2.create(); | 15 tmpVec2s[i] = vec2.create(); |
| 16 | 16 |
| 17 var tmpVec2a = vec4.create(); | 17 var tmpVec2a = vec4.create(); |
| 18 var tmpVec4a = vec4.create(); | 18 var tmpVec4a = vec4.create(); |
| 19 var tmpVec4b = vec4.create(); | 19 var tmpVec4b = vec4.create(); |
| 20 var tmpMat4 = mat4.create(); | 20 var tmpMat4 = mat4.create(); |
| 21 var tmpMat4b = mat4.create(); | 21 var tmpMat4b = mat4.create(); |
| 22 | 22 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 this.p1, this.p2, this.p3, this.p4); | 90 this.p1, this.p2, this.p3, this.p4); |
| 91 }, | 91 }, |
| 92 | 92 |
| 93 boundingRect: function() { | 93 boundingRect: function() { |
| 94 var x0 = Math.min(this.p1[0], this.p2[0], this.p3[0], this.p4[0]); | 94 var x0 = Math.min(this.p1[0], this.p2[0], this.p3[0], this.p4[0]); |
| 95 var y0 = Math.min(this.p1[1], this.p2[1], this.p3[1], this.p4[1]); | 95 var y0 = Math.min(this.p1[1], this.p2[1], this.p3[1], this.p4[1]); |
| 96 | 96 |
| 97 var x1 = Math.max(this.p1[0], this.p2[0], this.p3[0], this.p4[0]); | 97 var x1 = Math.max(this.p1[0], this.p2[0], this.p3[0], this.p4[0]); |
| 98 var y1 = Math.max(this.p1[1], this.p2[1], this.p3[1], this.p4[1]); | 98 var y1 = Math.max(this.p1[1], this.p2[1], this.p3[1], this.p4[1]); |
| 99 | 99 |
| 100 return new tr.b.Rect.fromXYWH(x0, y0, x1 - x0, y1 - y0); | 100 return new tr.b.math.Rect.fromXYWH(x0, y0, x1 - x0, y1 - y0); |
| 101 }, | 101 }, |
| 102 | 102 |
| 103 clone: function() { | 103 clone: function() { |
| 104 var q = new Quad(); | 104 var q = new Quad(); |
| 105 vec2.copy(q.p1, this.p1); | 105 vec2.copy(q.p1, this.p1); |
| 106 vec2.copy(q.p2, this.p2); | 106 vec2.copy(q.p2, this.p2); |
| 107 vec2.copy(q.p3, this.p3); | 107 vec2.copy(q.p3, this.p3); |
| 108 vec2.copy(q.p4, this.p4); | 108 vec2.copy(q.p4, this.p4); |
| 109 return q; | 109 return q; |
| 110 }, | 110 }, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 pointInTriangle2(point, p1, p3, p4); | 226 pointInTriangle2(point, p1, p3, p4); |
| 227 } | 227 } |
| 228 | 228 |
| 229 return { | 229 return { |
| 230 pointInTriangle2, | 230 pointInTriangle2, |
| 231 pointInImplicitQuad, | 231 pointInImplicitQuad, |
| 232 Quad, | 232 Quad, |
| 233 }; | 233 }; |
| 234 }); | 234 }); |
| 235 </script> | 235 </script> |
| OLD | NEW |