Implement Curve#getTimesWithTangent()

and Path#getOffsetsWithTangent()
This commit is contained in:
Samuel Asensi 2018-10-05 09:44:42 +02:00 committed by Jürg Lehni
parent 47af603173
commit c235d6a917
5 changed files with 209 additions and 2 deletions

View file

@ -611,6 +611,14 @@ test('Path#arcTo(from, through, to); where from, through and to all share the sa
equals(error != null, true, 'We expect this arcTo() command to throw an error');
});
test('Path#getOffsetsWithTangent()', function() {
var path = new Path.Circle(new Point(0, 0), 50);
var length = path.length;
equals(path.getOffsetsWithTangent(), [], 'should return empty array when called without argument');
equals(path.getOffsetsWithTangent([1, 0]), [0.25 * length, 0.75 * length], 'should not return duplicates when tangent is at segment point');
equals(path.getOffsetsWithTangent([1, 1]).length, 2, 'should return 2 values when called on a circle with a diagonal vector');
});
test('Path#add() with a lot of segments (#1493)', function() {
var segments = [];
for (var i = 0; i < 100000; i++) {