CubicBezierCurve3.js 712 字节
Newer Older
R
Rich Harris 已提交
1
import { Curve } from '../core/Curve';
M
Mr.doob 已提交
2
import { CubicBezier } from '../core/Interpolations';
3
import { Vector3 } from '../../math/Vector3';
R
Rich Harris 已提交
4

5

6
function CubicBezierCurve3( v0, v1, v2, v3 ) {
7

M
Mugen87 已提交
8 9
	Curve.call( this );

10 11 12 13
	this.v0 = v0;
	this.v1 = v1;
	this.v2 = v2;
	this.v3 = v3;
14

15
}
16

17 18
CubicBezierCurve3.prototype = Object.create( Curve.prototype );
CubicBezierCurve3.prototype.constructor = CubicBezierCurve3;
19

20
CubicBezierCurve3.prototype.getPoint = function ( t ) {
21

22
	var v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;
M
Mr.doob 已提交
23

24 25 26 27 28
	return new Vector3(
		CubicBezier( t, v0.x, v1.x, v2.x, v3.x ),
		CubicBezier( t, v0.y, v1.y, v2.y, v3.y ),
		CubicBezier( t, v0.z, v1.z, v2.z, v3.z )
	);
29

30
};
R
Rich Harris 已提交
31 32


M
Mr.doob 已提交
33
export { CubicBezierCurve3 };