Catmull–Clark subdivision surface: Difference between revisions
Content added Content deleted
(Added Rust as a translation of Python.) |
mNo edit summary |
||
Line 2,638: | Line 2,638: | ||
{{trans|Python}} |
{{trans|Python}} |
||
<lang Rust> |
<lang Rust> |
||
pub struct Vector3 {pub x: f64, pub y: f64, pub z: f64, pub w: f64} |
pub struct Vector3 {pub x: f64, pub y: f64, pub z: f64, pub w: f64} |
||
Line 2,662: | Line 2,661: | ||
pub fn intersect_plane(plane_n: &Vector3, plane_p: &Vector3, line_start: &Vector3, line_end: &Vector3, mut t: f64) -> Vector3 { |
pub fn intersect_plane(plane_n: &Vector3, plane_p: &Vector3, line_start: &Vector3, line_end: &Vector3, mut t: f64) -> Vector3 { |
||
let mut p_n = plane_n.copy(); |
let mut p_n = plane_n.copy(); |
||
https://www.youtube.com/watch?v=QuqNwts5mc0&list=PLydfMPb3IeEPQFtfUO_WN7I_86_7WXWvQ&index=15 |
|||
p_n.normalize(); |
p_n.normalize(); |
||
let plane_d = -Vector3::dot_product(&p_n, plane_p); |
let plane_d = -Vector3::dot_product(&p_n, plane_p); |