{"id":787,"date":"2024-03-08T11:09:40","date_gmt":"2024-03-08T19:09:40","guid":{"rendered":"http:\/\/fx-td.com\/houdiniandchill\/?p=787"},"modified":"2024-03-08T11:29:53","modified_gmt":"2024-03-08T19:29:53","slug":"archived-post-by-aswaab-13","status":"publish","type":"post","link":"http:\/\/fx-td.com\/houdiniandchill\/2024\/03\/08\/archived-post-by-aswaab-13\/","title":{"rendered":"Archived post by aswaab"},"content":{"rendered":"<div class=\"postie-post\">\n<p class=\"\">Some code for the volume wrangle. Volume goes in input 1. Seed points in input 2. And then you need to construct the control interface.<br \/>\n`\/\/controls int mirror = chi(&#8220;mirror&#8221;); int distanceMetric = chi(&#8220;distanceMetric&#8221;);<br \/>\n\/\/init variables float currentdist = 1000000; \/\/pick a super high starting value. In theory, it should be infinite&#8230; int closestpt = 0; \/\/placeholder for seed point float dist = 0; \/\/placeholder for distance to seed vector pos = <a href=\"mailto:v@P\" >v@P<\/a>; \/\/current voxel position<br \/>\n\/\/mirror if(mirror == 1) pos.x = abs(pos.x); if(mirror == 2) pos.y = abs(pos.y); if(mirror == 3) pos.z = abs(pos.z);<br \/>\n\/\/calculate distances int pts = npoints(1); for(int pt = 0; pt < pts; pt++){     vector ptpos = point(1, \"P\", pt);     vector vdist = abs(pos - ptpos); \/\/vector distances     if(distanceMetric == 0) dist = length(vdist); \/\/euclidian\/voronoi distance     if(distanceMetric == 1) dist = sum(vdist); \/\/manhattan distance     if(distanceMetric == 2) dist = max(vdist); \/\/chebyshev distance\n    if(dist <= currentdist){         closestpt = pt;         currentdist = dist;         } }`<\/p>\n<p class=\"\">Above code will give you a density field that stores the seed values. From there, you can parse it how you need.<\/p>\n<p class=\"\">(gemming my own code for posterity)<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Some code for the volume wrangle. Volume goes in input 1. Seed points in input 2. And then you need to construct the control interface. `\/\/controls int mirror = chi(&#8220;mirror&#8221;); int distanceMetric = chi(&#8220;distanceMetric&#8221;); \/\/init variables float currentdist = 1000000; \/\/pick a super high starting value. In theory, it should be infinite&#8230; int closestpt = &hellip; <a href=\"http:\/\/fx-td.com\/houdiniandchill\/2024\/03\/08\/archived-post-by-aswaab-13\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Archived post by aswaab<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"_links":{"self":[{"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/posts\/787"}],"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=787"}],"version-history":[{"count":0,"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/posts\/787\/revisions"}],"wp:attachment":[{"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/media?parent=787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/categories?post=787"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fx-td.com\/houdiniandchill\/wp-json\/wp\/v2\/tags?post=787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}