MCPcopy Create free account
hub / github.com/MapServer/MapServer / calc_join

Method calc_join

renderers/agg/include/agg_math_stroke.h:379–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377 //-----------------------------------------------------------------------
378 template<class VC>
379 void math_stroke<VC>::calc_join(VC& vc,
380 const vertex_dist& v0,
381 const vertex_dist& v1,
382 const vertex_dist& v2,
383 double len1,
384 double len2)
385 {
386 double dx1 = m_width * (v1.y - v0.y) / len1;
387 double dy1 = m_width * (v1.x - v0.x) / len1;
388 double dx2 = m_width * (v2.y - v1.y) / len2;
389 double dy2 = m_width * (v2.x - v1.x) / len2;
390
391 vc.remove_all();
392
393 double cp = cross_product(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y);
394 if(cp != 0 && (cp > 0) == (m_width > 0))
395 {
396 // Inner join
397 //---------------
398 double limit = ((len1 < len2) ? len1 : len2) / m_width_abs;
399 if(limit < m_inner_miter_limit)
400 {
401 limit = m_inner_miter_limit;
402 }
403
404 switch(m_inner_join)
405 {
406 default: // inner_bevel
407 add_vertex(vc, v1.x + dx1, v1.y - dy1);
408 add_vertex(vc, v1.x + dx2, v1.y - dy2);
409 break;
410
411 case inner_miter:
412 calc_miter(vc,
413 v0, v1, v2, dx1, dy1, dx2, dy2,
414 miter_join_revert,
415 limit, 0);
416 break;
417
418 case inner_jag:
419 case inner_round:
420 cp = (dx1-dx2) * (dx1-dx2) + (dy1-dy2) * (dy1-dy2);
421 if(cp < len1 * len1 && cp < len2 * len2)
422 {
423 calc_miter(vc,
424 v0, v1, v2, dx1, dy1, dx2, dy2,
425 miter_join_revert,
426 limit, 0);
427 }
428 else
429 {
430 if(m_inner_join == inner_jag)
431 {
432 add_vertex(vc, v1.x + dx1, v1.y - dy1);
433 add_vertex(vc, v1.x, v1.y );
434 add_vertex(vc, v1.x + dx2, v1.y - dy2);
435 }
436 else

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