|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
stfark1
Joined: 02 Sep 2008 Posts: 227
|
Posted: Sun Oct 27, 2024 1:45 am Post subject: Circle 3D |
|
|
Is there a function available in Silverfrost Fortran to calculate the center and radius of a circle with 3 x,y,z coordinates on the circumference? Sid Kraft |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2600 Location: Sydney
|
Posted: Sun Oct 27, 2024 3:05 am Post subject: |
|
|
Sid,
This is a fairly easy calculation ( which I have not done for many years !)
For the line between two points on the circumference, it can be written as:
l1.x + m1.y + n1 = 0 ( solve for l1,m1,n1) (Function line_between_two_points)
the normal to this line, that passes through the mid point on the line, also goes through the centre of the circle, which is:
m1.x - l1.y + k1 = 0 ( solve for k1 ) (Function line_through_one_point)
similarly for points 2 and 3 (or 1 and 3); solve for l2,m2,n2 then k2
Then find the intersection of lines (m1,-l1,k1) and (m2,-l2,k2), testing for edge conditions, when m1 or m2 are zero. ( the lines can not be parallel ! )
(Function intersect_two_lines)
All you need is the inverse of a 2x2 matrix !
An easy calculation that can be captured in a subroutine |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8082 Location: Salford, UK
|
Posted: Sun Oct 27, 2024 8:44 am Post subject: |
|
|
John
I think that Sid probably means a sphere.
Sid
There is no such function provided but Google AI will tell you how to go about writing your own function. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|