Jump to content
  • Advertisement
Sign in to follow this  
MarkS

What type of spline does Blender use in its node editor?

This topic is 494 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This may be the wrong forum, but I don't know where else to put it. Blender and other graphics packages that use a "node" interface typically use the same type of spline to connect between nodes. This spline is automatically defined and the user only has control over the two end points. Moving a node correctly redefines the spline. I'd rather not dig through the Blender source code, if at all possible, but I would like to know what type of spline is being used. I've tried searching Google, but all that brings up are links to tutorials and the like.

Here is a tutorial video that shows the node editor and connection splines:
https://www.youtube.com/embed/1LRDR0WAneE

Edited by MarkS

Share this post


Link to post
Share on other sites
Advertisement

Using Qt and knowing the start pos named pos1 and the end pos named pos2 :

QPainterPath p;
p.moveTo( Pos1 );
const qreal dx = Pos2.x() - Pos1.x();
const qreal dy = Pos2.y() - Pos1.y();
const QPointF ControlPoint1( Pos1.x() + dx * 0.5, Pos1.y() + dy * 0.1 );
const QPointF ControlPoint2( Pos1.x() + dx * 0.5, Pos1.y() + dy * 0.9 );
p.cubicTo( ControlPoint1, ControlPoint2, Pos2 );
setPath( p );

Share this post


Link to post
Share on other sites

 

Using Qt and knowing the start pos named pos1 and the end pos named pos2 :

QPainterPath p;
p.moveTo( Pos1 );
const qreal dx = Pos2.x() - Pos1.x();
const qreal dy = Pos2.y() - Pos1.y();
const QPointF ControlPoint1( Pos1.x() + dx * 0.5, Pos1.y() + dy * 0.1 );
const QPointF ControlPoint2( Pos1.x() + dx * 0.5, Pos1.y() + dy * 0.9 );
p.cubicTo( ControlPoint1, ControlPoint2, Pos2 );
setPath( p );

 

Thanks! I went to Inkscape after posting this and played around with a simple path and came to the same conclusion. They are just Bezier curves where the control points are adjusted based on the width and height of the bounding box.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!