galagast Posted August 26, 2016 Share Posted August 26, 2016 Hi, how do I rotate two lines to connect their endpoints without changing the lengths in VEX? So far, I was able to somewhat get what I was after using other methods in SOPs. I'm curious if there's a way to do it in VEX/VOPs. Even just calculating the required angle of rotation. I've attached a sample scene below. meet_rotate_keep_length.hiplc Quote Link to comment Share on other sites More sharing options...
3dome Posted August 26, 2016 Share Posted August 26, 2016 think of it as 2 circles, each with center point 0 and radius = distance 0 to 1 calculate the intersection points and for both point 1 set their new coordinates to that point note: you will get 2 intersection points, just disregard the one you don't want to have Quote Link to comment Share on other sites More sharing options...
galagast Posted August 26, 2016 Author Share Posted August 26, 2016 (edited) Thanks 3dome. On my sample scene above, I did a similar approach: I created 2 circles centered at points 0 for both lines. Each circle also had a radius equal to the length of each line. I then used a boolean SOP to get the intersection and consequently, the point that I was after. Lastly, I calculated the angles from there using VEX for rotating the lines. It works great, but I'm more after looking for ways to do all of those using VEX. I will dive more into the docs and see if I missed a function that I could use to calculate this Edited August 26, 2016 by galagast Quote Link to comment Share on other sites More sharing options...
3dome Posted October 6, 2016 Share Posted October 6, 2016 i know its been a while. but heres the vex version of what i described meet_rotate_keep_length_vex.hiplc 3 Quote Link to comment Share on other sites More sharing options...
galagast Posted October 8, 2016 Author Share Posted October 8, 2016 THIS.IS.AWESOME! Thank you so much for the example file. I will be wrapping my head around the codes that you wrote.. starting with what "c" is. Quote Link to comment Share on other sites More sharing options...
3dome Posted October 10, 2016 Share Posted October 10, 2016 (edited) c is just the hypotenuse of the triangle formed between the center points. dist1 (or one could say "a". was kinda late when i wrote the code..) is x2 - x1, dist2 (or "b") is y2 - y1. so a^2 + b^2 = c^2 c = sqrt(a^2 + b^2) this can help http://mathworld.wolfram.com/Circle-CircleIntersection.html their "d" is more or less my "c" Edited October 10, 2016 by 3dome Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.