Giter Club home page Giter Club logo

geonum2017's Introduction

Géométrie numérique, spring 2017

Welcome to the github repository of the course Géométrie numérique 2017.
See course website for more details.

Quickstart

cd your/working/dir/
git clone https://github.com/GeoNumTP/GeoNum2017.git
cd GeoNum2017
python TP1/tp1.py

Syllabus

  1. Bézier curves | theory | code
  2. Bézier splines | theory | code
  3. B-splines | theory | code
  4. Subdivision curves | theory | code
  5. Lane-Riesenfeld | theory | code
  6. Bézier surfaces | theory | code
  7. B-spline surfaces | theory | code
  8. Subdivision B-surfaces | theory | code
  9. Triangle mesh subdivision | theory | code

Resources

Python

If you have no prior experience with Python whatsoever, I suggest the tutorial Learn Python in 10 minutes by Stavros Korokithakis. For longer and more complete references, see the Fast Lane to Python by Norm Matloff and, of course, the official Python 2.7 tutorial.

NumPy

NumPy is a Python package supporting N-dimensional arrays and linear algebra operations. We'll mostly use it to manipulate datapoints stored in matrices (two-dimensional arrays). If you're not familiar with numpy, have a look at this cheatsheet.

Here are some useful numpy commands; you can test them in the python console.

>>> import numpy as np

# define a 50x3 matrix of zeros
>>> Z = np.zeros([50,3])

# define a 2x3 matrix
>>> A = np.array([[1,2,3],[4,5,6]])
>>> print A
[[1 2 3]
 [4 5 6]]

# define a vector with 10 evenly-spaced values between 0 and 1 
>>> t = np.linspace(0,1,10)
>>> print t 
[ 0.          0.11111111  0.22222222  0.33333333  0.44444444  0.55555556
  0.66666667  0.77777778  0.88888889  1.        ]
  
# define a range
>>> i = np.arange(10)   # same as np.arange(0,10)
>>> print i
[0 1 2 3 4 5 6 7 8 9]
>>> j = np.arange(5,45,10)
>>> print j
[ 5 15 25 35]

# get dimensions of a matrix
>>> S = A.shape
>>> print S[0]  # number of rows in A 
2
>>> print S[1]  # number of cols in A
3

# access a specific row
>>> print A[0,:]
[1 2 3]

# access a specific col
>>> print A[:,1]
[2 5]

# slicing: access cols 0 to 1
>>> print A[:,0:2]
[[1 2]
 [4 5]]

# slicing: access cols 1 to end
>>> print A[:,1:]
[[2 3]
 [5 6]]
 
# reshape A to have 3 rows and 2 cols
>>> B = A.reshape(3,2)
>>> print B
[[1, 2],
 [3, 4],
 [5, 6]]

# reshape A to have 2 cols
# number of rows is determined automatically
>>> C = B.reshape(-1,3)
>>> print C
[[1 2 3]
 [4 5 6]]

Matplotlib

Matplotlib is a Python 2D plotting library - we'll use it to visualise 2D curves via pyplot.
Example:

>>> import numpy as np
>>> import matplotlib.pyplot as plt

# generate random data
>>> A = np.random.rand(1000,2)
>>> x = A[:,0]
>>> y = A[:,1]

# plot blue circles
>>> plt.plot( x, y, 'bo')

# plot solid red lines
>>> plt.plot( x, y, 'r-')

# render and show the plot
>>> plt.show()

# plot dashed green lines and blue circles
>>> plt.plot(x, y, color='green', linestyle='dashed', marker='o', markerfacecolor='blue', markersize=12)

geonum2017's People

Contributors

bbrrck avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.