Computer Graphics
From mathematics …
𝑆 = 𝐩 ∈ 𝐑3 , 𝑓 𝐩 = 0
𝑛
1
𝛼𝑅 𝐩 ≈ 𝛿𝑖
𝑑 𝐩 = 𝑛(𝐩) ⋅ 𝑙 𝑛
𝑖=0
© Giimann Futuristic Road Tunnel / Created in MOI3D and 3dsMax / Rendered with V-Ray
… to the screen
[Link]@[Link]
E. Galin
[Link] Université Lyon 1
Mathematics 17 septembre 2024 1
Computer Graphics
Mathematics
Modeling
Color and Texturing
Shading
Terrain Synthesis
Animation
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 2
Computer Graphics
Vectors
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 3
Vecteurs
Vectors Fondamentaux
Triangles Vecteur 𝐚 = 𝑥𝑎 , 𝑦𝑎 ∈ 𝐑2 , 𝐚 = 𝑥𝑎 , 𝑦𝑎 , 𝑧𝑎 ∈ 𝐑3 𝐚
Interpolation Norme 𝐚 = 𝑥𝑎2 + 𝑦𝑎2 + 𝑧𝑎2 1/2 s = 𝐚 𝐛 cos 𝛼 𝛼
Matrices 𝐛
Produit scalaire
Projections Définition s = 𝐚 ⋅ 𝐛 = 𝑥𝑎 𝑥𝑏 + 𝑦𝑎 𝑦𝑏 + 𝑧𝑎 𝑧𝑏
Frames Longueur projetée d’un vecteur 𝐯 sur un axe Δ de direction unitaire 𝐮 𝐯 ℎ
Sampling
𝑙 =𝐯⋅𝐮 ℎ= 𝐯 2 − 𝑙2
Intersections 𝑙
𝐮
Produit scalaire signé
𝐚×𝐛
Produit vectoriel
Scalaire dans le plan, vecteur dans l’espace
𝐚
𝐚 × 𝐛 = 𝑥𝑎 𝑦𝑏 − ya 𝑥𝑏 ∈ 𝐑 𝑦𝑎 𝑧𝑏 − za 𝑦𝑏 𝛼
𝐚×𝐛= −(𝑥𝑎 𝑧𝑏 − za 𝑥𝑏 ) ∈ 𝐑3
Dans le plan 𝐚, 𝐛 ∈ 𝐑2 𝑥𝑎 𝑦𝑏 − ya 𝑥𝑏 𝐛
Dans l’espace 𝐚 × 𝐛 orthogonal à 𝐚 et 𝐛
𝐚 × 𝐛 = 𝐚 𝐛 sin 𝛼
[Link]@[Link]
[Link] P. Shirley and S. Marschner. Fundamentals of Computer Graphics. Third Edition. A.K. Peters, 2009.
Mathematics 17 septembre 2024 4
Géométrie
Vectors Distances
Triangles Distance entre deux points 𝑑 = 𝐛 − 𝐚
Distance entre un point et une sphère 𝑑(𝐩, 𝑆) = 𝐩 − 𝐜 − 𝑟 𝐜
Interpolation
Matrices 𝑟
Distance d’un point à une droite 𝐩
Projections Soit 𝐨 un point de Δ de direction unitaire 𝐮 𝐩 𝑑
Frames 𝑑
𝐩−𝐨
Sampling 𝑙 = (𝐩 − 𝐨) ⋅ 𝐮 𝑑(𝐩, Δ) = 𝐩−𝐨 2 − 𝑙2 Δ
Intersections
Distance d’un point à un plan 𝑙
Soit 𝐨 un point du plan Π de normale 𝐧 𝐨 𝐮
𝑑 𝐩, Π = |𝐧 ⋅ 𝐩 − 𝐨 |
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 5
Computer Graphics
Triangles
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 6
Triangles
Vectors Caractérisation c
Triangles Sommets a b c n
Interpolation
Normale 𝐧ෝ unitaire (sens de parcours) et aire 𝑠
g ෝ
𝐧
Matrices
a
Projections 𝐧 = 𝐛−𝐚 × 𝐜−𝐚 s = 1/2 |𝐧| = 1/2 |(𝐛 − 𝐚) × (𝐜 − 𝐚)|
ෝ = 𝐧/||𝐧||
On définit 𝐧
Frames b
Sampling Norme du produit vectoriel
Coordonnées 𝐩 𝑥, 𝑦, 𝑧
Intersections
Norme ||𝐩||2 = 𝑥 2 + 𝑦 2 + 𝑧 2
Vecteur unitaire ෝ = 𝐩/||𝐩||
𝐩
Coordonnés barycentriques
Le barycentre de (𝐚, 𝛼) et (𝐛, 𝛽) est l’unique point 𝐪 tel que 𝛼 𝐪𝐚 + 𝛽 𝐪𝐛 = 𝟎
Coordonnées 𝐪 = (𝛼𝐚 + 𝛽𝐛)/(𝛼 + 𝛽)
Le milieu de 𝐚𝐛 est l’isobarycentre 𝐦 = 1/2 𝐚 + 1/2 𝐛
Lorsque 𝛼 = 𝑡 et 𝛽 = 1 − 𝑡, 𝑡 ∈ [0,1] on retrouve l’interpolation 𝐪 𝑡 = 1 − 𝑡 𝐚 + 𝑡𝐛
Généralisation à 𝑛 points
[Link]@[Link]
Centre de gravité d’un triangle 𝐠 = 𝐚 + 𝐛 + 𝐜 /3
[Link]
Mathematics 17 septembre 2024 7
Computer Graphics
Functions
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 8
Interpolation
Vectors Interpolation linéaire
Triangles Sur [0,1] on veut 𝑓 telle que 𝑓 0 = 𝑎 et 𝑓 1 = 𝑏
Interpolation
𝑥𝑏 − 𝑥 𝑥 − 𝑥𝑎
𝑓 𝑥 = 𝑦𝑏 + 𝑦
𝑓 𝑥 = 1 − 𝑥 𝑎 + 𝑥𝑏 𝑥𝑏 − 𝑥𝑎 𝑥𝑏 − 𝑥𝑎 𝑎
Matrices
Projections Cas général : 𝑓 𝑥𝑎 = 𝑦𝑎 et 𝑓 𝑥𝑏 = 𝑦𝑏
Frames Interpolation de degré supérieur
Sampling
On cherche 𝑓 ∈ 𝐑 𝑛 𝑥 avec 𝑓 𝑥𝑎 = 𝑦𝑎 et 𝑓 𝑥𝑏 = 𝑦𝑏 et 𝑓 (𝑘) 𝑥𝑎 = 𝑦𝑎𝑘 et 𝑓 (𝑘) 𝑥𝑏 = 𝑦𝑏𝑘
Intersections
2𝑛 contraintes, polynôme de degré 2𝑛 − 1
𝑘 𝑘
Sur [0,1] ,on veut 𝑓 telle que 𝑓 0 = 𝑎 et 𝑓 1 = 𝑏 et 𝑓 0 =𝑓 1 =0
Cubique 𝑓 𝑥 = 𝑥 2 (3 − 2𝑥 ) 𝑠 𝑥𝑎 , 𝑥𝑏 , 𝑥
Quintique 𝑓 𝑥 = 𝑥 3 (6𝑥 2 − 15𝑥 + 10)
Fonction smoothstep
Cubique 𝑥
𝑥𝑎 𝑥𝑏
𝑠 𝑥𝑎 , 𝑥𝑏 , 𝑥 = 𝑓 ∘ 𝑐 ∘ 𝑣 𝑥, 𝑥𝑎 , 𝑥𝑏
Changement 𝑥𝑏 − 𝑥
Restriction 𝑣 𝑥 =
[Link]@[Link] 𝑐 𝑥 = max(0, min(𝑥, 1)) de variable 𝑥𝑏 − 𝑥𝑎
[Link]
Mathematics 17 septembre 2024 9
Interpolation
Vectors Interpolation bi linéaire
2
Triangles Equation 𝑓(𝑢, 𝑣) où 𝑢, 𝑣 ∈ 0,1 et 4 contraintes aux sommet du domaine
Interpolation
𝑓 𝑢, 𝑣 = 1 − 𝑢 1 − 𝑣 𝑓 0,0 + 1 − 𝑢 𝑣 𝑓 0,1 + 𝑢 1 − 𝑣 𝑓 1,0 + 𝑢 𝑓(1,1)
Matrices
Projections
Paramétrage général sur 𝑢, 𝑣 ∈ 𝑢𝐚 , 𝑢𝐛 × 𝑣𝐚 , 𝑣𝐛 𝑓 0,1
Frames
Sampling
Changement de variable p 𝑓(1,1)
𝑓 0,0
Intersections
Interpolation de degré supérieur a b
Plus complexe : 16 contraintes pour une bi cubique
𝑓 1,0
Valeurs 𝑓 𝑢, 𝑣 , dérivées 𝜕𝑓/𝜕𝑢 et 𝜕𝑓/𝜕𝑣
et dérivées secondes 𝜕 2 𝑓/𝜕𝑢 𝜕𝑣
[Link]@[Link] Master
Linéaire Cubique
[Link]
Mathematics 17 septembre 2024 10
Computer Graphics
Matrixes
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 11
Algèbre linéaire
Vectors Matrices de réels
Colonnes
Triangles Tableau de réels de 𝑙 lignes par 𝑐 colonnes
Interpolation 𝑎00 ⋯ 𝑎0𝑐−1
Opérations 𝐀= ⋮ ⋱ ⋮ Lignes
Matrices
Somme, produit de matrice 𝑎𝑙−10 ⋯ 𝑎𝑙−1𝑐−1
Projections
Frames
𝐀+𝐁=𝐁+𝐀 𝐀𝐁𝐁𝐀
Sampling Ordre des transformations important
Matrice identité, inverse
Intersections
1 0 𝐀−1 si elle existe est telle que Inverse d’un produit
𝐈=
0 1 𝐀 𝐀−1 = 𝐈 𝐀 𝐁 −1 = 𝐁 −1 𝐀−1
𝑡
Transposée 𝐀t définie par 𝑎𝑖𝑗 = 𝑎𝑗𝑖
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 12
Transformations
Vectors Matrices de transformation
Triangles Homothéties de vecteur 𝐬 𝐬𝑥 0 0
Interpolation 𝐒 𝑠 = 0 𝐬𝑦 0
0 0 𝐬𝑧
Matrices
Projections Rotations d’angle 𝜃 autour des axes principaux
Frames 1 0 0 𝑐 0 −𝑠 𝑐 −𝑠 0
Sampling 𝐑𝑥 𝜃 = 0 𝑐 −𝑠 𝐑𝑦 𝜃 = 0 1 0 𝐑𝑧 𝜃 = 𝑠 𝑐 0
Intersections 0 𝑠 𝑐 𝑠 0 𝑐 0 0 1
Rotation d’angle 𝜃 autour de l’axe 𝐰
𝑠 = sin 𝜃
𝒘2𝑥 𝑐 ҧ + 𝑐 𝒘x 𝒘y 𝑐ҧ − 𝑠 𝐰𝑧 𝒘x 𝒘z 𝑐 ҧ + 𝑠 𝐰𝑦
𝑐 ҧ = 1 − cos 𝜃
𝐑𝒘 𝜃 = 𝒘x 𝒘y 𝑐 ҧ + 𝑠 𝐰𝑧 𝒘2𝑦 𝑐ҧ + 𝑐 𝒘y 𝒘z 𝑐ҧ − 𝑠 𝐰𝑥
𝒘x 𝒘z 𝑐 ҧ − 𝑠 𝐰𝑦 𝒘y 𝒘z 𝑐 ҧ + 𝑠 𝐰𝑥 𝒘2𝑧 𝑐 ҧ + 𝑐
𝑐 = cos 𝜃
Matrice de rotation entre deux vecteur unitaires 𝐮 et 𝐯 ?
C’est R 𝐮, 𝐯 = R 𝐮×𝐯 (cos −1 𝐮 ⋅ 𝐯) avec 𝐰 = 𝐮 × 𝐯 et 𝜃 = cos−1 𝐮 ⋅ 𝐯
[Link]@[Link] Par substitution, on évite le calcul des cos 𝜃, sin 𝜃 et cos−1 𝜃 en écrivant 𝐰 = 𝐮 × 𝐯 et 𝑐 = 𝐮 ⋅ 𝐯
[Link]
Mathematics 17 septembre 2024 13
Transformations
Vectors Application
Triangles Les positions résultant d’une transformation sont définies par produit matrice vecteur
Cas des normales
Interpolation Inverse
Transposée
Matrices
𝐩=𝐀𝐩 Point Devra être 𝐧= 𝐀 −1 t
𝐧
Projections Appendix
normalisé
Frames Nouveau point Matrice de transformation
𝐧
Sampling
𝐧
Intersections 𝐎
𝐩
𝐩 𝐑(𝜋/4) ∘ 𝐒 2,1
෩
𝐎
Objet initial Transformé
Compositions
Les transformations sont effectuées dans le repère canonique
Rotation autour de l’axe Δ en un point d’ancrage 𝐚
𝐑(3𝜋/4) ∘ 𝐓(2𝐱)
𝐑 𝐚,z 𝜃 = 𝐓a ∘ 𝐑 Δ 𝜃 ∘ 𝐓−a
L’ordre des transformations est important
𝐀𝐁𝐁𝐀
[Link]@[Link]
[Link]
𝐓(2𝐱) ∘ 𝐑(3𝜋/4)
P. Shirley and S. Marschner. Fundamentals of Computer Graphics. Third Edition. A.K. Peters, 2009.
Mathematics 17 septembre 2024 14
Computer Graphics
Projection
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 15
Camera rays
Vectors Objectifs
Triangles Projeter un point 𝐩 ∈ 𝐑3 de l’espace sur l’écran en un pixel 𝐪 ∈ 0, 𝑤 − 1 × [0, ℎ − 1] ⊂ 𝐍2
Interpolation
Définir l’équation d’un rayon Δ à partir d’un pixel 𝐪
Matrices 𝐲=𝐮 p
Caractérisation 𝐳 = −𝐯 q
Projections
Position 𝐞, vecteur de vue 𝐯, vecteur haut 𝐮 Δ
Frames Angle d’ouverture horizontal 𝛼, demi angle 𝛽 = 𝛼/2 𝐱=𝐯×𝐮
Sampling Aspect ratio 𝑟 = 𝑤/ℎ
Intersections Demi hauteur ℎ෨ = ℎ/2 et longueur 𝑤 = 𝑤/2
Rayon Δ(𝐞, 𝐝) depuis un pixel 𝐪
Repère local
𝐪𝑥 − 𝑤
1 ℎ෨ − 𝐪𝑦 𝐱=𝐯×𝐮
𝐝 = tan 𝛽 𝐱 + tan 𝛽 𝐲+𝐯 𝐲=𝐮
𝑤
𝑟 ℎ෨ 𝐳 = −𝐯
Coordonnées unitaires dans l’écran
Projection d’un point 𝐩 sur un pixel 𝐪
𝐩−𝐞 ⋅𝐱 𝐩−𝐞 ⋅𝐮
=
𝐪 , 𝐪= 𝑤 q 𝑥 , ℎ෨ − ℎ෨ q 𝑦
+𝑤
𝑑 tan 𝛽 𝑑 r tan 𝛽
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 16
Computer Graphics
Frames
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 17
Repères orthonormés
Vectors Construction
Triangles Construction d’un repère local orthonormé (𝐮, 𝐯, 𝐧) à partir d’une direction 𝐧
Interpolation
Algorithme simple [Hughes1999] ou optimisé [Frisvad2012]
Matrices Si 𝐧𝑧 > 1 − 𝜀
Si |𝐧𝑥 > |𝐧𝑧
𝐮 = 𝐱 et 𝐮 = 𝐲
Projections v = −𝐧𝑦 , 𝐧𝑥 , 0
Sinon si 𝐧𝑧 < 𝜀 − 1
Frames Sinon 𝐮 = −𝒚 et 𝐮 = −𝐱
𝐯 = 0, −𝐧𝑧 , 𝐧𝑦 Sinon
Sampling 𝐯 = 𝐯/ 𝐯 𝑎 = 1/(1 + 𝐧𝑧 )
Intersections 𝐮= 𝐯×𝐧 𝑏 = −𝑢 𝐧𝒙 𝐧𝒚
𝐮 = 1 − 𝑎 𝐧2𝑥 , 𝑏, −𝐧𝑥
6×, 3+ 1√, 3/, 3 × , 2 +
𝐯 = 𝑏, 1 − 𝑎 𝐧2𝑦 , −𝐧𝑦
1/, 6 × , 5 +
𝐯 = 0, −𝐧𝑧 , 𝐧𝑦 0, 𝐧𝑦 , 𝐧𝑧
𝐧
𝑧
𝑦
𝑥
[Link]@[Link]
J. F. Hughes and T. Möller. Building an Orthonormal Basis from a Unit Vector. Journal of Graphics Tools, 4(4), 33–35, 1999,
[Link] J. R. Frisvad. Building an Orthonormal Basis from a 3D Unit Vector Without Normalization. Journal of Graphics Tools, 16(3), 151–159, 2012.
Mathematics 17 septembre 2024 18
Computer Graphics
Random Samples
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 19
Discs
Vectors Random points inside
Triangles Rejection algorithm : compute (𝑥, 𝑦) uniformly in −𝑟, 𝑟 2 while 𝑥 2 + 𝑦 2 < 𝑟 2
Interpolation
Trigonometry : compute 𝜌 ∈ [0,1] and 𝜃 ∈ [0,2𝜋], we have:
Matrices 𝐩 = 𝑟 𝜌 cos 𝜃 , sin 𝜃
Projections
Vogel disc sampling
Frames
Spiral distribution of points 𝐩𝑘 , 𝑘 ∈ [0, 𝑛 − 1]
Sampling Procedural and deterministic way to sample a disc
Intersections
𝐩𝑘 = 𝑟 𝜌𝑘 cos 𝜃𝑘 , sin 𝜃𝑘 Golden angle
𝜌𝑘 = 𝑘 + 1/2 /𝑛 𝜃𝑘 ≈ 𝛾 𝑘, with 𝛾 = 𝜋 3 − 5 ≈ 2,4
20 60 256
[Link]@[Link]
[Link] H. Vogel. A better way to construct the sunflower head. Mathematical Biosciences. 44 (44), 179-189, 1979
Mathematics 17 septembre 2024 20
Sphere
Vectors Random points inside
Triangles Rejection algorithm : compute (𝑥, 𝑦) uniformly in −𝑟, 𝑟 3 while 𝑥 2 + 𝑦 2 + 𝑧 2 < 𝑟 2
Interpolation
Trigonometry : compute 𝜌 ∈ [0,1] and 𝑢, 𝑣 ∈ 0,1 2 , then set:
Matrices 𝐩 = 𝑟 3 𝜌 cos 𝜃 sin 𝜑 , sin 𝜃 sin 𝜑 , cos 𝜑
Projections
Frames 𝜃 = 2𝜋 𝑢 ∈ 0,2𝜋 𝜑 = cos−1 2𝑣 − 1 ∈ [−𝜋/2, 𝜋/2]
Sampling
Intersections Fibonacci surface sampling
Spiral distribution of points 𝐩𝑘 , 𝑘 ∈ [0, 𝑛 − 1]
Procedural and deterministic way to sample a sphere
𝜑𝑘 ≈ cos−1 1 − 2𝑘/𝑛
𝐩𝑘 = 𝑟 𝜌𝑘 cos 𝜃𝑘 sin 𝜑𝑘 , sin 𝜃𝑘 sin 𝜑𝑘 , cos 𝜑𝑘
𝜌𝑘 = 𝑘 + 1/2 /𝑛 𝜃𝑘 ≈ 𝑘 + 1/2 𝜋 1 + 5
Simplified equations avoid unnecessary trigonometric operations
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 21
Hemisphere
Vectors Random points inside
Triangles Rejection algorithm
Interpolation
Sample point inside 𝑆, compute 𝑠 = 𝐩 − 𝐜 ⋅ 𝐧, if 𝑠 < 0 set 𝐩 = 𝐩 + 2𝑠 𝐧
Matrices
Projections
Frames
Sampling
Intersections Fibonacci sampling
Change angle 𝜑𝑘 ≈ cos −1 𝑘/𝑛 in the spherical distribution to cover the hemisphere only
Simplify equation (avoid unnecessary cos and sin)
𝐩𝑘 = 𝑟 𝜌𝑘 cos 𝜃𝑘 1 − 𝑧 2 , sin 𝜃𝑘 1 − 𝑧 2 , 𝑧 𝑧 ≈ 𝑘/𝑛
𝜌𝑘 = 𝑘 + 1/2 /𝑛 𝜃𝑘 ≈ 𝑘 + 1/2 𝜋 1 + 5
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 22
Computer Graphics
Intersection
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 23
Primitives géométriques
Vectors Sphère Equation implicite de S
Triangles Recherche de Δ ∩ S 𝐩−𝐜 2
= 𝑟2
Interpolation Résolution de l’équation du second degré
𝐩 𝑡 = 𝐨 + 𝐝𝑡
Matrices 2 2 2 2
𝐝 𝑡 +2 𝐨−𝐜 ⋅𝐝𝑡+ 𝐨−𝐜 −𝑟 =0
Projections Equation paramétrique de Δ
Frames Optimisation : direction unitaire 𝐝 = 1
S
Sampling
Méthode géométrique plus efficace c
Intersections
Calcul de d 𝐩 𝑡 , Δ 2 et comparaison à 𝑟 2 b
D a
d
o
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 24
Primitives géométriques
Vectors Plan
Recherche de Δ ∩ Π n
Triangles Equation implicite de Π
Interpolation
Résolution de l’équation linéaire
d a 𝐩−𝐚 ⋅𝐧 =0
Matrices 𝐝⋅𝐧𝑡+ 𝐨−𝐚 ⋅𝐧= 0 o
Projections Π D
𝐩 𝑡 = 𝐨 + 𝐝𝑡
Frames Boîte
Sampling Intersection avec les plans Π𝑦𝑧 , Π𝑥𝑧 et Π𝑥𝑦 parallèles aux axes
Intersections
Intersection ray Δ ∶ 𝐨 + 𝐝𝑡 and 𝐵(𝐚, 𝐛) Division membre à membre et
Compute 𝐮 = (𝐚 − 𝐨)/𝐝 and 𝐯 = (𝐛 − 𝐨)/𝐝 factorisation 𝐧 = ±𝐱 ou ±𝐲 ou ±𝐳
Abscisse 𝑡 ∈ 𝐑 Compute 𝐭 − = min(𝐮, 𝐯) and 𝐭 + = max(𝐮, 𝐯)
t 𝑖𝑛 = max 𝐭 − − − + + +
𝑥 , 𝐭 𝑦 , 𝐭 𝑧 and t 𝑜𝑢𝑡 = min 𝐭 𝑥 , 𝐭 𝑦 , 𝐭 𝑧
If t 𝑖𝑛 < 𝑡𝑜𝑢𝑡 and t 𝑖𝑛 > 0 return true
return false
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 25
Primitives géométriques
Vectors Cylindre infini Equation implicite de 𝐶∞
Triangles Cylindre 𝐶∞ caractérisé par un axe 𝐷 et le rayon 𝑟 𝑑 𝐩, 𝐷 2
= 𝑟2
2
Interpolation 𝑑 2 𝐩, 𝐷 = 𝐩 − 𝐚 2
− 𝐩−𝐚 ⋅𝐮
𝐩 𝑡 = 𝐨 + 𝐝𝑡
Matrices
Projections Point de 𝐷 Vecteur directeur de 𝐷 Equation paramétrique de Δ
Frames
𝐝2 − 𝐝 ⋅ 𝐮 2
𝑡 2 + 2 𝐛 ⋅ 𝐝 − 𝐛 ⋅ 𝐮 × 𝐝 ⋅ 𝐮 𝑡 + 𝐛2 − 𝐛 ⋅ 𝐮 2
− 𝑟2 = 0 𝐶∞
Sampling
Intersections On définit 𝐛 = 𝐨 − 𝐚 u
a
D
d
Cylindre o
Cylindre 𝐶 = 𝐶∞ ∩ 𝑆 intersection entre un cylindre 𝐶∞ et un slab 𝑆
Calcul de l’intervalle d’intersection t − , t + 𝑆 t+
𝐶∞
t𝑆+
t − , t + = 𝐶∞ ∩ Δ ∩ 𝑆 ∩ Δ 𝐶
𝐶∞
a b
Cylindre Slab t𝑆− t−
𝐶∞
+ +
D
[Link]@[Link]
t − , t + = max t𝑆− , t −
𝐶∞ , min t𝑆 , t 𝐶∞
[Link]
Mathematics 17 septembre 2024 26
Primitives géométriques
Vectors Tore
Triangles Tore défini par un centre, un axe, et deux rayons
2
Interpolation On note 𝑐 2 = 𝐩 − 𝐜 2 , et ℎ2 = 𝐩 − 𝐜 ⋅ 𝐮 et 𝑙 2 = 𝑐 2 − ℎ2
Matrices
Equation implicite de 𝑇
Projections
2
𝑙−𝑅 + ℎ2 = 𝑟 2 ℎ2 + 𝑙 2 + 𝑅 2 − 𝑟 2 2
− 4𝑅 2 𝑙 2 = 0
Frames
Sampling
Intersection avec une droite
Intersections Résolution d’une quartique
𝐩 𝑡 = 𝐨 + 𝐝𝑡
[Link]@[Link]
[Link] J. Hart. Sphere Tracing: A Geometric Method for the Antialiased Ray Tracing of Implicit Surfaces. The Visual Computer 12(10), 527–545,1996.
Mathematics 17 septembre 2024 27
Computer Graphics
Appendix
[Link]@[Link]
[Link]
Mathematics 17 septembre 2024 28
Transformations des normales
Comatrice
Les cofacteurs d’indices 𝑖𝑗 sont définis par Sous matrice de taille 𝑛 − 1 sans
la ligne 𝑖 ni la colonne 𝑗 de 𝐀
𝑖+𝑗
𝑐𝑜𝑚 𝐀 𝑖𝑗 = −1 det 𝐀 𝑖𝑗
Propriété avec l’inverse
1
𝐀−1 = 𝑐𝑜𝑚 𝐀 𝑡
det 𝐀
Normales
Dans 𝐑^3, la comatrice 𝑐𝑜𝑚 𝐀 décrit l'interaction de 𝐀 avec le produit vectoriel Demonstration
𝐀 𝐮 × 𝐀 𝐯 = 𝑐𝑜𝑚 𝐀 𝐮 × 𝐯
Donc ∀ 𝐮, 𝐯 ∈ 𝐑3 × 𝐑3 , en posant 𝐧 = 𝐮 × 𝐯, on en déduit pour une transformation affine 𝐀
= 𝑐𝑜𝑚 𝐀 𝐧 = det 𝐀 𝐀−1
𝐧 𝑡
𝐧
= 𝐀−1
𝐧 t
𝐧
[Link]@[Link] En effet, ∀𝑥: det 𝐀 𝐮 × 𝐯 ⋅ 𝑥 = det 𝐀 𝐮, 𝐯, 𝑥 = 𝐀𝐮, 𝐀𝐯, 𝐀𝑥 = 𝐀𝐮 × 𝐀𝐯 ⋅ 𝐀𝑥 = 𝐀𝑡 𝐀𝐮 × 𝐀𝐯 ⋅ 𝑥
[Link] Donc 𝐀𝑡 𝐀𝐮 × 𝐀𝐯 = det 𝐀 𝐮 × 𝐯 = 𝐀𝑡 𝑐𝑜𝑚 𝐀 𝐮 × 𝐯
Mathematics 17 septembre 2024 29