question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implementing triangle-tee arrow shape variants

See original GitHub issue

@maxkfranz @ugurdogrusoz @gbader @jvwong @metincansiper @IgorRodchenkov

Note

This is a translation of my notes from talking with Max about how to implement custom arrow shapes. They represent a skeleton implementation and they are not fully fleshed out.

Requirements

Custom arrow shapes are needed for cytoscape.js.

Here is an example arrow shape that is required: screen shot 2016-12-19 at 11 34 39 am

Implementation Notes

Draw the arrow-tee in phases

Split up the drawing execution into phases.

For example:

  • phase 0 draws the arrow head
  • phase 1 draws the arrow edge connector
  • phase 2 draws extra lines that represent the variations in the arrow-tee Each portion of the shape can be rendered differently via config values associated with each phase.

Phase config values

  • multiphased: boolean representing whether this shape should be drawn in multiple phases or not
  • matchEdgeWidth: list of n booleans corresponding to the n drawing phases for the arrow shape. If matchEdgeWidth[n-1] is true, then phase n-1 will be drawn with the same line width as the edge it is attached to.
  • forceStroke: boolean to override a shape style and render it using strokes instead of fill. (Used for special cases such as a line between two points. In this case, you need to draw it using a stroke)

Other remarks

The collision function for necessary stimulation could be improved.

    collide: function( x, y, size, angle, translation, padding ){
      var triPts = pointsToArr( transformPoints( this.points, size + 2 * padding, angle, translation ) );
      var teePts = pointsToArr( transformPoints( this.pointsTee, size + 2 * padding, angle, translation ) );

      var inside = math.pointInsidePolygonPoints( x, y, triPts ) || math.pointInsidePolygonPoints( x, y, teePts );

      return inside;
    },

math.inlineVicinity and math.squareDistanceToFiniteLine could be better suited for detecting collisions.

pointsTee should be renamed to pointsLine or something more descriptive – the points currently do not represent a tee.

A generic name for this type of arrow should be considered over the biology specific necessary stimulation term. arrow-tee-stripe, arrow-tee-cross are potential names.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
d2fongcommented, Feb 8, 2017

Okay, I have updated the docs, should I close this issue?
(I have just added triangle-cross to the list of documented arrow shapes. Is that suffcient?)

0reactions
maxkfranzcommented, Feb 8, 2017

Yes, I think that’s all

Read more comments on GitHub >

github_iconTop Results From Across the Web

Arrows - PGF/TikZ Manual
Arrow tips are drawn using the same basic mechanisms as normal paths, so arrow tips can be stroked (drawn) and/or filled. However, we...
Read more >
How To Make Curved Arrows in PowerPoint - SlideModel.com
1. The easiest way to create a curved arrow is to use PowerPoint shapes. Simply head over to Insert –> Shapes –> Block...
Read more >
Geometry - Circle Theorems (the "arrow" theorem) - YouTube
Tutorial on the " Arrow " theorem: in a circle the angle at the centre is double the angle at ... The tutorial...
Read more >
NetLogo 6.3.0 User Manual: Shapes Editor Guide
By default there is only one Link shape in a model, that is “default”. This shape is simply a single straight line with...
Read more >
How to draw an arrow or triangle or star in Adobe InDesign
Again, this is not my best design. But we're learning how to makes shapes, and I couldn't think of a better exercise. So,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found