Page 1 of 1

Lines, Curves and Splines?

Posted: 28 May 2014, 12:11
by Trithilon
Hi,

I am trying to see if I can make splines which I can drag and connect to other controls. Similar to the lines you get in Unreal Kismet.

The functionality is similar to a popular line rendering solution for Unity :
http://www.starscenesoftware.com/vectrosity.html

The result could be similar to how a GUI solution called EVO GUI for Unity does it.
https://www.assetstore.unity3d.com/en/#!/content/11171

Please help. :)

Regards.

Re: Lines, Curves and Splines?

Posted: 28 May 2014, 17:15
by sfernandez
For basic shapes you can take a look at the Shapes tutorial here.

For complex shapes you should use the Path element, which uses SVG commands (Path Markup Syntax) to define its shape, for example:
<Path Data="M241.49998,264.49971 C314.49993,277.49971 374.5,397.5 437.5,409.5 500.5,421.5 564.49993,410.49925 583.49972,373.49992 601.23897,338.95531 540.49976,312.49983 533.49976,283.49983 523.0081,358.44328 441.5,358.49999 414.5,284.5 387.5,210.50001 423.9727,183.10478 452.9727,179.10478 481.9727,175.10478 516.63937,193.7711 587.9727,198.10443" Height="236.597" Stretch="Fill" Stroke="Red" Width="347.473"/>
path.png
path.png (2.93 KiB) Viewed 2861 times

Re: Lines, Curves and Splines?

Posted: 29 May 2014, 15:11
by jsantos
If you need this via API instead of Xaml you must use StreamGeometryContext. It supports Beziers (quadratic and cubic) and Arcs. You can easily create Splines using that primitives.

Re: Lines, Curves and Splines?

Posted: 05 Jun 2014, 11:42
by Trithilon
Wow, useful! Thanks! :)