Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Find circle radius & circle center in 3D from (3) XYZ pts 5

Status
Not open for further replies.

DrMetal

Materials
Oct 4, 2005
30
0
0
US
GIVEN: X-Y-Z coordinates of 3 points in 3D space. FIND: Radius of circle on those 3 points & Circle center co-ordinatesBookmark:
Question: Can someone provide a mathematical step by step procedure to calculate and determine a circle radius and the center point coordinates from three GIVEN 3D points with X-Y-Z coordinates?

- I have searched the web extensively, and found lots of proposed solutions, but my college math is quite rusty and after several days, I still can not come up with the correct detailed solution. I can do this easily from three points in 2D, in Excel using three simultaneous equations with TWO variables (i.e. find circle center @ h, j). But I can't get it to work in 3D with a similar spreadsheet approach with THREE variables (i.e. find circle center @ h-j-k). Seems I keep going in mathematical circles (no pun intended) with a modified Excel approach with the three quadratic equations.

- Is it possible to solve this mathematically with (3) simultaneous quadratic equations? Or do I need a 4th equation, determinates, etc?. Seems when I try the double elimination (or substitution) of variables approach, I keep coming up with unsolvable, or meaningless equations. With as much time as we have spent on this problem, we would be happy to compensate someone for their time to solve this for us.

- We have several drawings with bent pipes in 3D where we have only THREE 3D points given to us. We need to be able to determine the TRUE bend radius of the pipes. These are special alloy pipes @ $25k each, so we want to be sure we have the correct 2D bend radius before we bend them. I'd prefer an approach that could be put into a spreadsheet to make reiterative calcs go quickly. I'd prefer to have a detailed step-by-step solution vs. being directed to one of the web solutions. I have seen most of them, and still am stuck on this.
Thanks, MWP
 
Replies continue below

Recommended for you

actually i don't think that'll work with the data provided ... the OP has clarified that he knows only two points on the arc; his 3rd point defines tangents to the unknown arc thru the 1st 2 points.
 
Hmmm... I missed that detail. So keeping it 2d for a minute, with two intersecting lines, you can define a circle that is tangent to both and passes thru one of the points, but the other point will over constrain the circle won't it?
 
i don't think so ... the information provided by the 3 pts (two tangents, and 2 points of tangency) is slightly over-defined, but it does set up a very easy solution (the intersection of normals through the pts of tangency).

you only need the two tangents and one point of tangency, as the centre is on the bisector of the two tangents.
 
With two tangent points and a virtual intersection:

Given: tangent points A & C, intersection point B...

•Center of arc lies on the bisector of ABC
•Bisector can be determined by line from B to midpoint of segment AC.
•Radius is distance from A or C to bisector.
•Center is found on line perpendicular from A or C to bisector (may also be found w/ point-to-curve distance calculation).
 
I forgot to give the radius of the circle which is simply the vector length between X,Y,Z and x1,y,,z1 or
sqrt[X-x1)^2+(Y-y1)^2+(Z-z1)^2]
 
1957 quote

"i'd simply zeke's approach by redefining the three (xyz) points in terms of their common plane, (XY), removing one dimension.

now you know two tangents, (X1Y1-X2Y2) and (X1Y1-X3Y3), and two points of tangency, (X2Y2) and (X3Y3). determine the normals to the tangents thru the points of tangency. their intersection is the centre of the arc."
-------------------------------------------------------------
Do you really think you simplify the solution by working in the x-y plane?
What about the transformation into the x-y plane? I don't really think so.
The 3D solution is fairly simple these days thanks to the quick ability of any of the math programs to solve linear equations.
I could easily set up the solution in EXCEL - first solving my 2x2 set and then the final 3x3 set.
 
greg, if think you were working on the assumption that the three points were on the arc. now we know two points are on the arc, and the 3rd point is the intersection of the tangents. this implies that there is order to the points (ie, pts 1 & 2 are on the arc, and pt 3 is the intersection). without knowing how you set up the test, we can't check it.

zeke,
actually, yes, i do think working in 2D is easier than 3D. i think working with co-ords like (0,0), (x,0), and (x1,y1) is easier. i think looking on the arc for the normal (the true view) is easier to visualise. admittedly, the math is moved to the transformation matrices, but none of this math is "hard".
 
Gents,
- Sorry for the delay to say thanks to all for the great responses to this thread. I have not completed this yet, but am very confident that we have sufficient information to complete the solution I was after. So thanks again to all. Very nicely done! MWP
 
Excel_Macro_01.jpg


Finding the centre and radius of the circumscribed circle of a triangle (ABC) is something I first did in the mid-1980s — in BASIC, I'm retired now but I've still got the notes written at the time. The normal form of the plane equation wasn't used — just the direction cosines of the axis system that the three points are in. The diameter of the circle that fits the corners of the triangle is the length of any side divided by the sine of its opposite angle; the centre of the circle is found by solving one more triangle.

The following code is modified BASIC; if it's pasted into an Excel VBA macro it will run — it is basic stuff in more ways than one. I'm sure there are slicker ways of doing this task, but I've used direction cosines; the code has been run with various values (and signs) for the three points — and has outputted the correct (so far...) radius and radius centre coordinate each time. (I've had it checked against a CATIA model)

I've posted the code because an original requirement was for a solution that could be pasted in and run.
Code:
 Sub CircumscribedRadius_04()
        Range("A1:Z512").NumberFormat = "###0.000000"
'   ———————————————————————————————————————————————————————————————————
'   Given three points in space (A,B,C)
         Xa = 47: Ya = -61: Za = 137
         Xb = -6: yb = 19: Zb = -28
         Xc = 83: Yc = 40: Zc = -55
'   Lengths of AB, AC, AC
         AB = (((Xa - Xb) ^ 2) + ((Ya - yb) ^ 2) + ((Za - Zb) ^ 2)) ^ 0.5
         BC = (((Xb - Xc) ^ 2) + ((yb - Yc) ^ 2) + ((Zb - Zc) ^ 2)) ^ 0.5
         AC = (((Xa - Xc) ^ 2) + ((Ya - Yc) ^ 2) + ((Za - Zc) ^ 2)) ^ 0.5
'   Direction cosines of AB(ABi,ABj,ABk)
        ABi = (Xb - Xa) / AB
        ABj = (yb - Ya) / AB
        ABk = (Zb - Za) / AB
'   Direction cosines of AC(ACi,ACj,ACk)
        ACi = (Xc - Xa) / AC
        ACj = (Yc - Ya) / AC
        ACk = (Zc - Za) / AC
'   Cosine of angle BAC
     cosBAC = (AB ^ 2 + AC ^ 2 - BC ^ 2) / (2 * AB * AC)
         AD = cosBAC * AC
         CD = (AC ^ 2 - AD ^ 2) ^ 0.5
'   Position of point D, which is C projected normally onto AB
         Xd = Xa + (AD * ABi)
         Yd = Ya + (AD * ABj)
         Zd = Za + (AD * ABk)
'   Direction cosines of CD(Cdi,CDj,CDk)
        CDi = (Xc - Xd) / CD
        CDj = (Yc - Yd) / CD
        CDk = (Zc - Zd) / CD
'   Direction cosines of normal to AB and CD
'   — to be used for rotations of circle centre
         Ni = (ABk * CDj) - (ABj * CDk)
         Nj = (ABi * CDk) - (ABk * CDi)
         Nk = (ABj * CDi) - (ABi * CDj)
'   # Diameter of circumscribed circle of a triangle is equal to the
'   the length of any side divided by sine of the opposite angle.
'   This is done in a coordinate system where X is colinear with AB, Y is // to CD,
'   and Z is the normal (N) to X and Y, and the origin is point A
'         R = D / 2
     sinBAC = (1 - cosBAC ^ 2) ^ 0.5
          R = (BC / sinBAC) / 2
'   Centre of circumscribed circle is point E
         X2e = AB / 2
         Y2e = (R ^ 2 - X2e ^ 2) ^ 0.5
         Z2e = 0
'   Transform matrix
'                    Rotations                 Translations
'             ——————————————————————————————————————————————
'               ABi  ,   ABj  ,  ABk                 Xa
'               CDi  ,   CDj  ,  CDk                 Ya
'                Ni  ,    Nj  ,   Nk                 Za
'             ——————————————————————————————————————————————
'   Position of circle centre in absolute axis system
         X_centre = Xa + (X2e * ABi) + (Y2e * CDi) + (Z2e * Ni)
         Y_centre = Ya + (X2e * ABj) + (Y2e * CDj) + (Z2e * Nj)
         Z_centre = Za + (X2e * ABk) + (Y2e * CDk) + (Z2e * Nk)
'   ———————————————————————————————————————————————————————————————————
                    Cells(1, 1) = "Radius    =": Cells(1, 2) = R
                    Cells(3, 1) = "X_centre  =": Cells(3, 2) = X_centre
                    Cells(4, 1) = "Y_centre  =": Cells(4, 2) = Y_centre
                    Cells(5, 1) = "Z_centre  =": Cells(5, 2) = Z_centre
End Sub
 
Chicopee ... thanks for the attachment too. I think this works, but I think there was an error in Eq 4, to find "R".

Shouldn't that formula be:
T/R = TAN(I/2) ... therefore, R = T / TAN(I/2)?

I plugged these formulas into Excel. When I ran it this way, it seems to come out correct. But let me know if you disagree.

Kapitan .. thanks for that post too ... on occasion, we do have the "3 points on the radius" problem. That will help. In this case, we only have the 2 points on the arc, and the point of intersection of the two tangents at those points.
 
I'm determined to understand this, but my math skills ended with HS.

I drew up a random 3-D Sketch in SW, obtained all the Points, Lengths, & curve data, etc....

then, to check these,

I used Chicopee's method in Excel (and substituting R = T / TAN(I/2) for formula #4 as DrMetal mentions...which worked for me too)

Fine so far. What stumps me is step #6. The formulas all look good and make sense, but how does one put them into the 3 simultaneous equations to solve for x4,y4,z4 ?


abs(R) = (x1-x4)^2 + (y1-y4)^2 + (z1-z4)^2 and
abs(R) = (x2-x4)^2 + (y2-y4)^2 + (z2-z4)^2

abs(V) = abs(R)^2 + abs(T)^2
abs(V) = (x3-x4)^2 + (y3-y4)^2 + (z3-z4)^2

how is all this set up in Excel ?
 
let me preface this post by saying i haven't read chicopee's post.

the solution is (i think) very simple
given two points of tangency of an arc, and
given the point of intersection of these two tangents, then

two point form of a line (see wiki) gives you the equation of the tangents,
the two radii are normal to the tangents thru the points of tangency (normal to a line, slope/point form of a line, see wiki)
the center of the arc is the intersection of the two radii
the length of the radius is the distance from a point of tangency to the centre
 
Williedawg,
- I have not finished going thru all this to solve for the circle center. But I believe the answer is here. I have an Excel SS set up to solve for Xc,Yc in 2D ... using 3 simulataneous equations, it works fine to solve for the 2 points (Xc,Yc) ... so I assumed I need 4 equations for the 3D points. But my math is a bit rusty too ... so I am still working on it ... just have not had the time yet.
The first 3 eq are easy:
Eq1: (X1-Xc)^2 + (Y1-Yc)^2 + (Z1-Zc)^2 = R^2
Eq1: (X2-Xc)^2 + (Y2-Yc)^2 + (Z2-Zc)^2 = R^2
Eq1: (X3-Xc)^2 + (Y3-Yc)^2 + (Z3-Zc)^2 = R^2
for ALL 3 points ON THE RADIUS
or
Eq2: (X2-Xc)^2 + (Y2-Yc)^2 + (Z2-Zc)^2 = V^2
for the Point of Intersection not on the radius

- We've already solved for R and V, so it looks easy, but when I try to solve for Xc, Yc, Zc, using only 3 equations, the math just runs me in circles and does not lead me to a solution.

- It's the lack of a 4th equation that is stumping me. I think we may have the answer in this thread, I just have not had time to do it. With 4 equations, you can solve for two variables 1st , then solve again for the one of these two variables in terms of the 2nd, and plug back in for the value of the 1st, and so on.

- What might also help would be to find the XYZ coordinates of the point of intersection of the circle arc and the bisector line between the line of POI (Point of Intersection of the 2 tangents) to the circle center. That would give a 3rd point on the arc too and might make it easier. But I have not looked at this yet.
 
intriguing ... how do you relate V (the distance from the centre to the intersection of the tangents) to R (the radius) ... you can do it, it's just that it's way more complicated than you need to be, IHMO.

i'll assume you didn't (couldn't?) follow my solution ...
 
RB,
- I thought that since we can solve for R and V, that the numbers could be used in the simultaneous equations to find the center point coordinates, but maybe not. Again, maybe my rusty math at work. I still haven't been able to put the solution together yet. Some related to time to work on this, but I don't see it clearly spelled out here.

- BTW ... is solving a set of simultaneus equations identical to solving similar problems using Cramers rule or similar?
 
Status
Not open for further replies.
Back
Top