Skip to content

Commit 0012483

Browse files
committed
Fix Path getNormalized
1 parent 493bdfc commit 0012483

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

modules/ILL/ILL/Ass/Shape/Path.moon

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,30 @@ class Path
375375

376376
-- Gets the normalized tangent on the Path given a time
377377
getNormalized: (t = 0.5) =>
378-
sumLength, length, tan, p, u = 0, t * @getLength!, nil, nil, nil
379-
@callBackPath (id, seg) ->
380-
segmentLen = seg\getLength!
378+
sumLength, length, newPath, tan, p, u = 0, t * @getLength!, Path!, nil, nil, nil
379+
@callBackPath (id, seg, k) ->
380+
path, segmentLen = {}, seg\getLength!
381+
if newPath.path[k] == nil
382+
newPath.path[k] = {seg.a}
381383
if sumLength + segmentLen >= length
382384
u = (length - sumLength) / segmentLen
383385
tan, p, u = seg\getNormalized u
384-
return "break"
386+
spt = seg\split(u)[1]
387+
if id == 'l'
388+
insert newPath.path[k], spt.b
389+
else if id == 'b'
390+
insert newPath.path[k], spt.b
391+
insert newPath.path[k], spt.c
392+
insert newPath.path[k], spt.b
393+
return "break", p, u, newPath
394+
if id == 'l'
395+
insert newPath.path[k], seg.b
396+
else
397+
insert newPath.path[k], seg.b
398+
insert newPath.path[k], seg.c
399+
insert newPath.path[k], seg.d
385400
sumLength += segmentLen
386-
return tan, p, u
401+
return tan, p, u, newPath
387402

388403
-- Distort the Path into another Path
389404
-- http://www.planetclegg.com/projects/WarpingTextToSplines.html

0 commit comments

Comments
 (0)