Coder Social home page Coder Social logo

the-nurbs-code's Introduction

The NURBS Code

This Project is still under development.

Overview

  • This tool kits are developed for utilizing 2D NURBS curves with double precision, and mainly involves the following functions:
    • Create 2D NURBS curves with input degree, knot vector, control points and associated weights;
    • Evaluate the points/derivatives on the curve at any parameter.
    • ...
  • This mainly refers to the algorithm in the book, as well as tinyburns.
  • This tool kits are developed utilizing the Eigen library.

Example

Create a circle origined at $(0,0)$, with the radius of $0.3$, with following input:

MatrixXd control_points(9,2);
VectorXd knots(12);
VectorXd weights(9);
control_points << 0.3, 0.0,
                  0.3, -0.3,
                  0.0, -0.3,
                  -0.3, -0.3,
                  -0.3, 0.0,
                  -0.3, 0.3,
                  0.0, 0.3,
                  0.3, 0.3,
                  0.3, 0;
knots << 0.0, 0.0, 0.0, 0.25, 0.25, 0.5, 0.5, 0.75, 0.75, 1.0, 1.0, 1.0;
weights << 1.0, sqrt(2.0) / 2.0, 1.0, sqrt(2.0) / 2.0, 1.0, sqrt(2.0) / 2.0, 1.0, sqrt(2.0) / 2.0, 1.0;

Check the evaluation:

para      x                        y                        x^2+y^2                  
0.00      0.3000000000000000       0.0000000000000000       0.0900000000000000       
0.10      0.2441478108153225       -0.1743325743344757      0.0900000000000000       
0.20      0.0881435813134764       -0.2867589738320923      0.0900000000000000       
0.30      -0.0881435813134765      -0.2867589738320922      0.0900000000000000       
0.40      -0.2441478108153225      -0.1743325743344756      0.0900000000000000       
0.50      -0.3000000000000000      0.0000000000000000       0.0900000000000000       
0.60      -0.2441478108153224      0.1743325743344758       0.0900000000000000       
0.70      -0.0881435813134762      0.2867589738320923       0.0900000000000000       
0.80      0.0881435813134765       0.2867589738320922       0.0900000000000000       
0.90      0.2441478108153225       0.1743325743344756       0.0900000000000000       
1.00      0.3000000000000000       0.0000000000000000       0.0900000000000000     

the-nurbs-code's People

Contributors

dingtao-shen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.