mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-28 22:08:54 -04:00
Implement Curve#getTimesWithTangent()
and Path#getOffsetsWithTangent()
This commit is contained in:
parent
47af603173
commit
c235d6a917
5 changed files with 209 additions and 2 deletions
|
@ -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++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue