{"id":441,"date":"2019-12-11T04:29:22","date_gmt":"2019-12-11T12:29:22","guid":{"rendered":"http:\/\/fx-td.com\/houdiniandchill\/?p=441"},"modified":"2019-12-11T04:29:28","modified_gmt":"2019-12-11T12:29:28","slug":"archived-post-by-sniperjake945-3","status":"publish","type":"post","link":"http:\/\/fx-td.com\/houdiniandchill\/2019\/12\/11\/archived-post-by-sniperjake945-3\/","title":{"rendered":"Archived post by SniperJake945"},"content":{"rendered":"<p class=\"\">it was the mouse yee. Okay so basically the procedure is this:<br \/>\nstarting from some triangle`T`, at some point `u` (in the triangle not on an edge or at one of the vertices of the triangle, those are special cases), trace a vector `v` over the surface of your mesh.<br \/>\nfirst rotate `u` into 2d using the dihedral between `T`&#8217;s normal and one of your coordinate axes, do the same for `v`.<br \/>\nConvert the 2d `u` into barycentric coordinates. convert the 2d `u + v` into barycentric coordinates.<br \/>\nusing some barycentric fuckery (<a href=\"https:\/\/math.stackexchange.com\/questions\/2382016\/determine-if-a-line-segment-passes-through-a-triangle\/2385307#2385307\">math.stackexchange.com\/questions\/2382016\/determine-if-a-line-segment-passes-through-a-triangle\/2385307#2385307<\/a>) determine which edge the line `u, u + v` crosses.<br \/>\nkeep in mind that if `u + v` is somewhere in your triangle you should break, because that means your tracing position is inside this triangle `T`.<br \/>\nconvert back to 2d from barycentric. find the angle of intersection `theta`.<br \/>\ngrab the intersected edge.<br \/>\nsubtract the distance traveled from the length of the original vector and store it as like some float named `length_left`<br \/>\nstore the hit position as a 1d value `g` along the hit edge for efficiency.<br \/>\nFlip over this edge.<br \/>\nrotate this edge into 2d space of the new triangle.<br \/>\nfind the new `u` by scaling this rotated edge by `g`<br \/>\nthen rotate this edge, from `u` to equal `180 &#8211; theta`, and scale it to be equal to `length left`.<br \/>\nrepeat the above intersection process but like omit the edge that you just crossed from the test.<br \/>\nContinue until you&#8217;ve traced the full length of the initial vector.<br \/>\nNice.<\/p>\n<p class=\"\">Caveats:<br \/>\nif you hit a vertex of a triangle you need to follow the keenan crane paper, which basically gives you a guide for figuring out which triangle u want to start tracing from, given the previous trace vector<br \/>\nif your vector is perfectly parallel with an edge, you might run into numerical issues and will have to have a catch for that.<br \/>\nStarting your trace from anywhere on the edge of the triangle is annoying to deal with if you dont know which triangle your current trace vector is pointing into.<br \/>\nI havent proof read any of this, so if it&#8217;s incoherent, sorry.<\/p>\n<p class=\"\">its a lot of work to do this efficiently, but once you get it working you can do a lot of really crazy things<\/p>\n<p class=\"\">i have faith that any and all of you can do this too!!!! i believe in you!!!!!!!!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>it was the mouse yee. Okay so basically the procedure is this: starting from some triangle`T`, at some point `u` (in the triangle not on an edge or at one of the vertices of the triangle, those are special cases), trace a vector `v` over the surface of your mesh. first rotate `u` into 2d &hellip; <a href=\"http:\/\/fx-td.com\/houdiniandchill\/2019\/12\/11\/archived-post-by-sniperjake945-3\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Archived post by SniperJake945<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/posts\/441"}],"collection":[{"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/comments?post=441"}],"version-history":[{"count":0,"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/posts\/441\/revisions"}],"wp:attachment":[{"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/media?parent=441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/categories?post=441"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/tags?post=441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}