Circle tangents
1452 3 0- sessionbeer
- Member
- 39 posts
- Joined: July 2014
- Offline
Hello, I'm trying to find the common tangents of two circles in vex. So far I've made a mess of converting this javascript function because I'm getting what looks like incorrect results. Can anyone point out where I'm going wrong or how I may correct it?
Edited by sessionbeer - Aug. 2, 2022 11:08:19
- BabaJ
- Member
- 2126 posts
- Joined: Sept. 2015
- Offline
One of the 'issues' is that you are running over points in your wrangle.
In your common_tangents node you have:
Running over points means for your function arguments you will have a list for point1 as scene pt0, and point2 as scene pt1;
But also you will have a list as point1 as scene pt1 and point2 as scene pt1 also, which I don't think is the list you want.
I haven't studied your algorithm for the circle tangents so I don't know if you need two lists of points but if you do, just do the wrangle in detail and create two lists with the function done twice, reversing the point number reference.
As for your lines wrangle, again, haven't studied the algorithm but I suspect you need to do that in detail as well and you seem to still be in the prototype stage with your function as you are using invalid subscripts(e.g. .a,.b,and.c) on floats that you are looking at as if they are float arrays. You are also seemingly only interested in 3 elements(.a,.b,and.c)of the array constructed in the previous wrangle step yet those arrays have more than 3 elements.
In your common_tangents node you have:
vector point1 = @P;; vector point2 = (0,"P",1);
Running over points means for your function arguments you will have a list for point1 as scene pt0, and point2 as scene pt1;
But also you will have a list as point1 as scene pt1 and point2 as scene pt1 also, which I don't think is the list you want.
I haven't studied your algorithm for the circle tangents so I don't know if you need two lists of points but if you do, just do the wrangle in detail and create two lists with the function done twice, reversing the point number reference.
As for your lines wrangle, again, haven't studied the algorithm but I suspect you need to do that in detail as well and you seem to still be in the prototype stage with your function as you are using invalid subscripts(e.g. .a,.b,and.c) on floats that you are looking at as if they are float arrays. You are also seemingly only interested in 3 elements(.a,.b,and.c)of the array constructed in the previous wrangle step yet those arrays have more than 3 elements.
- sessionbeer
- Member
- 39 posts
- Joined: July 2014
- Offline
- srcare
- Member
- 2 posts
- Joined: Jan. 2021
- Offline
-
- Quick Links