MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / calc_join

Method calc_join

dep/agg/include/agg_math_stroke.h:445–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443 //-----------------------------------------------------------------------
444 template <class VC>
445 void math_stroke<VC>::calc_join(VC& vc,
446 const vertex_dist& v0,
447 const vertex_dist& v1,
448 const vertex_dist& v2,
449 double len1,
450 double len2)
451 {
452 double dx1 = m_width * (v1.y - v0.y) / len1;
453 double dy1 = m_width * (v1.x - v0.x) / len1;
454 double dx2 = m_width * (v2.y - v1.y) / len2;
455 double dy2 = m_width * (v2.x - v1.x) / len2;
456
457 vc.remove_all();
458
459 double cp = cross_product(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y);
460 if (cp != 0 && (cp > 0) == (m_width > 0))
461 {
462 // Inner join
463 //---------------
464 double limit = ((len1 < len2) ? len1 : len2) / m_width_abs;
465 if (limit < m_inner_miter_limit)
466 {
467 limit = m_inner_miter_limit;
468 }
469
470 switch (m_inner_join)
471 {
472 default: // inner_bevel
473 add_vertex(vc, v1.x + dx1, v1.y - dy1);
474 add_vertex(vc, v1.x + dx2, v1.y - dy2);
475 break;
476
477 case inner_miter:
478 calc_miter(vc,
479 v0,
480 v1,
481 v2,
482 dx1,
483 dy1,
484 dx2,
485 dy2,
486 miter_join_revert,
487 limit,
488 0);
489 break;
490
491 case inner_jag:
492 case inner_round:
493 cp = (dx1 - dx2) * (dx1 - dx2) + (dy1 - dy2) * (dy1 - dy2);
494 if (cp < len1 * len1 && cp < len2 * len2)
495 {
496 calc_miter(vc,
497 v0,
498 v1,
499 v2,
500 dx1,
501 dy1,
502 dx2,

Callers 2

vertexMethod · 0.80
vertexMethod · 0.80

Calls 3

cross_productFunction · 0.85
calc_intersectionFunction · 0.85
remove_allMethod · 0.45

Tested by

no test coverage detected