nurbsdemo_JanForetnik — mugehalici

http://geometrie.foretnik.net/files/NURBS-en.swf

via nurbsdemo_JanForetnik — mugehalici

Advertisements

Nurbs calculator tutorial – 1

For introduction of nurbs calculator, please read previous post.

 

In this and further tutorials I’ll create some linear, quadratic and cubic curves, using nurbs calculator. You can create a nurbs curve of any degree, but generally, curves of degree 2 and 3 are used, because higher degree curves requires more control points and so it becomes difficult to control the shape of the curve. A nurbs curve needs at least degree+1 control points. So if the degree of the curve is 100, then it requires minimum 101 control points and 202 knot values, to render the curve and it is very difficult to correctly position so many control points. A curve having degree 1 is called as linear (that means it is a line), having degree 2 is called as quadratic and having degree 3 is called as cubic

Find out the coordinates of mid point of a line: 

This is a very generic and simple problem and you don’t have to be an engineer to solve this 🙂 . Let’s assume that there is line in XY plane and the coordinates of the start points are (5.3, 6.4) and end point are (2.5, 4.3). Since it is in XY plane, so z coordinate will be 0. How can we find out the coordinates of the middle point of this line ? If you know the parametric equation of line, then it could be easy for you, but with the help of nurbs calculator you can do this in just few steps, even if you don’t know about parametric equation.

  • Go to the website http://nurbscalculator.in
  • Enter degree = 1
  • Remove all control points (except two points, which are required to draw a line) and enter the values of x and y coordinates of start and end points. Keep the value of z=0 and w=1.
  • Make sure that ‘clamped at start’ and ‘clamped at end’ are checked.
  • Enter the value of u parameter as 0.5, because we want to evaluate the mid point.
  • The coordinates of the point will shown in front of ‘Evaluated  point’ and the point will be displayed in yellow colour in the webGL window.

See the below image for illustration.

linear

You can evaluate the point on the line for any u value between 0 and 1, by moving the slider.

What is the parametric equation of line?

If the coordinates of start point of a line are (x1, y1) and end point are (x2, y2), then the parametric equation of line is given by –

x = (1-t)*x1 + t*x2

y = (1-t)*y1 + t*y2

which can be written in simplified form as –

x = x1 + (x2 – x1) * t

y = y1 + (y2 – y1) * t

where t is a parameter whose value is 0 at start point and 1 at end point.

Please share this post with your friends and colleagues, so that it can reach to the person who is new to geometric modelling and computer graphics.

Follow nurbscalculator on WordPress.com

WebGL based NURBS Demo

Nurbs_demo_1
NURBS Software using Three.js

You might have seen many demos of NURBS (Non Uniform Rational B-Spline), which are either flash based or java applet based, but none of these provide you full control on all the parameters of NURBS curves. Nurbs-calculator is the world’s first browser based application, which combines the power of three.js and angular.js to give the best user experience.  Three.js is one of the best javascript api to create webGL applications and angular.js is a perfect web application framework to create dynamic and extensible web apps.

NURBS is one of core fundamentals of most of the CAD software like Autodesk Maya , Rhinoceros 3D, SolidWorks etc  and generally it is considered as highly complicated mathematical concept. If you are new to NURBS, then ‘NURB curves – a guide for the uninitiated‘ will give you a good start. To understand the mathematics of NURBS and NURBS properties, visit – http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/.

But these websites are not helpful to understand the NURBS properties, until you have a software application where you can create some sample curves and see the effect of changing the curve parameter. This is where you need nurbs-calculator. This is a browser based app and doesn’t require any kind of installation on desktop PC. Just go to the URL – nurbscalculator.in and start creating curves. Once the curve is created, you can evaluate the point on the curve. Evaluation means finding the coordinates of a point on the curve corresponding to a parameter.

If you just want to create some splines and free form curves and not interested in understanding NURBS, then also nurbs-calculator is very helpful. It is very easy to use and can be accessed from mobile / tablet / laptop browsers. You can add / modify / remove control points in the webGL window on the right side and can set the precise values by using the edit boxes on the left side. More details about this can be found in the ‘How to use‘ section of the website.

I’ll put some tutorials in my next post, to demonstrate how one can use nurbs-calculator to create linear, quadratic or cubic splines.