The new NodeBox forum is live! Everything from support.nodebox.net moved here: sign in with the same email to pick up your old posts. Something not working? Write to forum-support@nodebox.net.

Show your WorkFrom the old forum

True Center Node

No replies yet

  1. Attached is a new node: true_center. It calculates the true center of regular polygons, stars, and fancy stars.

    The centroid node is used to determine the geometric center of a shape in Nodebox. It is based on the the bounds of the shape. But for certain shapes, including regular polygons (generated by the polygon node), stars (generated by the stars node), and fancy stars (generated by my new fancy_star node), with an odd number of sides or tips, the centroid will not return the true center of the shape.

    This becomes a problem if you need to rotate the shape or place it precisely. The fewer the sides or tips, the more pronounced the problem is, with triangles being the worst case.

    True_center solves this problem. Feed it any regular polygon, star, or fancy star and it will return the ship's true center (the center point where all the corners or tips project from).

    See attached screenshot and demo. Hook the output of a fancy_star node, polygon node, or star node to the null node at the top, turn on your origin markers, and render the combine node at the bottom. Since these shapes are all drawn at the origin, their true center (indicated by the red dot), should always be at the origin. As you change the settings and number of sides or tips you will notice that the true center stays fixed. But the centroid, indicated by the smaller black dot, will drift whenever there is arn odd number of sides or tips.

    Rotating the shape (around its true center) will not affect the red dot, but will cause the centroid to shift. You can see this easily in the demo by simply hitting the play button.

    True_center only works with polygons and stars. In order to find reasonable center points inside arbitrarily weird shapes, see another new node, good_center:

    https://forum.nodebox.net/t/2794918422/good-center-node

    True_center is a life-saver when doing precise work like the Islamic tiles I am working on at the moment. It will be included in the next release of my Cartan Node Library and is free to use with no restrictions.

    Enjoy!

    John

    Copy link

Know something that helps?

Sign in with your email address to reply. No password needed.

Sign in to reply