-
Notifications
You must be signed in to change notification settings - Fork 14
/
IKRS.VectorFactory.js
75 lines (56 loc) · 1.65 KB
/
IKRS.VectorFactory.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
* @author Ikaros Kappler
* @date 2013-10-29
* @version 1.0.0
**/
IKRS.VectorFactory = function( p_signX, p_signY, p_signZ ) {
IKRS.Object.call( this );
if( typeof p_signX == "undefined" )
signX = 1;
if( typeof p_signY == "undefined" )
signY = 1;
if( typeof p_signZ == "undefined" )
signZ = 1;
this.signX = p_signX;
this.signY = p_signY;
this.signZ = p_signZ;
};
IKRS.VectorFactory.prototype = new IKRS.Object();
IKRS.VectorFactory.prototype.constructor = IKRS.VectorFactory;
/*
IKRS.VectorFactory.prototype.getSignX = function() {
return this.signX;
};
IKRS.VectorFactory.prototype.getSignY = function() {
return this.signY;
};
IKRS.VectorFactory.prototype.getSignZ = function() {
return this.signZ;
};
*/
IKRS.VectorFactory.prototype.createVector2 = function( x, y ) {
return new THREE.Vector2( this.signX * x, this.signY * y );
};
IKRS.VectorFactory.prototype.createVector3 = function( x, y, z ) {
return new THREE.Vector3( this.signX * x, this.signY * y, this.signZ * z );
};
/*
IKRS.VectorFactory.prototype.toString = function() {
var tmp = this.createVector3( 1, 2, 3 );
var result = "[IKRS.VectorFactory] mapping=(";
var rX = "", rY = "", rZ = "";
tmp.x = Math.abs(tmp.x);
tmp.y = Math.abs(tmp.y);
tmp.z = Math.abs(tmp.z);
if( tmp.x == 1 ) rX = "x";
else if( tmp.x == 2 ) rX = "y";
else if( tmp.x == 3 ) rX = "z";
if( tmp.y == 1 ) rY = "x";
else if( tmp.y == 2 ) rY = "y";
else if( tmp.y == 3 ) rY = "z";
if( tmp.z == 1 ) rZ = "x";
else if( tmp.z == 2 ) rZ = "y";
else if( tmp.z == 3 ) rZ = "z";
if( this.signX
}
*/