Re: draw spheres in 3D space [message #76488] |
Mon, 06 June 2011 21:26 |
Junum
Messages: 13 Registered: May 2010
|
Junior Member |
|
|
On Jun 6, 6:15 pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On Jun 6, 4:19 pm, David Fanning <n...@idlcoyote.com> wrote:
>
>> Paulo Penteado writes:
>>> xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
>>> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
>>> undocumented,linestyle='none')
>
>> I admit that's pretty cool. But what does a "radius
>> of one" mean in this context? For example, here are
>> orb objects with a radius of 5, but clearly this
>> radius has nothing whatsoever to do with the axes:
>
>> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*], $
>> sym_object=orb(radius=5),/ undocumented,$
>> linestyle='none')
>
> Yes, I had not noticed that a "hard" radius was intended. Those sizes
> are unrelated to the data space because the spheres are taken as plot
> symbols, and as such have "soft" sizes. You can see that if you change
> the size of the window: the symbols will remain the same size, while
> the axes will change.
>
> Borrowing from Mike's example, this could be done with iplot
> (similarly with plot3d()) by making a bunch o spheres with the proper
> sizes and positions in a model, then putting that model into the
> plot's data space:
>
> xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
> model = obj_new('IDLgrModel')
> for i=0,6 do model->add,obj_new('orb',pos=xyz[*,i],radius=1.,color=[255, 215, 0])
>
> iplot,xyz,/scale_isotropic,/scatter,sym_index=0
> id=itgetcurrent(tool=ot)
> oplot3d=ot->getbyidentifier(ot->findidentifiers('*/PLOT3D',/
> visualization))
> oplot3d->add,model
Thank very much Paulo.
It helps me a lot.
Jun
|
|
|
Re: draw spheres in 3D space [message #76489 is a reply to message #76488] |
Mon, 06 June 2011 16:15  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Jun 6, 4:19 pm, David Fanning <n...@idlcoyote.com> wrote:
> Paulo Penteado writes:
>> xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
>> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
>> undocumented,linestyle='none')
>
> I admit that's pretty cool. But what does a "radius
> of one" mean in this context? For example, here are
> orb objects with a radius of 5, but clearly this
> radius has nothing whatsoever to do with the axes:
>
> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*], $
> sym_object=orb(radius=5),/ undocumented,$
> linestyle='none')
Yes, I had not noticed that a "hard" radius was intended. Those sizes
are unrelated to the data space because the spheres are taken as plot
symbols, and as such have "soft" sizes. You can see that if you change
the size of the window: the symbols will remain the same size, while
the axes will change.
Borrowing from Mike's example, this could be done with iplot
(similarly with plot3d()) by making a bunch o spheres with the proper
sizes and positions in a model, then putting that model into the
plot's data space:
xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
model = obj_new('IDLgrModel')
for i=0,6 do model-
> add,obj_new('orb',pos=xyz[*,i],radius=1.,color=[255, 215, 0])
iplot,xyz,/scale_isotropic,/scatter,sym_index=0
id=itgetcurrent(tool=ot)
oplot3d=ot->getbyidentifier(ot->findidentifiers('*/PLOT3D',/
visualization))
oplot3d->add,model
|
|
|
Re: draw spheres in 3D space [message #76496 is a reply to message #76489] |
Mon, 06 June 2011 12:40  |
Junum
Messages: 13 Registered: May 2010
|
Junior Member |
|
|
On Jun 6, 2:26 pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On Jun 6, 4:14 pm, Junum <junshi...@gmail.com> wrote:
>
>> Thank you for suggestion, but I got error message,
>
>> IDL> xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
>> IDL> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
>> undocumented,linestyle='none')
>
>> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
>> undocumented,linestyle='none')
>> ^
>> % Syntax error.
>
>> I am using IDL 7.0.
>
> That will not work in 7.0. This will:
>
> xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
> orb=obj_new('orb')
> iplot,xyz,/scatter,sym_object=orb
Dear Paulo Penteado
Thank you for your help.
Now I don't have any problem, except symbols are too small.
I can change symbol size manually, but what I wanted is seven spheres
attached, so I specified size and center of spheres.
Can I specify the size of sphere?
Thank you.
Jun
|
|
|
Re: draw spheres in 3D space [message #76497 is a reply to message #76496] |
Mon, 06 June 2011 12:31  |
Junum
Messages: 13 Registered: May 2010
|
Junior Member |
|
|
On Jun 6, 2:21 pm, Michael Galloy <mgal...@gmail.com> wrote:
> On 6/6/11 1:14 PM, Junum wrote:
>
>
>
>
>
>> On Jun 6, 2:03 pm, Paulo Penteado<pp.pente...@gmail.com> wrote:
>>> On Jun 6, 3:53 pm, Junum<junshi...@gmail.com> wrote:
>
>>>> On Jun 6, 1:50 pm, Junum<junshi...@gmail.com> wrote:
>
>>>> > Hello,
>
>>>> > I wan to know how to draw spheres in 3D space with xyz axes.
>>>> > For example, I have 7 spheres with radius of 1 and its center is at
>>>> > (0,0,0)
>>>> > (2,0,0)
>>>> > (-2,0,0)
>>>> > (0,2,0)
>>>> > (0,-2,0)
>>>> > (0,0,2)
>>>> > (0,0,-1).
>>>> > Since I don't have idea for 3D drawing, it is hard to start.
>>>> > Could you let me know any clue, help, suggestion?
>>>> > Thank you very much.
>
>>>> > Sincerely,
>>>> > Jun
>
>>>> There was a typo.
>>>> A center of the last sphere should be (0,0,-2).
>
>>>> Jun
>
>>> xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
>>> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
>>> undocumented,linestyle='none')
>
>> Thank you for suggestion, but I got error message,
>
>> IDL> xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0, 0,-2]]
>> IDL> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
>> undocumented,linestyle='none')
>
>> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
>> undocumented,linestyle='none')
>> ^
>> % Syntax error.
>
>> I am using IDL 7.0.
>
> This should work on older versions of IDL:
>
> model = obj_new('IDLgrModel')
> model->add, obj_new('orb', pos=[ 0, 0, 0], radius=1., color=[255, 215, 0])
> model->add, obj_new('orb', pos=[ 2, 0, 0], radius=1., color=[255, 215, 0])
> model->add, obj_new('orb', pos=[-2, 0, 0], radius=1., color=[255, 215, 0])
> model->add, obj_new('orb', pos=[ 0, 2, 0], radius=1., color=[255, 215, 0])
> model->add, obj_new('orb', pos=[ 0,-2, 0], radius=1., color=[255, 215, 0])
> model->add, obj_new('orb', pos=[ 0, 0, 2], radius=1., color=[255, 215, 0])
> model->add, obj_new('orb', pos=[ 0, 0,-2], radius=1., color=[255, 215, 0])
>
> xobjview, model
>
> Mike
> --
> Michael Galloywww.michaelgalloy.com
> Modern IDL, A Guide to Learning IDL:http://modernidl.idldev.com
> Research Mathematician
> Tech-X Corporation
Thank you very much for help.
It is really cool.
How can I add xyz axes on this plot?
Thank you.
Jun
|
|
|
Re: draw spheres in 3D space [message #76498 is a reply to message #76497] |
Mon, 06 June 2011 12:26  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Jun 6, 4:14 pm, Junum <junshi...@gmail.com> wrote:
> Thank you for suggestion, but I got error message,
>
> IDL> xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
> IDL> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
> undocumented,linestyle='none')
>
> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
> undocumented,linestyle='none')
> ^
> % Syntax error.
>
> I am using IDL 7.0.
That will not work in 7.0. This will:
xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
orb=obj_new('orb')
iplot,xyz,/scatter,sym_object=orb
|
|
|
Re: draw spheres in 3D space [message #76499 is a reply to message #76498] |
Mon, 06 June 2011 12:21  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 6/6/11 1:14 PM, Junum wrote:
> On Jun 6, 2:03 pm, Paulo Penteado<pp.pente...@gmail.com> wrote:
>> On Jun 6, 3:53 pm, Junum<junshi...@gmail.com> wrote:
>>
>>
>>
>>
>>
>>> On Jun 6, 1:50 pm, Junum<junshi...@gmail.com> wrote:
>>
>>>> Hello,
>>
>>>> I wan to know how to draw spheres in 3D space with xyz axes.
>>>> For example, I have 7 spheres with radius of 1 and its center is at
>>>> (0,0,0)
>>>> (2,0,0)
>>>> (-2,0,0)
>>>> (0,2,0)
>>>> (0,-2,0)
>>>> (0,0,2)
>>>> (0,0,-1).
>>>> Since I don't have idea for 3D drawing, it is hard to start.
>>>> Could you let me know any clue, help, suggestion?
>>>> Thank you very much.
>>
>>>> Sincerely,
>>>> Jun
>>
>>> There was a typo.
>>> A center of the last sphere should be (0,0,-2).
>>
>>> Jun
>>
>> xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
>> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
>> undocumented,linestyle='none')
>
> Thank you for suggestion, but I got error message,
>
> IDL> xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
> IDL> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
> undocumented,linestyle='none')
>
> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
> undocumented,linestyle='none')
> ^
> % Syntax error.
>
> I am using IDL 7.0.
This should work on older versions of IDL:
model = obj_new('IDLgrModel')
model->add, obj_new('orb', pos=[ 0, 0, 0], radius=1., color=[255, 215, 0])
model->add, obj_new('orb', pos=[ 2, 0, 0], radius=1., color=[255, 215, 0])
model->add, obj_new('orb', pos=[-2, 0, 0], radius=1., color=[255, 215, 0])
model->add, obj_new('orb', pos=[ 0, 2, 0], radius=1., color=[255, 215, 0])
model->add, obj_new('orb', pos=[ 0,-2, 0], radius=1., color=[255, 215, 0])
model->add, obj_new('orb', pos=[ 0, 0, 2], radius=1., color=[255, 215, 0])
model->add, obj_new('orb', pos=[ 0, 0,-2], radius=1., color=[255, 215, 0])
xobjview, model
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
|
|
|
Re: draw spheres in 3D space [message #76500 is a reply to message #76499] |
Mon, 06 June 2011 12:19  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paulo Penteado writes:
> xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
> undocumented,linestyle='none')
I admit that's pretty cool. But what does a "radius
of one" mean in this context? For example, here are
orb objects with a radius of 5, but clearly this
radius has nothing whatsoever to do with the axes:
p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*], $
sym_object=orb(radius=5),/ undocumented,$
linestyle='none')
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: draw spheres in 3D space [message #76501 is a reply to message #76500] |
Mon, 06 June 2011 12:14  |
Junum
Messages: 13 Registered: May 2010
|
Junior Member |
|
|
On Jun 6, 2:03 pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On Jun 6, 3:53 pm, Junum <junshi...@gmail.com> wrote:
>
>
>
>
>
>> On Jun 6, 1:50 pm, Junum <junshi...@gmail.com> wrote:
>
>>> Hello,
>
>>> I wan to know how to draw spheres in 3D space with xyz axes.
>>> For example, I have 7 spheres with radius of 1 and its center is at
>>> (0,0,0)
>>> (2,0,0)
>>> (-2,0,0)
>>> (0,2,0)
>>> (0,-2,0)
>>> (0,0,2)
>>> (0,0,-1).
>>> Since I don't have idea for 3D drawing, it is hard to start.
>>> Could you let me know any clue, help, suggestion?
>>> Thank you very much.
>
>>> Sincerely,
>>> Jun
>
>> There was a typo.
>> A center of the last sphere should be (0,0,-2).
>
>> Jun
>
> xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
> undocumented,linestyle='none')
Thank you for suggestion, but I got error message,
IDL> xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
IDL> p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
undocumented,linestyle='none')
p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
undocumented,linestyle='none')
^
% Syntax error.
I am using IDL 7.0.
|
|
|
Re: draw spheres in 3D space [message #76502 is a reply to message #76501] |
Mon, 06 June 2011 12:03  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Jun 6, 3:53 pm, Junum <junshi...@gmail.com> wrote:
> On Jun 6, 1:50 pm, Junum <junshi...@gmail.com> wrote:
>
>
>
>
>
>> Hello,
>
>> I wan to know how to draw spheres in 3D space with xyz axes.
>> For example, I have 7 spheres with radius of 1 and its center is at
>> (0,0,0)
>> (2,0,0)
>> (-2,0,0)
>> (0,2,0)
>> (0,-2,0)
>> (0,0,2)
>> (0,0,-1).
>> Since I don't have idea for 3D drawing, it is hard to start.
>> Could you let me know any clue, help, suggestion?
>> Thank you very much.
>
>> Sincerely,
>> Jun
>
> There was a typo.
> A center of the last sphere should be (0,0,-2).
>
> Jun
xyz=[[0,0,0],[2,0,0],[-2,0,0],[0,2,0],[0,-2,0],[0,0,2],[0,0, -2]]
p=plot3d(xyz[0,*],xyz[1,*],xyz[2,*],sym_object=orb(),/
undocumented,linestyle='none')
|
|
|
Re: draw spheres in 3D space [message #76503 is a reply to message #76502] |
Mon, 06 June 2011 11:53  |
Junum
Messages: 13 Registered: May 2010
|
Junior Member |
|
|
On Jun 6, 1:50 pm, Junum <junshi...@gmail.com> wrote:
> Hello,
>
> I wan to know how to draw spheres in 3D space with xyz axes.
> For example, I have 7 spheres with radius of 1 and its center is at
> (0,0,0)
> (2,0,0)
> (-2,0,0)
> (0,2,0)
> (0,-2,0)
> (0,0,2)
> (0,0,-1).
> Since I don't have idea for 3D drawing, it is hard to start.
> Could you let me know any clue, help, suggestion?
> Thank you very much.
>
> Sincerely,
> Jun
There was a typo.
A center of the last sphere should be (0,0,-2).
Jun
|
|
|