(Mis)adventurous graphing

Whoops... I think I just went on a tangent.

(Mis)adventurous graphing

Introduction

Bézier Curves are pretty cool. Say you want to take a series of points and then graph a curve based on them – you can do that. Want to add weight to a point to alter a curve with the same points? You can do that.

Bézier Curves aren’t traditional polynomials, they’re parametric curves (which you can read up on here if you really want to). Essentially, the created Bézier function expresses the coordinates of each point on the curve, but not as a function of x. (In this case, a function of t).

I don’t claim to know the history behind the mathematics of Bézier curves and whatnot (or how it works, exactly!). What I do know, however, is how to implement the general case formula in a language I know and love – C#. So my primary aim after learning the formula is to implement it in C#.

The fun stuff!

An early (incomplete) prototype program written by me in C#.

My understanding of the Bézier Curve is fairly limited, in all honesty. However – I’ve given myself a day or so to play with the curve and it’s been really, really fun. In fact it’s been so fun, that I found that a Wikipedia article (surprise?) had a mistake in a formula on the page.

Supposedly, the applications of Bézier curves lie largely in digital design, which isn’t a surprise. Creating a curve from points without knowing any form of equation is handy in general… and it’s pretty cool too. I don’t know how I’ll take this forward, but it’s been really fun to learn about it.

A short, not so easy viewing.

The Bézier Curve equation looks like this (but believe me, it’s not as hard as it looks!):

\mathbf{B}(t) = \sum_{i=0}^n \frac{ b_{i,n}(t) \mathbf{P}_{i}w_i } { \sum_{j=0}^n b_{j,n}(t) w_j }

b_{i,n}(t) = {n\choose i} t^i (1 - t)^{n - i}

{n \choose i} = \frac{n!}{i!(n - i)!}

You can find an example here: https://www.desmos.com/calculator/kbbdqtd1ve.

Where Pi is the point coordinate (x or y). So for example, given points (0, 10), (5, 0) and (10, 10), P0 is 0 and also 10, because x and y coordinates are used in separate equations. t is a value between 0 and 1 inclusively (i.e. an arbitrary value like 0.001). The smaller the frequency of numbers when graphing, the more detail is given.

I’m not particularly good at explaining this stuff. If you would like to have some nice reading and try it yourself, I suggest you read the following:

https://en.wikipedia.org/wiki/Binomial_coefficient
https://en.wikipedia.org/wiki/Bézier_curve https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/NURBS/RB.html

2 Responses

  1. Anonymous Zebra says:

    This is awesome!! I look forward to the final product!! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *