Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Need Help

Subject: Need Help

From: Rahul Uk

Date: 19 May, 2008 05:06:01

Message: 1 of 29

How to find the center, radius of a circle(3D) given 3
points say (a,b,c),(a1,b1,c1),(a2,b2,c2)???

Subject: Re: Need Help

From: helper

Date: 19 May, 2008 05:58:01

Message: 2 of 29

"Rahul Uk" <rauluk23mj@gmail.com> wrote in message
<g0r1rp$cr2$1@fred.mathworks.com>...
> How to find the center, radius of a circle(3D) given 3
> points say (a,b,c),(a1,b1,c1),(a2,b2,c2)???

Considering that this is homework, it might be useful to
post what you have already tried. This way we can help you
learn rather than just hand you answers.


Subject: Re: Need Help

From: Rahul Uk

Date: 19 May, 2008 06:32:01

Message: 3 of 29

"helper " <spamless@nospam.com> wrote in message
<g0r4t9$59p$1@fred.mathworks.com>...
> "Rahul Uk" <rauluk23mj@gmail.com> wrote in message
> <g0r1rp$cr2$1@fred.mathworks.com>...
> > How to find the center, radius of a circle(3D) given 3
> > points say (a,b,c),(a1,b1,c1),(a2,b2,c2)???
>
> Considering that this is homework, it might be useful to
> post what you have already tried. This way we can help you
> learn rather than just hand you answers.
>
>
What I thought of doing is to transform the axis in such a
way that the z axis becomes perpendicular to the new axis
and we are able to use the plane so obtained to draw the circle.

Subject: Re: Need Help

From: Ashwini Deshpande

Date: 19 May, 2008 06:33:01

Message: 4 of 29

"Rahul Uk" <rauluk23mj@gmail.com> wrote in message
<g0r1rp$cr2$1@fred.mathworks.com>...
> How to find the center, radius of a circle(3D) given 3
> points say (a,b,c),(a1,b1,c1),(a2,b2,c2)???

Hai,

The problem cant be solved with 3 points, but for
given 4 points in 3 dimensional space [(x1,y1,z1) (x2,y2,z2)
(x3,y3,z3) (x4,y4,z4)] the equation of the sphere with these
points on the surface can be calculated by solving the
following determinant.

M = [ x^2 + y^2 + z^2 , x , y , z , 1;
x1^2 + y1^2 + z1^2 , x1 , y1 , z1 , 1;
x2^2 + y2^2 + z2^2 , x2 , y2 , z2 , 1;
x3^2 + y3^2 + z3^2 , x3 , y3 , z3 , 1;
x4^2 + y4^2 + z4^2 , x4 , y4 , z4 , 1; ]

det(M) = 0;

If u equate the determinant of the above matrix, u will get
both radius and center point co-ordinates.

Note:
1. No three combinations of the 4 points can be colinear.
2. All 4 points cannot lie on the same plane (coplanar).

Hope it helps,
Ashwini
 

Subject: Re: Need Help

From: Rahul Uk

Date: 19 May, 2008 06:38:01

Message: 5 of 29

"Ashwini Deshpande" <vd.ashwini@mathworks.com> wrote in
message <g0r6ut$lkg$1@fred.mathworks.com>...
> "Rahul Uk" <rauluk23mj@gmail.com> wrote in message
> <g0r1rp$cr2$1@fred.mathworks.com>...
> > How to find the center, radius of a circle(3D) given 3
> > points say (a,b,c),(a1,b1,c1),(a2,b2,c2)???
>
> Hai,
>
> The problem cant be solved with 3 points, but for
> given 4 points in 3 dimensional space [(x1,y1,z1) (x2,y2,z2)
> (x3,y3,z3) (x4,y4,z4)] the equation of the sphere with these
> points on the surface can be calculated by solving the
> following determinant.
>
> M = [ x^2 + y^2 + z^2 , x , y , z , 1;
> x1^2 + y1^2 + z1^2 , x1 , y1 , z1 , 1;
> x2^2 + y2^2 + z2^2 , x2 , y2 , z2 , 1;
> x3^2 + y3^2 + z3^2 , x3 , y3 , z3 , 1;
> x4^2 + y4^2 + z4^2 , x4 , y4 , z4 , 1; ]
>
> det(M) = 0;
>
> If u equate the determinant of the above matrix, u will get
> both radius and center point co-ordinates.
>
> Note:
> 1. No three combinations of the 4 points can be colinear.
> 2. All 4 points cannot lie on the same plane (coplanar).
>
> Hope it helps,
> Ashwini
>

What I am interested in knowing is about something called 3
dimensional Circle.
The equation, given 3 points.

Subject: Re: Need Help

From: helper

Date: 19 May, 2008 06:49:02

Message: 6 of 29

> What I thought of doing is to transform the axis in such a
> way that the z axis becomes perpendicular to the new axis
> and we are able to use the plane so obtained to draw the
circle.

That will work, but it is unnecessary. Just realize that
all 3 points must be the same distance from the center.
There will only be one point that fits this criteria. The
3 known points along with the 3 dimensions will give you 3
equations on the 3 variables (x,y,z value of the center).
Once you have have the center, determining the radius will
be easy.

Good luck!

Subject: Re: Need Help

From: Rahul Uk

Date: 19 May, 2008 06:58:02

Message: 7 of 29

"helper " <spamless@nospam.com> wrote in message
<g0r7su$27a$1@fred.mathworks.com>...
> > What I thought of doing is to transform the axis in such a
> > way that the z axis becomes perpendicular to the new axis
> > and we are able to use the plane so obtained to draw the
> circle.
>
> That will work, but it is unnecessary. Just realize that
> all 3 points must be the same distance from the center.
> There will only be one point that fits this criteria. The
> 3 known points along with the 3 dimensions will give you 3
> equations on the 3 variables (x,y,z value of the center).
> Once you have have the center, determining the radius will
> be easy.
>
> Good luck!
>
But I find the problem in plotting it.In 3 D matlab plots a
sphere given radius and center.How to get a circle??

Subject: Re: Need Help

From: helper

Date: 19 May, 2008 07:07:01

Message: 8 of 29

"Rahul Uk" <rauluk23mj@gmail.com> wrote in message
<g0r8dq$61q$1@fred.mathworks.com>...
> "helper " <spamless@nospam.com> wrote in message
> <g0r7su$27a$1@fred.mathworks.com>...
> > > What I thought of doing is to transform the axis in
such a
> > > way that the z axis becomes perpendicular to the new
axis
> > > and we are able to use the plane so obtained to draw
the
> > circle.
> >
> > That will work, but it is unnecessary. Just realize
that
> > all 3 points must be the same distance from the
center.
> > There will only be one point that fits this criteria.
The
> > 3 known points along with the 3 dimensions will give
you 3
> > equations on the 3 variables (x,y,z value of the
center).
> > Once you have have the center, determining the radius
will
> > be easy.
> >
> > Good luck!
> >
> But I find the problem in plotting it.In 3 D matlab plots
a
> sphere given radius and center.How to get a circle??

Use the PLOT3 function to plot lines in 3-space.

Subject: Re: Need Help

From: Ashwini Deshpande

Date: 19 May, 2008 07:16:02

Message: 9 of 29

"helper " <spamless@nospam.com> wrote in message
<g0r8ul$ai3$1@fred.mathworks.com>...
> "Rahul Uk" <rauluk23mj@gmail.com> wrote in message
> <g0r8dq$61q$1@fred.mathworks.com>...
> > "helper " <spamless@nospam.com> wrote in message
> > <g0r7su$27a$1@fred.mathworks.com>...
> > > > What I thought of doing is to transform the axis in
> such a
> > > > way that the z axis becomes perpendicular to the new
> axis
> > > > and we are able to use the plane so obtained to draw
> the
> > > circle.
> > >
> > > That will work, but it is unnecessary. Just realize
> that
> > > all 3 points must be the same distance from the
> center.
> > > There will only be one point that fits this criteria.
> The
> > > 3 known points along with the 3 dimensions will give
> you 3
> > > equations on the 3 variables (x,y,z value of the
> center).
> > > Once you have have the center, determining the radius
> will
> > > be easy.
> > >
> > > Good luck!
> > >
> > But I find the problem in plotting it.In 3 D matlab plots
> a
> > sphere given radius and center.How to get a circle??
>
> Use the PLOT3 function to plot lines in 3-space.


http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8664&objectType=file

have a look at the link,
that may help u

Subject: Re: Need Help

From: Yumnam Kirani Singh

Date: 19 May, 2008 07:14:12

Message: 10 of 29

There may be infinite number of circles you can draw with three points in three dimensional space. The question is then which circle to choose? The following website may help you in understanding the topic.
http://www.geocities.com/kiranisingh/center.html

Subject: Re: Need Help

From: Roger Stafford

Date: 19 May, 2008 07:54:01

Message: 11 of 29

"Rahul Uk" <rauluk23mj@gmail.com> wrote in message <g0r1rp$cr2
$1@fred.mathworks.com>...
> How to find the center, radius of a circle(3D) given 3
> points say (a,b,c),(a1,b1,c1),(a2,b2,c2)???
-----------------------------
  Rahul, you are right. Provided they are not colinear, it takes just three, not
four, points to uniquely define a circle, even in three dimensions. However,
in three dimensions you will not find the circle's center simply by finding
points that are equidistant from those three points. Any point along a certain
infinitely long line would have that property.

  Without giving you the solution explicitly, I will tell you the approach I would
take to find it. Any three non-colinear points determine a plane, so first you
should endeavor to find the equation of that plane. It will be a single linear
equation in x, y, and z. If A, B, and C are the given points, one method of
finding this equation is to take the cross product of vector AB with vector AC,
which will define the direction orthogonal to the plane in question. This,
combined with the fact that the plane must contain any of the three points,
suffices to find its equation.

  Next you find the plane which bisects line segment AB. This is obtained by
equating the square of the distance from a point (x,y,z) to A with that from B.
When simplified this will also be a linear equation. Finally do the same thing
with segment AC and you then have the equation of the bisector of AC.

  These three planes intersect in a unique point which will be the center of the
desired circle, so if you find their equations' simultaneous solution, you have
the center and are well on your way to a solution of your problem.

  Does that give you a start on the problem?

Roger Stafford

Subject: Re: Need Help

From: helper

Date: 19 May, 2008 08:01:03

Message: 12 of 29

> Rahul, you are right. Provided they are not colinear,
it takes just three, not
> four, points to uniquely define a circle, even in three
dimensions. However,
> in three dimensions you will not find the circle's center
simply by finding
> points that are equidistant from those three points. Any
point along a certain
> infinitely long line would have that property.

Ugh. You always catch my erroneous posts Roger!

Subject: Re: Need Help

From: Roger Stafford

Date: 19 May, 2008 08:09:02

Message: 13 of 29

Yumnam Kirani Singh <kirani.singh@gmail.com> wrote in message
<14663209.1211181283308.JavaMail.jakarta@nitrogen.mathforum.org>...
> There may be infinite number of circles you can draw with three points in
three dimensional space. The question is then which circle to choose? The
following website may help you in understanding the topic.
> http://www.geocities.com/kiranisingh/center.html
---------
  No, I disagree with that, Yumnam. There are infinitely many points which are
equidistant from the three points, but there is only one circle through them,
assuming they are non-colinear. The points uniquely determine a plane and the
circle must lie in that plane. There can be only one such circle.

Roger Stafford

Subject: Re: Need Help

From: helper

Date: 19 May, 2008 08:14:02

Message: 14 of 29

> Ugh. You always catch my erroneous posts Roger!


Redemption? Would it not be easier to simply find the
intersection of the perpendicular bisectors of AB and AC?

Subject: Re: Need Help

From: Rahul Uk

Date: 19 May, 2008 08:32:02

Message: 15 of 29

Hi Roger,

I am able to get the center and radius thanks to your
method.But I am not able to plot the circle.

Subject: Re: Need Help

From: Rahul Uk

Date: 19 May, 2008 09:00:03

Message: 16 of 29

"Rahul Uk" <rauluk23mj@gmail.com> wrote in message
<g0rdu2$mtf$1@fred.mathworks.com>...
> Hi Roger,
>
> I am able to get the center and radius thanks to your
> method.But I am not able to plot the circle.

I would like to plot the circle in the plane so obtained.

Subject: Re: Need Help

From: Yumnam Kirani Singh

Date: 19 May, 2008 08:53:32

Message: 17 of 29

I wonder to read your comments. Isn't your comment self contrasting? don't you ever think thant any three equidistant points form a circle? You mention infinate number of such points means nothing but infinite number of circles and infinite number of plaines. Am I seriously wrong?

Subject: Re: Need Help

From: John D'Errico

Date: 19 May, 2008 09:49:02

Message: 18 of 29

Yumnam Kirani Singh <kirani.singh@gmail.com> wrote in message
<29420242.1211187243656.JavaMail.jakarta@nitrogen.mathforum.org>...
> I wonder to read your comments. Isn't your comment self contrasting? don't
you ever think thant any three equidistant points form a circle? You mention
infinate number of such points means nothing but infinite number of circles
and infinite number of plaines. Am I seriously wrong?

Excuse me, but I assume you are commenting
to Roger. (You should quote the person you
are referring to, otherwise an ambiguity occurs.)

You stated this:

"There may be infinite number of circles you can draw with three points in
three dimensional space. The question is then which circle to choose? The
following website may help you in understanding the topic.
http://www.geocities.com/kiranisingh/center.html"

But your statement is incorrect, and if your
website states differently, then it is incorrect
too.

Three general distinct and non-collinear
points determine a unique plane in a 3-d
space. Surely you appreciate this fact.

In that plane, there is a unique circle that
will pass through those three points, again
assuming non-collinearity of the points.

These three points must therefore determine
a unique circle in the space. Why? Any circle
that passes through the three points in R^3
must lie in a plane in that space. Since that
plane must be the same as the one that
contains those three points, then the circle
is itself unique.

John

Subject: Re: Need Help

From: Yumnam Kirani Singh

Date: 19 May, 2008 11:15:20

Message: 19 of 29

If you see the messagebox tree, then definitely, my answer as to Roger. I don't know how does it leads you to confusion. If you specify a plain consisting of three dimensional points, then it is nothing but a two dimensional problems with three cor-ordinates. Any three two dimesional co-ordinates specify an unique circle.

Subject: Re: Need Help

From: Roger Stafford

Date: 19 May, 2008 14:09:01

Message: 20 of 29

Yumnam Kirani Singh <kirani.singh@gmail.com> wrote in message
<29420242.1211187243656.JavaMail.jakarta@nitrogen.mathforum.org>...
> I wonder to read your comments. Isn't your comment self contrasting?
don't you ever think thant any three equidistant points form a circle? You
mention infinate number of such points means nothing but infinite number of
circles and infinite number of plaines. Am I seriously wrong?
----------
Hello Yumnam,

  My remarks were not self-contradictory. There are indeed infinitely many
points which are equidistant from three given points in three-dimensional
space, but only one of them can be considered the center of a circle through
them, namely the one that lies in their plane. In three-dimensional space
there is a distinction between the concept of a circle and that of a sphere. A
circle is required to lie entirely in a plane, whereas a sphere is not. Therefore,
the fact that a point is equidistant from three given points does not prove
that that point is the center of a circle through those three points; it also
must lie in their plane.

  I looked up the website you referenced, and in it your statement is exactly
right. You say, "We can draw infinite number of circles, which can pass
through one or two given points. But if the number of points given is three,
then we can draw only one circle, which will pass through the three given
points. Also, we can draw many spheres, which will pass through any three or
less number of given points. But we can draw only one sphere, which will
pass through any four given points in 3-dimension."

  However, when you stated in this thread, as you did, "There may be infinite
number of circles you can draw with three points in three dimensional space,"
that was definitely incorrect. It contradicts the definition of a circle which
restricts it to a plane.

Roger Stafford

Subject: Re: Need Help

From: Roger Stafford

Date: 19 May, 2008 14:35:03

Message: 21 of 29

"Rahul Uk" <rauluk23mj@gmail.com> wrote in message <g0rfij$eho
$1@fred.mathworks.com>...
> "Rahul Uk" <rauluk23mj@gmail.com> wrote in message
> <g0rdu2$mtf$1@fred.mathworks.com>...
> > Hi Roger,
> >
> > I am able to get the center and radius thanks to your
> > method.But I am not able to plot the circle.
>
> I would like to plot the circle in the plane so obtained.
----------------
  Rahul, as to actually making the circular plot, I will give you an additional bit
of help. What you need is a parametric representation of the circle. If you
possess two orthogonal vectors pointing from the circle's center to its
circumference, you can express any other vector pointing from the center to
that circumference as one of these vectors times the cosine of an angle plus
the other vector times the sine of the angle. This angle, as it varies from 0 to
2*pi, constitutes your parameter.

  You already have one of these vectors, namely a vector from the center, (call
it P) which you have found, to the point A (referring to the terminology in my
previous post.) You also have a vector orthogonal to the circle's plane from
the cross product of AB with AC. Suppose you normalize that orthogonal
vector by dividing it by its norm. Then the cross product of that with PA gives
you another vector orthogonal to PA and also extending from P to a point on
the circle's circumference. Hence this is your second needed vector.

  If you do a 'linspace' on the above angle, you should be able to use 'plot3',
as already mentioned, to then draw the circle. End of hint.

Roger Stafford

Subject: Re: Need Help

From: John D'Errico

Date: 20 May, 2008 01:30:57

Message: 22 of 29

In article <8057003.1211195750855.JavaMail.jakarta@nitrogen.mathforum.org>, Yumnam Kirani Singh <kirani.singh@gmail.com> wrote:

> If you see the messagebox tree, then definitely, my answer as to Roger.

No, what you do not realize is that not
everybody uses the same newsgroup browser
as do you. Some such browsers do not
provide that tree structure. So you should
use referential quotes to provide that
information.

John

--
The best material model of a cat is another, or preferably the same, cat.
A. Rosenblueth, Philosophy of Science, 1945

Those who can't laugh at themselves leave the job to others.
Anonymous

Subject: Re: Need Help

From: Rahul Uk

Date: 20 May, 2008 04:28:01

Message: 23 of 29

Hi all,

thanks everyone...i got the method..

Regards
Rahul

Subject: Re: Need Help

From: Rahul Uk

Date: 22 May, 2008 10:12:01

Message: 24 of 29

HI..

the circle is not exactly drawn....through the 3 points.I
used the approach told by Roger.

Please Help

Subject: Re: Need Help

From: Roger Stafford

Date: 22 May, 2008 14:36:01

Message: 25 of 29

"Rahul Uk" <rauluk23mj@gmail.com> wrote in message <g13gth$kct
$1@fred.mathworks.com>...
> HI..
>
> the circle is not exactly drawn....through the 3 points.I
> used the approach told by Roger.
>
> Please Help
------------
Hello Rahul,

  If you can show us what you've done, perhaps one of us can determine why the
circle you've drawn does not go exactly through the three points. Round off
error of course will cause a very small error but that should only amount to one
part in 10^14 or thereabouts. I realize you can't show us your plotting but you
could show the code that leads up to it.

Roger Stafford

Subject: Hints

From: Dr anubhav

Date: 22 May, 2008 15:11:52

Message: 26 of 29

y find centroid of triangle.
then
Solve

Subject: Re: Hints

From: Roger Stafford

Date: 22 May, 2008 16:23:01

Message: 27 of 29

Dr anubhav <poojanubhav2007@gmail.com> wrote in message
<27634102.1211469163224.JavaMail.jakarta@nitrogen.mathforum.org>...
> y find centroid of triangle.
> then
> Solve
---------
  The centroid of the three points is not the same as the center of the circle that
runs through them That would hold true only if the three points formed the
vertices of an equilateral triangle.

Roger Stafford

Subject: Re: Hints

From: Rahul Uk

Date: 23 May, 2008 04:40:17

Message: 28 of 29

Hi,

function B = getcoord(A,L,Phi)
L=L';
L=L(1:3);
L0=L/norm(L);
B=A*cos(Phi)+cross(L0,A)*sin(Phi);
return

This is the function I used to rotate my vector.[Method told
by Roger]
A is the vector if C is the center of the circle and M,N,O
are the 3 points then A is vector CM.
L is the 3 coordinates of the plane where I want the circle.
Phi is the parameter which I change from 0 to 2*pi to draw
the circle.

for q=0:pi/1000:2*pi
p1=getcoord(p,f,q);
plot3(p1(1),p1(2),p1(3),'r*');
hold on
end
this is the loop i used to plot the circle.

The problem is it is plotting the circle with centre as
origin and not C.

Subject: Re: Hints

From: Roger Stafford

Date: 23 May, 2008 06:48:02

Message: 29 of 29

"Rahul Uk" <rauluk23mj@gmail.com> wrote in message <g15hrh$iik
$1@fred.mathworks.com>...
> Hi,
>
> function B = getcoord(A,L,Phi)
> L=L';
> L=L(1:3);
> L0=L/norm(L);
> B=A*cos(Phi)+cross(L0,A)*sin(Phi);
> return
>
> This is the function I used to rotate my vector.[Method told
> by Roger]
> A is the vector if C is the center of the circle and M,N,O
> are the 3 points then A is vector CM.
> L is the 3 coordinates of the plane where I want the circle.
> Phi is the parameter which I change from 0 to 2*pi to draw
> the circle.
>
> for q=0:pi/1000:2*pi
> p1=getcoord(p,f,q);
> plot3(p1(1),p1(2),p1(3),'r*');
> hold on
> end
> this is the loop i used to plot the circle.
>
> The problem is it is plotting the circle with centre as
> origin and not C.
---------
  Apparently L0 is the normalized vector orthogonal to the plane of the
triangle MNO. What's missing here is the offset to the center of the circle.
You need to add vector C to B which points from the origin to the circle's
center.

  If you recall, I said, "If you possess two orthogonal vectors pointing from the
circle's center to its circumference, you can express any other vector pointing
from the center to that circumference as one of these vectors times the
cosine of an angle plus the other vector times the sine of the angle. This
angle, as it varies from 0 to 2*pi, constitutes your parameter."

  The key part of this is the phrase, ".... any other vector pointing from the
center to that circumference ..." To get a vector pointing from the origin to
the circumference, you need to add the vector pointing from the origin to the
center.

Roger Stafford

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
bisection method Saad Badaoui 15 Jul, 2008 08:40:45
fzero Saad Badaoui 15 Jul, 2008 08:40:35
how to discuss questions in the matlab community wenting chen 29 May, 2008 12:23:37
help on wavelet Antonio 28 May, 2008 17:46:54
need help to use quadgk in dblquad Bindubritta 27 May, 2008 23:26:57
help needed Boy-Santhos van der Sterre 27 May, 2008 09:05:48
need help enabling multithread PeterNZ 26 May, 2008 23:30:28
amd matlab installation John Oke 24 May, 2008 00:00:45
mex fortran fortran compiler Narendra Londhe 23 May, 2008 13:22:15
mex fortran Narendra Londhe 23 May, 2008 13:21:26
homework helper 19 May, 2008 02:00:12
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics