CubicBezierCurve3.js 725 字节
Newer Older
R
Rich Harris 已提交
1 2 3 4 5 6
import { Vector3 } from '../../math/Vector3';
import { ShapeUtils } from '../ShapeUtils';
import { Curve } from '../core/Curve';

var CubicBezierCurve3;

7 8 9 10
/**************************************************************
 *	Cubic Bezier 3D curve
 **************************************************************/

R
Rich Harris 已提交
11
CubicBezierCurve3 = Curve.create(
12 13 14 15 16 17 18 19 20 21 22 23

	function ( v0, v1, v2, v3 ) {

		this.v0 = v0;
		this.v1 = v1;
		this.v2 = v2;
		this.v3 = v3;

	},

	function ( t ) {

R
Rich Harris 已提交
24
		var b3 = ShapeUtils.b3;
25

R
Rich Harris 已提交
26
		return new Vector3(
M
Mr.doob 已提交
27 28 29 30
			b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ),
			b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ),
			b3( t, this.v0.z, this.v1.z, this.v2.z, this.v3.z )
		);
31 32 33

	}

34
);
R
Rich Harris 已提交
35 36 37


export { CubicBezierCurve3 };