I hope this is the best place for this post.
Would it be too difficult to add quadratic shaping to the line for this function?
A sloped drawArrow essentially.
A simple hack would be to draw a sloped(arc) line (dashed or not) from v1 to v2. Then apply a shorter line call to drawArrow() at v2 figuring the ending direction into the equation.
That would be cool. 8)
Yeah, not a bad idea. Maybe the best way would be to give the Path class the ability to create a stroke that has arrowheads on the ends. Then it could be any shape at all. Hmm, that’d actually be quite a cool feature for me to add to the new jucer vector graphics editor…
Good call on the Path integration. Yeah, that would be a neat feature - indeed
I have another idea - not related to drawArrow but perhaps just as useful. I don’t see anything under Graphics:: which fits the bill.
A way to draw symmetrical multi-sided objects, such as triangles, pentagons, hexagons, septagons, octagons, etc.
// perhaps more… after a certain point - it’ll just turn into a circle… esp with antialiasing.
Graphics::drawMultigon(float x, float y, float diam /* or radius */, float lineThickness=1.0f, const Sides mType);
Good suggestion! I’m tinkering with some geometry code at the moment so may have a go at this stuff.
Very nice. I see in the HEAD you’ve added the new arrow end cap for Paths (plus a bunch of other stuff too). Let me check it out.
Yep, I’ve been doing a lot of geometry stuff this week.
Ok, fun. lol check it out. I did the following to the basic hello world app. Gotta silly result.
// inserted PathStrokeType mystroke(2.0f); mystroke.createStrokeWithArrowheads(internalPath1,internalPath1,15.0f,15.0f,25.0f,25.0f);
// end insert
It shows two arrows pointin back at each other! Too funny.
hmm. will have to play with it some more…
Also, would I have to create a new sub path to tweak the fill color of the arrows?
That might look odd because it’ll be rendering another stroke around the outline of the already-stroked path…
Well yes, a Path contains no colour information, so any differently coloured sections need to be created and drawn separately.
Yeah, its what I was looking for. I appreciate you following up so quickly with a solution for this.
Thanks for that. Good job on everything. I’m satisfied.
Question: Is it possible to apply dashes to createStrokeWithArrowheads ?
Not sure how…
Also, a small issue with artifacts popping up (little spurious triangles), if I apply quadraticTo() before the above call to give a cool slope. Only occurs if the arrow head points back or near the origin (back to the source). Looks like a sub pixel rounding issue internally or something like that.
No, dashes would require a whole extra bunch of code to generate.
My algorithm isn’t going to be bulletproof - you could easily get it to go wrong if the curve bends too much along the section where it’s trying to draw the arrowhead.
Ok. On the first issue, would it be possible to achieve adequate results using multiple paths?
Is it possible to do dashing on normal paths? I’m just exploring that now.
With the 2nd issue, its no biggie. I could either not worry about or enforce some kind of angular bounds.
Regardless, its still pretty cool as it is now. But more would be nice!
You can probably just break your path up and draw dashes for part of it, and an arrowhead for another bit.
Ideally, you’d need a stroke creator that can dynamically change the width along the entire length of the path to some user-defined pattern - that’d be able to create any kind of arrow/dashes/snake shapes. Too busy to write it at the moment though!
cool deal. Get to it whenever you feel like it. I’m patient.