Jump to content
• Advertisement

# Scale bezier curve along normal

This topic is 2377 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

Hi!

I want to resize a bezier curve along its normals in order to resize a free form shape. I want to resize the object, but not _scale_ it.

What i do right now is the following:

Take the set of control points
Calculate the normal on the tangent points
Add normal * size to the control points

Of course, this doesn't work exactly as it should. The tangents should be changed, but i don't know how. Right now, my shape (that is tesselated later) looks like it is liquified

Any idea?

My control point setup gives me a point, and a tangent in, and tangent out value (defining the other 2 control points). But if i add the normal to these points, they get eased out, as they are handled as tangents and the original point is already translated. I hope you can follow me...

I also tried to tesselate first and move every vertex along its vertex normal, but this gives me intersections pretty soon.

Thank you very much, any help is appreciated and i am happy to share a working solution as soon as i get there...

snow

#### Share this post

##### Share on other sites
Advertisement
The name of the curve you're trying to find is an offset curve. Here's what I found about calculating those with a quick google search:
http://processingjs....erinfo/#offsets

I had to do this for quadratic bezier curves to implement stroking in my vector graphics library, and it was easy enough.

I started by using the same method as you (shifting control points along normals), which gives a good approximation when the curve is flat enough. When it isn't, you get the right distance at the extremities but much less than it at the center. Fortunately it is easy to solve by calculating the distance between the middle point of the original curve and of the approximate offset curve. If this distance is too far from the one you want, you just split the original curve in two and redo all this recursively.

It is probably more complicated for higher order curves, though. Edited by Zlodo

#### Share this post

##### Share on other sites
awesome, i check it out, thanks!

#### Share this post

##### Share on other sites
That worked perfectly!

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
43
2. 2
3. 3
4. 4
5. 5
• Advertisement

• 9
• 27
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633398
• Total Posts
3011659
• ### Who's Online (See full list)

There are no registered users currently online

×

## 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!