La présentation est en train de télécharger. S'il vous plaît, attendez

La présentation est en train de télécharger. S'il vous plaît, attendez

Patrick Reuter maître de conférences

Présentations similaires


Présentation au sujet: "Patrick Reuter maître de conférences"— Transcription de la présentation:

1 Patrick Reuter maître de conférences http://www.labri.fr/~preuter/c++
C++ 7ème cours Patrick Reuter maître de conférences

2 Aujourd’hui Compilation Makefile

3 Jusqu’à présent Crée un fichier exécutable td4
g++ main.cpp Image.cpp Pixel.cpp Vector3d.cpp -o td4 Crée un fichier exécutable td4 Désavantage : Chaque fichier .cpp est recompilé à chaque fois

4 Compilation séparé Fichiers objet Fichier éxécutable Fichiers source
main.cpp g++ main.cpp –c main.o main.o g++ Image.cpp –c Image.o Image.cpp Image.o td4 g++ Pixel.cpp –c Pixel.o Pixel.cpp Pixel.o g++ main.o Image.o Pixel.o Vector3d.o –o td4 Vector3d.cpp g++ Vector3d.cpp –c Vector3d.o Vector3d.o Préprocesseur et compilation Edition des liens

5 Makefile target: dep1 dep2 command
Si le fichier dep1 est plus récent que le fichier target, ou si celui-ci n'existe pas, regénérer le target en exécutant command". Si aucune commande n'est fournie, une règle par défaut est utilisée. target peut être un fichier à générer, ou le nom d'une tâche qu'on veut automatiser. On définit ainsi souvent une tâche clean dont le but n'est pas de créer un fichier de ce nom, mais bien de nettoyer le répertoire courant de ses fichiers inutiles (un exemple est donné dans la section suivante). Autre target spécifique, all : il est exécuté lorsqu'aucun paramètre n'est passé à make. Attention à make : l'espacement en début de seconde ligne, avant la commande, est en fait une tabulation !

6 Makefile # Makefile minimaliste all: td4
td4: main.o Image.o Pixel.o Vector3d.o g++ main.o Image.o Pixel.o Vector3d.o -o td4 main.o: main.cpp g++ main.cpp –c Image.o: Image.cpp g++ Image.cpp –c Pixel.o: Pixel.cpp g++ Pixel.cpp –c Vector3d.o: Vector3d.cpp g++ Vector3d.cpp –c clean: rm -f td4 main.o Image.o Pixel.o Vector3d.o

7 Intersection Rayon Sphere
Sphere center : (cx, cy, cz) Sphere radius :r Rayon position : (px, py, pz) Rayon direction : (dx, dy, dz) Sphere : (x – cx )2 + (y - cy )2 + (z - cz )2 = r2 Rayon : x(t) = px + t * dx y(t) = py + t * dy z(t) = pz + t * dz

8 Intersection Rayon Sphere
Sphere center : (cx, cy, cz) Sphere radius :r Rayon position : (px, py, pz) Rayon direction : (dx, dy, dz) Sphere : ( x – cx )2 + (y - cy )2 + (z - cz )2 = r2 Rayon : x(t) = px + t * dx y(t) = py + t * dy z(t) = pz + t * dz

9 Intersection Rayon Sphere
Sphere center : (cx, cy, cz) Sphere radius :r Rayon position : (px, py, pz) Rayon direction : (dx, dy, dz) Sphere : (x – cx )2 + (y - cy )2 + (z - cz )2 = r2 Rayon : x(t) = px + t * dx y(t) = py + t * dy z(t) = pz + t * dz Par insertion : (px + t * dx - cx)2 + (py + t * dy - cy)2 + (pz + t * dz - cz)2 = r2 < = > t2 ( dx2 + dy2 + dz2 ) + t ( 2 ( dz (pz – cz) + dz (pz – cz) + dz (pz – cz) ) ) + (px – cx)2 + (py – cy)2 + (pz – cz)2 Ou bien a*t2 + b*t + c = 0 avec : a = ( dx2 + dy2 + dz2 ) b = ( 2 ( dx (px – cx) + dy (py – cy) + dz (pz – cz) ) ) c = (px – cx)2 + (py – cy)2 + (pz – cz)2

10 Intersection Rayon Sphere
Sphere center : (cx, cy, cz) Sphere radius :r Rayon position : (px, py, pz) Rayon direction : (dx, dy, dz) Sphere : (x – cx )2 + (y - cy )2 + (z - cz )2 = r2 Rayon : x(t) = px + t * dx y(t) = py + t * dy z(t) = pz + t * dz Par insertion : (px + t * dx - cx)2 + (py + t * dy - cy)2 + (pz + t * dz - cz)2 = r2 < = > t2 ( dx2 + dy2 + dz2 ) + t ( 2 ( dz (pz – cz) + dz (pz – cz) + dz (pz – cz) ) ) + (px – cx)2 + (py – cy)2 + (pz – cz)2 Ou bien a*t2 + b*t + c = 0 avec : a = ( dx2 + dy2 + dz2 ) b = ( 2 ( dx (px – cx) + dy (py – cy) + dz (pz – cz) ) ) c = (px – cx)2 + (py – cy)2 + (pz – cz)2 – r2 Si la direction est normaliséea = 1 t0 = (- b + sqrt(b^2 - 4*c)) / 2 t1 = (- b - sqrt(b^2 - 4*c)) / 2


Télécharger ppt "Patrick Reuter maître de conférences"

Présentations similaires


Annonces Google