LTBezier.LTBezier C# (CSharp) Method

LTBezier() public method

public LTBezier ( Vector3 a, Vector3 b, Vector3 c, Vector3 d, float precision ) : UnityEngine
a Vector3
b Vector3
c Vector3
d Vector3
precision float
return UnityEngine
	public LTBezier(Vector3 a, Vector3 b, Vector3 c, Vector3 d, float precision){
		this.a = a;
		aa = (-a + 3*(b-c) + d);
		bb = 3*(a+c) - 6*b;
		cc = 3*(b-a);

		this.len = 1.0f / precision;
		arcLengths = new float[(int)this.len + (int)1];
		arcLengths[0] = 0;

		Vector3 ov = a;
		Vector3 v;
		float clen = 0.0f;
		for(int i = 1; i <= this.len; i++) {
			v = bezierPoint(i * precision);
			clen += (ov - v).magnitude;
			this.arcLengths[i] = clen;
			ov = v;
		}
		this.length = clen;
	}