Sweet, got it working like I hoped. That for the help again!
Jason
moorepants.info
+01 530-601-9791
On Thu, Dec 19, 2013 at 4:04 PM, Roan LaPlante <aestri...@gmail.com> wrote:
> Origin is not what I thought it was. Try 'position' instead of 'origin'.
> Then both of these attributes should work as intended.
>
>
> On Thu, Dec 19, 2013 at 3:31 PM, Jason Moore <moorepa...@gmail.com> wrote:
>
>> The simple wrapper I have looks like:
>>
>> def add_torus(outer_radius, cross_section_radius, center, orientation):
>> torus = mlab.pipeline.parametric_surface()
>> torus.function = 'torus'
>> torus.parametric_function.ring_radius = outer_radius -
>> cross_section_radius
>> torus.parametric_function.cross_section_radius = cross_section_radius
>> mlab.pipeline.surface(torus)
>> torus.children[0].children[0].actor.actor.origin = center
>> torus.children[0].children[0].actor.actor.orientation = orientation
>> return torus
>>
>> When I call this it produces a torus with correct dimensions but the
>> center and orientation seem to have no effect. I don't get access to the
>> .children until after the mlab.pipeline.surface(torus) call. Setting these
>> traits doesn't seem to change them. Any idea what I'm missing?
>>
>>
>> Jason
>> moorepants.info
>> +01 530-601-9791
>>
>>
>> On Mon, Dec 16, 2013 at 5:23 PM, Jason Moore <moorepa...@gmail.com>wrote:
>>
>>> Ok, that will probably work for my case. I may just write a simple
>>> wrapper class that gives me easy access to the .origin and .orientation
>>> attributes.
>>>
>>> I'll use the points3d for the other primitives.
>>>
>>> Thanks.
>>>
>>>
>>> Jason
>>> moorepants.info
>>> +01 530-601-9791
>>>
>>>
>>> On Mon, Dec 16, 2013 at 5:06 PM, Roan LaPlante <aestri...@gmail.com>wrote:
>>>
>>>> The easiest thing to do for cones, spheres, and cylinders is to
>>>> represent them as types of glyphs produced by mlab.points3d. These have
>>>> positional and scale attributes which can easily be modified. Modifying
>>>> their orientation is also possible (i.e. s.actor.actor.orientation) -- but
>>>> will require some additional math translation to get everything aligned
>>>> correctly.
>>>>
>>>> Torii may be a little bit trickier. It may be that the
>>>> ParametricSource is the easiest way to generate a torus and then you can
>>>> find ways to wrap the attributes you need. I'm not sure. If you only need
>>>> to ever adjust them in a gross way with only the parameters you just
>>>> mentioned, the hack of modifying
>>>> s.children[0].children[0].actor.actor.origin (and
>>>> s.chldren[0].children[0].actor.actor.orientation) might be reasonable.
>>>> There also may be some vtk source that somebody has written that does a
>>>> nicer job that you could just use instead.
>>>>
>>>>
>>>> On Mon, Dec 16, 2013 at 4:36 PM, Jason Moore <moorepa...@gmail.com>wrote:
>>>>
>>>>> Sorry, default isn't to reply all on this list.
>>>>>
>>>>> Jason
>>>>> moorepants.info
>>>>> +01 530-601-9791
>>>>>
>>>>>
>>>>> ---------- Forwarded message ----------
>>>>> From: Jason Moore <moorepa...@gmail.com>
>>>>> Date: Mon, Dec 16, 2013 at 4:34 PM
>>>>> Subject: Re: [MayaVi-users] How to transform and rotate parametric
>>>>> surfaces?
>>>>> To: Roan LaPlante <aestri...@gmail.com>
>>>>>
>>>>>
>>>>> I just want a quick way to draw primitives (tori, spheres, cones,
>>>>> cylinders) in a scene with particular dimensions and be able to rotate and
>>>>> translate them with respect to other objects I've created with mlab.mesh.
>>>>>
>>>>> Ideally I'd like something like:
>>>>>
>>>>> torus = mlab.Torus()
>>>>> torus.center = [2., 3., 4.]
>>>>> torus.orientation = [[0.1, 0.1, 0],
>>>>> [0.2, 0.3, 0],
>>>>> [0, 0, 1]]
>>>>> torus.ring_radius = 5.0
>>>>> torus.cross_section_radius = 0.2
>>>>> mlab.show()
>>>>>
>>>>> Does the tvtk or mayavi api offer anything like this?
>>>>>
>>>>>
>>>>>
>>>>> Jason
>>>>> moorepants.info
>>>>> +01 530-601-9791
>>>>>
>>>>>
>>>>> On Mon, Dec 16, 2013 at 4:21 PM, Roan LaPlante <aestri...@gmail.com>wrote:
>>>>>
>>>>>> Hi Jason,
>>>>>>
>>>>>>
>>>>>> What are you trying to do? In general, mayavi does not have
>>>>>> universal and easily manipulable concepts of what space its
>>>>>> visualizations
>>>>>> occupy. Rather, sources occupy some space, and different sources vary
>>>>>> extensively in how easily they are manipulated (mostly because they are
>>>>>> not
>>>>>> very featureful sources in vtk, and all mayavi does is wrap the vtk
>>>>>> source).
>>>>>>
>>>>>> However, in general if you're unsatisfied with the API that mayavi
>>>>>> provides you to work with your visualizations, its almost always possible
>>>>>> to hack these further and effectively do some vtk programming. For
>>>>>> instance, if you wanted to displace this torus in the x,y,z plane, you
>>>>>> could edit the s.children[0].children[0].actor.actor.origin trait.
>>>>>>
>>>>>>
>>>>>> R
>>>>>>
>>>>>>
>>>>>> On Mon, Dec 16, 2013 at 3:19 PM, Jason Moore <moorepa...@gmail.com>wrote:
>>>>>>
>>>>>>> I've created torus like so:
>>>>>>>
>>>>>>> from mayavi import mlab
>>>>>>> s = mlab.pipeline.parametric_surface()
>>>>>>> s.function = 'torus'
>>>>>>>
>>>>>>> And can change it's geometry like:
>>>>>>>
>>>>>>> s.parametric_function.ring_radius = 10.0
>>>>>>>
>>>>>>> But how do I transform and locate the object in the main coordinate
>>>>>>> system? I can't seem to figure this out...
>>>>>>>
>>>>>>> Jason
>>>>>>> moorepants.info
>>>>>>> +01 530-601-9791
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> Rapidly troubleshoot problems before they affect your business. Most
>>>>>>> IT
>>>>>>> organizations don't have a clear picture of how application
>>>>>>> performance
>>>>>>> affects their revenue. With AppDynamics, you get 100% visibility
>>>>>>> into your
>>>>>>> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of
>>>>>>> AppDynamics Pro!
>>>>>>>
>>>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
>>>>>>> _______________________________________________
>>>>>>> MayaVi-users mailing list
>>>>>>> MayaVi-users@lists.sourceforge.net
>>>>>>> https://lists.sourceforge.net/lists/listinfo/mayavi-users
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Rapidly troubleshoot problems before they affect your business. Most IT
>>>>> organizations don't have a clear picture of how application performance
>>>>> affects their revenue. With AppDynamics, you get 100% visibility into
>>>>> your
>>>>> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of
>>>>> AppDynamics Pro!
>>>>>
>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
>>>>> _______________________________________________
>>>>> MayaVi-users mailing list
>>>>> MayaVi-users@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/mayavi-users
>>>>>
>>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
MayaVi-users mailing list
MayaVi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users