getTangent method
dynamic
getTangent(
- dynamic t, [
- dynamic optionalTarget
Implementation
getTangent(t, [optionalTarget]) {
var delta = 0.0001;
num t1 = t - delta;
num t2 = t + delta;
// Capping in case of danger
if (t1 < 0) t1 = 0;
if (t2 > 1) t2 = 1;
var pt1 = getPoint(t1, null);
var pt2 = getPoint(t2, null);
var tangent = optionalTarget ??
((pt1.runtimeType == Vector2)
? Vector2(null, null)
: Vector3());
tangent.copy(pt2).sub(pt1).normalize();
return tangent;
}