Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Generate 3D circle points

Subject: Generate 3D circle points

From: Robert Phillips

Date: 23 Nov, 2010 05:23:03

Message: 1 of 4

I'm trying to generate the x-, y-, and z-coordinates of a smooth circle (in 3D space). I would like the output to mirror the sphere(n) command, where the coordinates are returned in three matrices that are (n+1)-by-(n+1) in size. I plan to use these points as an input argument for the "InPolyhedronTest" function:
<http://www.mathworks.com/matlabcentral/fileexchange/24631>

I will test if these generated points lie within a polyhedron.

I have 3 orthogonal vectors a, b, and c, whose tails all lie at the same point S. These vectors are not aligned with the "global" coordinate system. I wish for the radius of this generated circle to lie in the plane defined by the b and c vectors.

I've searched through the forums and haven't found much that resembles the desired output... Could someone help point me in the right direction?

Subject: Generate 3D circle points

From: Roger Stafford

Date: 23 Nov, 2010 06:32:03

Message: 2 of 4

"Robert Phillips" <phillir1@my.erau.edu> wrote in message <icfj3n$24d$1@fred.mathworks.com>...
> I'm trying to generate the x-, y-, and z-coordinates of a smooth circle (in 3D space). I would like the output to mirror the sphere(n) command, where the coordinates are returned in three matrices that are (n+1)-by-(n+1) in size. I plan to use these points as an input argument for the "InPolyhedronTest" function:
> <http://www.mathworks.com/matlabcentral/fileexchange/24631>
>
> I will test if these generated points lie within a polyhedron.
>
> I have 3 orthogonal vectors a, b, and c, whose tails all lie at the same point S. These vectors are not aligned with the "global" coordinate system. I wish for the radius of this generated circle to lie in the plane defined by the b and c vectors.
> .......
- - - - - - - - - -
  You've used the word 'circle' but your request only makes sense if you are talking about a disk, not a circle. A circle is one-dimensional and it would make no sense creating a two-dimensional array for a one-dimensional object. However a disk which is all points on or interior to a circle can be represented this way.

 Let r0 be the desired radius of the circular periphery of the disk. Then do this:

 t = linspace(0,2*pi,n+1);
 r = linspace(0,r0,n+1);
 [T,R] = meshgrid(t,r);
 b = b/norm(b); c = c/norm(c);
 X = S(1) + R.*cos(T)*b(1) + R.*sin(T)*c(1);
 Y = S(2) + R.*cos(T)*b(2) + R.*sin(T)*c(2);
 Z = S(3) + R.*cos(T)*b(3) + R.*sin(T)*c(3);

This is a mesh of points all lying in the required disk about S.

  To test whether they lie within a polyhedron using 'InPolyedron', you will have to create this array:

 nq = [X(:),Y(:),Z(:)];

which will be (n+1)^2 by 3 in size.

Roger Stafford

Subject: Generate 3D circle points

From: Jacky

Date: 22 May, 2011 06:54:04

Message: 3 of 4

"Roger Stafford" wrote in message <icfn53$of8$1@fred.mathworks.com>...
> "Robert Phillips" <phillir1@my.erau.edu> wrote in message <icfj3n$24d$1@fred.mathworks.com>...
> > I'm trying to generate the x-, y-, and z-coordinates of a smooth circle (in 3D space). I would like the output to mirror the sphere(n) command, where the coordinates are returned in three matrices that are (n+1)-by-(n+1) in size. I plan to use these points as an input argument for the "InPolyhedronTest" function:
> > <http://www.mathworks.com/matlabcentral/fileexchange/24631>
> >
> > I will test if these generated points lie within a polyhedron.
> >
> > I have 3 orthogonal vectors a, b, and c, whose tails all lie at the same point S. These vectors are not aligned with the "global" coordinate system. I wish for the radius of this generated circle to lie in the plane defined by the b and c vectors.
> > .......
> - - - - - - - - - -
> You've used the word 'circle' but your request only makes sense if you are talking about a disk, not a circle. A circle is one-dimensional and it would make no sense creating a two-dimensional array for a one-dimensional object. However a disk which is all points on or interior to a circle can be represented this way.
>
> Let r0 be the desired radius of the circular periphery of the disk. Then do this:
>
> t = linspace(0,2*pi,n+1);
> r = linspace(0,r0,n+1);
> [T,R] = meshgrid(t,r);
> b = b/norm(b); c = c/norm(c);
> X = S(1) + R.*cos(T)*b(1) + R.*sin(T)*c(1);
> Y = S(2) + R.*cos(T)*b(2) + R.*sin(T)*c(2);
> Z = S(3) + R.*cos(T)*b(3) + R.*sin(T)*c(3);
>
> This is a mesh of points all lying in the required disk about S.
>
> To test whether they lie within a polyhedron using 'InPolyedron', you will have to create this array:
>
> nq = [X(:),Y(:),Z(:)];
>
> which will be (n+1)^2 by 3 in size.
>
> Roger Stafford

Hi, I am also trying to generate 3D circle (disk) points in a 100-by-100-by-100 matrix.
Does S represents a center of a disk? what is b and c?
Can i request a example values for S, b and c.

Subject: Generate 3D circle points

From: Jacky

Date: 24 May, 2011 23:04:04

Message: 4 of 4

"Jacky" wrote in message <irabuc$bjl$1@newscl01ah.mathworks.com>...
> "Roger Stafford" wrote in message <icfn53$of8$1@fred.mathworks.com>...
> > "Robert Phillips" <phillir1@my.erau.edu> wrote in message <icfj3n$24d$1@fred.mathworks.com>...
> > > I'm trying to generate the x-, y-, and z-coordinates of a smooth circle (in 3D space). I would like the output to mirror the sphere(n) command, where the coordinates are returned in three matrices that are (n+1)-by-(n+1) in size. I plan to use these points as an input argument for the "InPolyhedronTest" function:
> > > <http://www.mathworks.com/matlabcentral/fileexchange/24631>
> > >
> > > I will test if these generated points lie within a polyhedron.
> > >
> > > I have 3 orthogonal vectors a, b, and c, whose tails all lie at the same point S. These vectors are not aligned with the "global" coordinate system. I wish for the radius of this generated circle to lie in the plane defined by the b and c vectors.
> > > .......
> > - - - - - - - - - -
> > You've used the word 'circle' but your request only makes sense if you are talking about a disk, not a circle. A circle is one-dimensional and it would make no sense creating a two-dimensional array for a one-dimensional object. However a disk which is all points on or interior to a circle can be represented this way.
> >
> > Let r0 be the desired radius of the circular periphery of the disk. Then do this:
> >
> > t = linspace(0,2*pi,n+1);
> > r = linspace(0,r0,n+1);
> > [T,R] = meshgrid(t,r);
> > b = b/norm(b); c = c/norm(c);
> > X = S(1) + R.*cos(T)*b(1) + R.*sin(T)*c(1);
> > Y = S(2) + R.*cos(T)*b(2) + R.*sin(T)*c(2);
> > Z = S(3) + R.*cos(T)*b(3) + R.*sin(T)*c(3);
> >
> > This is a mesh of points all lying in the required disk about S.
> >
> > To test whether they lie within a polyhedron using 'InPolyedron', you will have to create this array:
> >
> > nq = [X(:),Y(:),Z(:)];
> >
> > which will be (n+1)^2 by 3 in size.
> >
> > Roger Stafford
>
> Hi, I am also trying to generate 3D circle (disk) points in a 100-by-100-by-100 matrix.
> Does S represents a center of a disk? what is b and c?
> Can i request a example values for S, b and c.

Please disregard my earlier question. I found the solution.

Tags for this Thread

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.

Contact us