[vtkusers] VTK-JS: How to get Position of actor

Sebastien Jourdain sebastien.jourdain at kitware.com
Fri Oct 20 15:39:02 EDT 2017


Then I believe your dataset is not valid. How did you build it?


On Fri, Oct 20, 2017 at 1:07 PM, Katrin Hartwig <katrin_hartwig at gmx.de>
wrote:

> Hi Sebastian and Logan,
>
> thank you a lot for your help and i apologize for my late answer!
> Unfortunately I still could not solve the problem. I tried both
> suggestions:
> With *actor*.getCenter() I get the default-values (0,0,0) for each actor.
> So I tried to get the information of the dataset as you suggested:
>
>        dataset = mapper.getInputData();
>        bounds = dataset.getBounds();
>
> By doing so I get the following error massage:
> *       "getBounds called on an array with components of 1"*
>
> The output of getBounds remains default because of the error.
>
> As I could not find any solutions yet, I would be grateful for any help!
>
> Thank you
> Katrin
>
> *Gesendet:* Montag, 18. September 2017 um 16:38 Uhr
> *Von:* "Sebastien Jourdain" <sebastien.jourdain at kitware.com>
> *An:* "Katrin Hartwig" <katrin_hartwig at gmx.de>
> *Cc:* vtkusers <vtkusers at vtk.org>
> *Betreff:* Re: [vtkusers] VTK-JS: How to get Position of actor
> Hi Katrin,
>
> The actor position only describe the relative position to the data, that's
> why by default they are always (0,0,0).
> Which means its your source or dataset that has the information about the
> position that you are looking for.
>
> For example to find the bounds of a rendered dataset you can do as follow.
>
> dataset = mapper.getInputData();
> bounds = dataset.getBounds();
>
> // bounds is an array as follow:
> // [ minX, maxX, minY, maxY, minZ, maxZ]
>
> Hope that helps,
>
> Otherwise you can learn more on the basic concepts behind VTK here:
> https://www.vtk.org/vtk-users-guide/
>
> Seb
>
> On Mon, Sep 18, 2017 at 7:31 AM, Katrin Hartwig <katrin_hartwig at gmx.de>
> wrote:
>>
>> Dear all,
>>
>> I am using a visualization of several actors with VTK-js. Unfortunately,
>> when using *actor.getPosition() *I always get [0,0,0] as a result, no
>> matter which actor I checked, although they appear on different positions
>> in my rendering window.
>> How can I get the real positions or centers of the different actors?
>>
>> As I am completely new to VTK-js and I could not find any solutions to my
>> problem, any help would be great!
>>
>> Thank you
>> Katrin
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/
>> opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171020/34f9bf44/attachment.html>


More information about the vtkusers mailing list