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

Side by Side Diff: tools/cc-frame-viewer/src/base/gl_matrix.js

Issue 15736032: Remove old cc-frame-viewer now that it is upstreamed into trace_viewer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5 'use strict';
6
7 base.requireRawScript('../third_party/gl-matrix/src/gl-matrix/common.js');
8 base.requireRawScript('../third_party/gl-matrix/src/gl-matrix/mat2d.js');
9 base.requireRawScript('../third_party/gl-matrix/src/gl-matrix/vec2.js');
10
11 base.exportTo('base', function() {
12 var tmp_vec2 = vec2.create();
13 var tmp_mat2d = mat2d.create();
14
15 vec2.createXY = function(x, y) {
16 var v = vec2.create();
17 vec2.set(v, x, y);
18 return v;
19 };
20
21 vec2.asPoint = function(v) {
22 return {x: v[0],
23 y: v[1]};
24 }
25
26 mat2d.translateInplace = function(inout, v) {
27 mat2d.translate(tmp_mat2d, inout, v);
28 mat2d.copy(inout, tmp_mat2d);
29 }
30
31 mat2d.translateInplaceXY = function(inout, x, y) {
32 vec2.set(tmp_vec2, x, y);
33 mat2d.translateInplace(inout, tmp_vec2);
34 }
35
36 mat2d.scaleInplace = function(inout, v) {
37 mat2d.scale(tmp_mat2d, inout, v);
38 mat2d.copy(inout, tmp_mat2d);
39 }
40
41 mat2d.scaleInplaceXY = function(inout, x, y) {
42 vec2.set(tmp_vec2, x, y);
43 mat2d.scaleInplace(inout, tmp_vec2);
44 }
45
46 mat2d.rotateInplace = function(inout, rad) {
47 mat2d.rotate(tmp_mat2d, inout, rad);
48 mat2d.copy(inout, tmp_mat2d);
49 }
50
51 function signPt(p1, p2, p3)
52 {
53 return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y);
54 }
55
56 function pointInTriangle2Pt(pt, p1, p2, p3)
57 {
58 var b1 = signPt(pt, p1, p2) < 0.0;
59 var b2 = signPt(pt, p2, p3) < 0.0;
60 var b3 = signPt(pt, p3, p1) < 0.0;
61 return ((b1 == b2) && (b2 == b3));
62 }
63
64 function pointInQuad2Pt(pt, q)
65 {
66 return pointInTriangle2Pt(pt, q.p1, q.p2, q.p3) ||
67 pointInTriangle2Pt(pt, q.p1, q.p3, q.p4);
68 }
69
70 return {
71 pointInTriangle2Pt: pointInTriangle2Pt,
72 pointInQuad2Pt: pointInQuad2Pt
73 }
74 });
OLDNEW
« no previous file with comments | « tools/cc-frame-viewer/src/base/deps.js ('k') | tools/cc-frame-viewer/src/base/gl_matrix_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698