2013-06-17 11:54:42 -04:00
|
|
|
/*
|
|
|
|
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
|
|
* http://paperjs.org/
|
|
|
|
*
|
2020-05-23 16:24:42 -04:00
|
|
|
* Copyright (c) 2011 - 2020, Jürg Lehni & Jonathan Puckey
|
|
|
|
* http://juerglehni.com/ & https://puckey.studio/
|
2013-06-17 11:54:42 -04:00
|
|
|
*
|
|
|
|
* Distributed under the MIT license. See LICENSE file for details.
|
|
|
|
*
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2016-01-27 13:57:07 -05:00
|
|
|
QUnit.module('Curve');
|
2013-06-17 11:54:42 -04:00
|
|
|
|
2017-01-11 09:01:10 -05:00
|
|
|
function testClassify(curve, expeced, message) {
|
|
|
|
var info = curve.classify();
|
|
|
|
if (expeced.type) {
|
|
|
|
equals(info.type, expeced.type,
|
|
|
|
'info.type == \'' + expeced.type + '\'');
|
|
|
|
}
|
|
|
|
if (expeced.roots !== undefined) {
|
|
|
|
equals(info.roots, expeced.roots,
|
|
|
|
'info.roots == ' + (expeced.roots ? '[' + expeced.roots + ']'
|
|
|
|
: expeced.roots));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test('Curve#classify()', function() {
|
|
|
|
var point = new Curve([100, 100], null, null, [100, 100]);
|
|
|
|
var line = new Curve([100, 100], null, null, [200, 200]);
|
|
|
|
var cusp = new Curve([100, 200], [100, -100], [-100, -100], [200, 200]);
|
|
|
|
var loop = new Curve([100, 200], [150, -100], [-150, -100], [200, 200]);
|
|
|
|
var single = new Curve([100, 100], [50, 0], [-27, -46], [200, 200]);
|
|
|
|
var double = new Curve([100, 200], [100, -100], [-40, -80], [200, 200]);
|
|
|
|
var arch = new Curve([100, 100], [50, 0], [0, -50], [200, 200]);
|
|
|
|
testClassify(point, { type: 'line', roots: null });
|
|
|
|
testClassify(line, { type: 'line', roots: null });
|
|
|
|
testClassify(cusp, { type: 'cusp', roots: [ 0.5 ] });
|
|
|
|
testClassify(loop, { type: 'loop', roots: [ 0.17267316464601132, 0.8273268353539888 ] });
|
|
|
|
testClassify(single, { type: 'serpentine', roots: [ 0.870967741935484 ] });
|
|
|
|
testClassify(double, { type: 'serpentine', roots: [ 0.15047207654837885, 0.7384168123405099 ] });
|
|
|
|
testClassify(arch, { type: 'arch', roots: null });
|
|
|
|
});
|
|
|
|
|
2016-02-02 05:59:53 -05:00
|
|
|
test('Curve#getPointAtTime()', function() {
|
2014-08-16 13:24:54 -04:00
|
|
|
var curve = new Path.Circle({
|
|
|
|
center: [100, 100],
|
|
|
|
radius: 100
|
2014-09-28 05:44:38 -04:00
|
|
|
}).firstCurve;
|
2014-08-16 13:24:54 -04:00
|
|
|
|
|
|
|
var points = [
|
|
|
|
[0, new Point(0, 100)],
|
|
|
|
[0.25, new Point(7.8585, 61.07549)],
|
|
|
|
[0.5, new Point(29.28932, 29.28932)],
|
|
|
|
[0.75, new Point(61.07549, 7.8585)],
|
|
|
|
[1, new Point(100, 0)]
|
|
|
|
];
|
|
|
|
|
|
|
|
for (var i = 0; i < points.length; i++) {
|
|
|
|
var entry = points[i];
|
2016-02-02 05:59:53 -05:00
|
|
|
equals(curve.getPointAtTime(entry[0]), entry[1],
|
|
|
|
'curve.getPointAtTime(' + entry[0] + ');');
|
|
|
|
// Legacy version:
|
2014-12-28 08:59:48 -05:00
|
|
|
equals(curve.getPointAt(entry[0], true), entry[1],
|
2016-02-02 05:59:53 -05:00
|
|
|
'Legacy: curve.getPointAt(' + entry[0] + ', true);');
|
2014-08-16 13:24:54 -04:00
|
|
|
}
|
2015-04-04 11:05:39 -04:00
|
|
|
|
|
|
|
equals(curve.getPointAt(curve.length + 1), null,
|
|
|
|
'Should return null when offset is out of range.');
|
2016-02-12 14:19:40 -05:00
|
|
|
|
|
|
|
// #960:
|
|
|
|
var curve = new Curve({
|
|
|
|
segment1: [178.58559999999994, 333.41440000000006],
|
|
|
|
segment2: [178.58559999999994, 178.58560000000008]
|
|
|
|
});
|
|
|
|
equals(curve.getPointAtTime(0).y, curve.point1.y,
|
|
|
|
'Point at t=0 should not deviate from the actual coordinates.');
|
|
|
|
equals(curve.getPointAtTime(1).y, curve.point2.y,
|
|
|
|
'Point at t=1 should not deviate from the actual coordinates.');
|
2013-06-17 11:54:42 -04:00
|
|
|
});
|
2013-06-18 21:23:48 -04:00
|
|
|
|
2016-02-02 05:59:53 -05:00
|
|
|
test('Curve#getTangentAtTime()', function() {
|
2014-08-16 13:24:54 -04:00
|
|
|
var curve = new Path.Circle({
|
|
|
|
center: [100, 100],
|
|
|
|
radius: 100
|
2014-09-28 05:44:38 -04:00
|
|
|
}).firstCurve;
|
2014-08-16 13:24:54 -04:00
|
|
|
|
|
|
|
var tangents = [
|
|
|
|
[0, new Point(0, -165.68542 )],
|
|
|
|
[0.25, new Point(60.7233, -143.56602)],
|
|
|
|
[0.5, new Point(108.57864, -108.57864)],
|
|
|
|
[0.75, new Point(143.56602, -60.7233)],
|
|
|
|
[1, new Point(165.68542, 0)]
|
|
|
|
];
|
|
|
|
|
|
|
|
for (var i = 0; i < tangents.length; i++) {
|
|
|
|
var entry = tangents[i];
|
2016-02-02 05:59:53 -05:00
|
|
|
equals(curve.getTangentAtTime(entry[0]), entry[1].normalize(),
|
|
|
|
'curve.getTangentAtTime(' + entry[0] + ');');
|
|
|
|
equals(curve.getWeightedTangentAtTime(entry[0]), entry[1],
|
|
|
|
'curve.getWeightedTangentAtTime(' + entry[0] + ');');
|
|
|
|
// Legacy version:
|
2015-08-19 11:15:41 -04:00
|
|
|
equals(curve.getTangentAt(entry[0], true), entry[1].normalize(),
|
2016-02-02 05:59:53 -05:00
|
|
|
'Legacy: curve.getTangentAt(' + entry[0] + ', true);');
|
2015-08-19 11:15:41 -04:00
|
|
|
equals(curve.getWeightedTangentAt(entry[0], true), entry[1],
|
2016-02-02 05:59:53 -05:00
|
|
|
'Legacy: curve.getWeightedTangentAt(' + entry[0] + ', true);');
|
2014-08-16 13:24:54 -04:00
|
|
|
}
|
2013-06-18 21:23:48 -04:00
|
|
|
});
|
|
|
|
|
2016-02-02 05:59:53 -05:00
|
|
|
test('Curve#getNormalAtTime()', function() {
|
2014-08-16 13:24:54 -04:00
|
|
|
var curve = new Path.Circle({
|
|
|
|
center: [100, 100],
|
|
|
|
radius: 100
|
2014-09-28 05:44:38 -04:00
|
|
|
}).firstCurve;
|
2014-08-16 13:24:54 -04:00
|
|
|
|
|
|
|
var normals = [
|
|
|
|
[0, new Point(-165.68542, 0)],
|
|
|
|
[0.25, new Point(-143.56602, -60.7233)],
|
|
|
|
[0.5, new Point(-108.57864, -108.57864)],
|
|
|
|
[0.75, new Point(-60.7233, -143.56602)],
|
|
|
|
[1, new Point(0, -165.68542)]
|
|
|
|
];
|
|
|
|
|
|
|
|
for (var i = 0; i < normals.length; i++) {
|
|
|
|
var entry = normals[i];
|
2016-02-02 05:59:53 -05:00
|
|
|
equals(curve.getNormalAtTime(entry[0]), entry[1].normalize(),
|
|
|
|
'curve.getNormalAtTime(' + entry[0] + ');');
|
|
|
|
equals(curve.getWeightedNormalAtTime(entry[0]), entry[1],
|
|
|
|
'curve.getWeightedNormalAtTime(' + entry[0] + ');');
|
|
|
|
// Legacy version:
|
2015-08-19 11:15:41 -04:00
|
|
|
equals(curve.getNormalAt(entry[0], true), entry[1].normalize(),
|
2016-02-02 05:59:53 -05:00
|
|
|
'Legacy: curve.getNormalAt(' + entry[0] + ', true);');
|
2015-08-19 11:15:41 -04:00
|
|
|
equals(curve.getWeightedNormalAt(entry[0], true), entry[1],
|
2016-02-02 05:59:53 -05:00
|
|
|
'Legacy: curve.getWeightedNormalAt(' + entry[0] + ', true);');
|
2014-08-16 13:24:54 -04:00
|
|
|
}
|
2013-06-18 21:29:32 -04:00
|
|
|
});
|
|
|
|
|
2016-02-02 05:59:53 -05:00
|
|
|
test('Curve#getCurvatureAtTime()', function() {
|
2014-08-16 13:24:54 -04:00
|
|
|
var curve = new Path.Circle({
|
|
|
|
center: [100, 100],
|
|
|
|
radius: 100
|
2014-09-28 05:44:38 -04:00
|
|
|
}).firstCurve;
|
2014-08-16 13:24:54 -04:00
|
|
|
|
|
|
|
var curvatures = [
|
|
|
|
[0, 0.009785533905932729],
|
|
|
|
[0.25, 0.010062133221584524],
|
|
|
|
[0.5, 0.009937576453041297],
|
|
|
|
[0.75, 0.010062133221584524],
|
|
|
|
[1, 0.009785533905932727]
|
|
|
|
];
|
|
|
|
|
|
|
|
for (var i = 0; i < curvatures.length; i++) {
|
|
|
|
var entry = curvatures[i];
|
2016-02-02 05:59:53 -05:00
|
|
|
equals(curve.getCurvatureAtTime(entry[0]), entry[1],
|
|
|
|
'curve.getCurvatureAtTime(' + entry[0] + ');');
|
|
|
|
// Legacy version:
|
2014-11-30 14:27:14 -05:00
|
|
|
equals(curve.getCurvatureAt(entry[0], true), entry[1],
|
2016-02-02 05:59:53 -05:00
|
|
|
'Legacy: curve.getCurvatureAt(' + entry[0] + ', true);');
|
2014-08-16 13:24:54 -04:00
|
|
|
}
|
2013-06-18 21:23:48 -04:00
|
|
|
});
|
2013-06-18 22:00:05 -04:00
|
|
|
|
2016-02-02 05:59:53 -05:00
|
|
|
test('Curve#getCurvatureAtTime()', function() {
|
2014-08-16 13:24:54 -04:00
|
|
|
var curve = new Path.Line({
|
|
|
|
from: [100, 100],
|
|
|
|
to: [200, 200],
|
2014-09-28 05:44:38 -04:00
|
|
|
}).firstCurve;
|
2014-08-16 13:24:54 -04:00
|
|
|
|
|
|
|
var curvatures = [
|
|
|
|
[0, 0],
|
|
|
|
[0.25, 0],
|
|
|
|
[0.5, 0],
|
|
|
|
[0.75, 0],
|
|
|
|
[1, 0]
|
|
|
|
];
|
|
|
|
|
|
|
|
for (var i = 0; i < curvatures.length; i++) {
|
|
|
|
var entry = curvatures[i];
|
2016-02-02 05:59:53 -05:00
|
|
|
equals(curve.getCurvatureAtTime(entry[0]), entry[1],
|
|
|
|
'curve.getCurvatureAtTime(' + entry[0] + ');');
|
|
|
|
// Legacy version:
|
2014-11-30 14:27:14 -05:00
|
|
|
equals(curve.getCurvatureAt(entry[0], true), entry[1],
|
2016-02-02 05:59:53 -05:00
|
|
|
'Legacy: curve.getCurvatureAt(' + entry[0] + ', true);');
|
2014-08-16 13:24:54 -04:00
|
|
|
}
|
2013-06-18 22:00:05 -04:00
|
|
|
});
|
2014-09-28 05:44:38 -04:00
|
|
|
|
2016-02-02 05:59:53 -05:00
|
|
|
test('Curve#getTimeAt()', function() {
|
2014-09-28 05:44:38 -04:00
|
|
|
var curve = new Path([
|
|
|
|
[[0, 0], [0, 0], [100, 0]],
|
|
|
|
[[200, 200]],
|
|
|
|
]).firstCurve;
|
|
|
|
|
|
|
|
for (var f = 0; f <= 1; f += 0.1) {
|
2016-06-12 12:32:05 -04:00
|
|
|
var o1 = curve.length * f,
|
|
|
|
o2 = -curve.length * (1 - f),
|
|
|
|
t1 = curve.getTimeAt(o1),
|
|
|
|
t2 = curve.getTimeAt(o2);
|
2016-02-02 05:59:53 -05:00
|
|
|
var message = 'Curve-time parameter at offset ' + o1
|
2016-06-12 12:21:37 -04:00
|
|
|
+ ' should be the same value as at offset ' + o2;
|
2016-06-12 12:32:05 -04:00
|
|
|
equals(t1, t2, message, Numerical.CURVETIME_EPSILON);
|
|
|
|
equals(function() { return curve.getOffsetAtTime(t1); }, o1);
|
|
|
|
equals(function() { return curve.getOffsetAtTime(t2); }, curve.length + o2);
|
2016-02-02 05:59:53 -05:00
|
|
|
// Legacy version:
|
|
|
|
equals(curve.getParameterAt(o1), curve.getParameterAt(o2),
|
|
|
|
'Legacy: ' + message, Numerical.CURVETIME_EPSILON);
|
2016-06-12 12:32:05 -04:00
|
|
|
// Test other methods with negatives offsets
|
2016-06-12 12:21:37 -04:00
|
|
|
equals(curve.getTangentAt(o1), curve.getTangentAt(o2),
|
|
|
|
'Tangent at offset ' + o1
|
2016-06-12 12:32:05 -04:00
|
|
|
+ ' should be the same value as at offset ' + o2);
|
2014-09-28 05:44:38 -04:00
|
|
|
}
|
2015-04-04 11:05:39 -04:00
|
|
|
|
2016-02-02 05:59:53 -05:00
|
|
|
equals(curve.getTimeAt(curve.length + 1), null,
|
2015-04-04 11:05:39 -04:00
|
|
|
'Should return null when offset is out of range.');
|
|
|
|
});
|
|
|
|
|
2016-07-25 15:42:06 -04:00
|
|
|
test('Curve#getTimeAt() with straight curve', function() {
|
|
|
|
var path = new Path();
|
|
|
|
path.moveTo(100, 100);
|
|
|
|
path.lineTo(500, 500);
|
|
|
|
var curve = path.firstCurve;
|
|
|
|
var length = curve.length;
|
|
|
|
var t = curve.getTimeAt(length / 3);
|
|
|
|
equals(t, 0.3869631475722452);
|
|
|
|
});
|
|
|
|
|
2016-09-24 15:39:09 -04:00
|
|
|
test('Curve#getTimeAt() with straight curve', function() {
|
|
|
|
// #1000:
|
|
|
|
var curve = new Curve([
|
|
|
|
1584.4999999999998, 1053.2499999999995,
|
|
|
|
1584.4999999999998,1053.2499999999995,
|
|
|
|
1520.5,1053.2499999999995,
|
|
|
|
1520.5,1053.2499999999995
|
|
|
|
]);
|
|
|
|
var offset = 63.999999999999716;
|
|
|
|
equals(function() { return offset < curve.length; }, true);
|
|
|
|
equals(function() { return curve.getTimeAt(offset); }, 1);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Curve#getTimeAt() with offset at end of curve', function() {
|
|
|
|
// #1149:
|
|
|
|
var curve = [-7500, 0, -7500, 4142.135623730952, -4142.135623730952, 7500, 0, 7500];
|
|
|
|
equals(Curve.getTimeAt(curve, 11782.625235553916), 1);
|
|
|
|
});
|
|
|
|
|
2015-04-04 11:05:39 -04:00
|
|
|
test('Curve#getLocationAt()', function() {
|
|
|
|
var curve = new Path([
|
|
|
|
[[0, 0], [0, 0], [100, 0]],
|
|
|
|
[[200, 200]],
|
|
|
|
]).firstCurve;
|
|
|
|
|
|
|
|
equals(curve.getLocationAt(curve.length + 1), null,
|
|
|
|
'Should return null when offset is out of range.');
|
2014-09-28 05:44:38 -04:00
|
|
|
});
|
2015-09-06 07:20:29 -04:00
|
|
|
|
2015-09-06 11:35:27 -04:00
|
|
|
test('Curve#isStraight()', function() {
|
2015-09-06 07:20:29 -04:00
|
|
|
equals(function() {
|
2015-09-06 11:35:27 -04:00
|
|
|
return new Curve([100, 100], null, null, [200, 200]).isStraight();
|
2015-09-06 07:20:29 -04:00
|
|
|
}, true);
|
|
|
|
equals(function() {
|
2015-09-06 11:35:27 -04:00
|
|
|
return new Curve([100, 100], [-50, -50], null, [200, 200]).isStraight();
|
2015-09-06 07:20:29 -04:00
|
|
|
}, false);
|
|
|
|
equals(function() {
|
2015-09-06 11:35:27 -04:00
|
|
|
return new Curve([100, 100], [50, 50], null, [200, 200]).isStraight();
|
2015-09-06 07:20:29 -04:00
|
|
|
}, true);
|
|
|
|
equals(function() {
|
2015-09-06 11:35:27 -04:00
|
|
|
return new Curve([100, 100], [50, 50], [-50, -50], [200, 200]).isStraight();
|
2015-09-06 07:20:29 -04:00
|
|
|
}, true);
|
|
|
|
equals(function() {
|
2015-09-06 11:35:27 -04:00
|
|
|
return new Curve([100, 100], [50, 50], [50, 50], [200, 200]).isStraight();
|
2015-09-06 07:20:29 -04:00
|
|
|
}, false);
|
|
|
|
equals(function() {
|
2015-09-06 11:35:27 -04:00
|
|
|
return new Curve([100, 100], null, [-50, -50], [200, 200]).isStraight();
|
2015-09-06 07:20:29 -04:00
|
|
|
}, true);
|
|
|
|
equals(function() {
|
2015-09-06 11:35:27 -04:00
|
|
|
return new Curve([100, 100], null, [50, 50], [200, 200]).isStraight();
|
2015-09-06 07:20:29 -04:00
|
|
|
}, false);
|
|
|
|
equals(function() {
|
2015-09-06 11:35:27 -04:00
|
|
|
return new Curve([100, 100], null, null, [100, 100]).isStraight();
|
2015-09-06 07:20:29 -04:00
|
|
|
}, true);
|
|
|
|
equals(function() {
|
2015-09-06 11:35:27 -04:00
|
|
|
return new Curve([100, 100], [50, 50], null, [100, 100]).isStraight();
|
2015-09-06 07:20:29 -04:00
|
|
|
}, false);
|
|
|
|
equals(function() {
|
2015-09-06 11:35:27 -04:00
|
|
|
return new Curve([100, 100], null, [-50, -50], [100, 100]).isStraight();
|
2015-09-06 07:20:29 -04:00
|
|
|
}, false);
|
2017-03-07 11:41:37 -05:00
|
|
|
equals(function() { // #1269
|
|
|
|
return new Curve([100, 300], [ 20, -20 ], [ -10, 10 ], [200, 200]).isStraight();
|
|
|
|
}, true);
|
2015-09-06 07:20:29 -04:00
|
|
|
});
|
2015-09-06 11:56:12 -04:00
|
|
|
|
|
|
|
test('Curve#isLinear()', function() {
|
|
|
|
equals(function() {
|
|
|
|
return new Curve([100, 100], [100 / 3, 100 / 3], [-100 / 3, -100 / 3], [200, 200]).isLinear();
|
|
|
|
}, true);
|
|
|
|
equals(function() {
|
|
|
|
return new Curve([100, 100], null, null, [100, 100]).isLinear();
|
|
|
|
}, true);
|
|
|
|
equals(function() {
|
|
|
|
return new Curve([100, 100], null, null, [200, 200]).isLinear();
|
|
|
|
}, false);
|
|
|
|
});
|
2016-02-02 05:59:53 -05:00
|
|
|
|
|
|
|
test('Curve#getTimeOf()', function() {
|
2016-09-24 15:39:09 -04:00
|
|
|
// #708:
|
2016-02-02 05:59:53 -05:00
|
|
|
var path = new Path.Rectangle({
|
|
|
|
center: new Point(300, 100),
|
|
|
|
size: new Point(100, 100),
|
|
|
|
strokeColor: 'black'
|
|
|
|
});
|
|
|
|
|
|
|
|
for (var pos = 0; pos < path.length; pos += 10) {
|
|
|
|
var point1 = path.getPointAt(pos),
|
|
|
|
point2 = null;
|
|
|
|
for (var i = 0; i < path.curves.length; i++) {
|
|
|
|
var curve = path.curves[i];
|
|
|
|
var time = curve.getTimeOf(point1);
|
|
|
|
if (time) {
|
|
|
|
// Legacy-check-hack:
|
|
|
|
equals(curve.getParameterOf(point1), time,
|
|
|
|
'Legacy: curve.getParameterOf() should return the same'
|
|
|
|
+ ' as curve.getTimeOf()');
|
|
|
|
point2 = curve.getLocationAtTime(time).point;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
equals(point1, point2, 'curve.getLocationAt(curve.getTimeOf('
|
|
|
|
+ point1 + ')).point;');
|
|
|
|
}
|
|
|
|
});
|
2016-03-17 06:24:20 -04:00
|
|
|
|
|
|
|
test('Curve#getPartLength() with straight curve', function() {
|
|
|
|
var curve = new Curve([0, 0, 0, 0, 64, 0, 64, 0]);
|
|
|
|
equals(function() { return curve.getPartLength(0.0, 0.25); }, 10);
|
|
|
|
equals(function() { return curve.getPartLength(0.25, 0.5); }, 22);
|
|
|
|
equals(function() { return curve.getPartLength(0.25, 0.75); }, 44);
|
|
|
|
equals(function() { return curve.getPartLength(0.5, 0.75); }, 22);
|
|
|
|
equals(function() { return curve.getPartLength(0.75, 1); }, 10);
|
|
|
|
});
|
2016-12-30 18:34:37 -05:00
|
|
|
|
|
|
|
test('Curve#divideAt(offset)', function() {
|
|
|
|
var point1 = new Point(0, 0);
|
|
|
|
var point2 = new Point(100, 0);
|
|
|
|
var middle = point1.add(point2).divide(2);
|
|
|
|
equals(function() {
|
|
|
|
return new Curve(point1, point2).divideAt(50).point1;
|
|
|
|
}, middle);
|
|
|
|
equals(function() {
|
|
|
|
return new Curve(point1, point2).divideAtTime(0.5).point1;
|
|
|
|
}, middle);
|
|
|
|
});
|
2018-10-05 03:44:42 -04:00
|
|
|
|
|
|
|
test('Curve#getTimesWithTangent()', function() {
|
|
|
|
var curve = new Curve([0, 0], [100, 0], [0, -100], [200, 200]);
|
|
|
|
equals(curve.getTimesWithTangent(), [], 'should return empty array when called without argument');
|
|
|
|
equals(curve.getTimesWithTangent([1, 0]), [0], 'should return tangent at start');
|
|
|
|
equals(curve.getTimesWithTangent([-1, 0]), [0], 'should return the same when called with opposite direction vector');
|
|
|
|
equals(curve.getTimesWithTangent([0, 1]), [1], 'should return tangent at end');
|
|
|
|
equals(curve.getTimesWithTangent([1, 1]), [0.5], 'should return tangent at middle');
|
|
|
|
equals(curve.getTimesWithTangent([1, -1]), [], 'should return empty array when there is no tangent');
|
|
|
|
|
|
|
|
equals(
|
|
|
|
new Curve([0, 0], [100, 0], [500, -500], [-500, -500]).getTimesWithTangent([1, 0]).length,
|
|
|
|
2,
|
|
|
|
'should return 2 values for specific self-intersecting path case'
|
|
|
|
);
|
|
|
|
|
|
|
|
equals(
|
|
|
|
new Curve([0, 0], [100, 0], [0, -100], [0, -100]).getTimesWithTangent([1, 0]).length,
|
|
|
|
2,
|
|
|
|
'should return 2 values for specific parabollic path case'
|
|
|
|
);
|
|
|
|
});
|