| 371 | } |
| 372 | |
| 373 | static Point |
| 374 | dirVect(const BezierCPs& cps, |
| 375 | double time, |
| 376 | double t, |
| 377 | int sign) |
| 378 | { |
| 379 | Point ret; |
| 380 | |
| 381 | if (sign == 0) { |
| 382 | Point pre = predir(cps, time, t); |
| 383 | Point post = postdir(cps, time, t); |
| 384 | ret.x = pre.x + post.x; |
| 385 | ret.y = pre.y + post.y; |
| 386 | } else if (sign < 0) { |
| 387 | ret = predir(cps, time, t); |
| 388 | } else if (sign > 0) { |
| 389 | ret = postdir(cps, time, t); |
| 390 | } |
| 391 | |
| 392 | double norm = std::sqrt(ret.x * ret.x + ret.y * ret.y); |
| 393 | assert(norm != 0); |
| 394 | ret.x /= norm; |
| 395 | ret.y /= norm; |
| 396 | |
| 397 | return ret; |
| 398 | } |
| 399 | |
| 400 | static Point |
| 401 | dirVect(const BezierCPs& cps, |
no test coverage detected