-
Notifications
You must be signed in to change notification settings - Fork 284
/
Ray.ts
41 lines (35 loc) · 971 Bytes
/
Ray.ts
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
///<amd-module name="world/Ray"/>
import Vertice = require('./Vertice');
import Vector = require('./Vector');
class Ray{
public vertice: Vertice;
public vector: Vector;
/**
* 射线
* @param position 射线起点 World.Vertice类型
* @param direction 射线方向 World.Vector类型
* @constructor
*/
constructor(position: Vertice, direction: Vector){
this.vertice = position.clone();
this.vector = direction.clone();
this.vector.normalize();
}
setVertice(position: Vertice): Ray {
this.vertice = position.clone();
return this;
}
setVector(direction: Vector): Ray {
this.vector = direction.clone();
this.vector.normalize();
return this;
}
clone(): Ray {
var rayCopy = new Ray(this.vertice, this.vector);
return rayCopy;
}
rotateVertice(vertice: Vertice): Vertice {
return null;
}
}
export = Ray;