[vtkusers] Oriented arrows in vtk.js

Sebastien Jourdain sebastien.jourdain at kitware.com
Wed Aug 22 10:40:50 EDT 2018


I guess we should implement the transform filter, unless you want to edit
the generated polydata in place.

polydata = source.getOutputData();

vtkMatrixBuilder
      .buildFromRadian()
      .translate(1, 2, 4)
      .rotateFromDirections([1, 0, 0], [0.5, 0.25, 0.1])
      .apply(polydata.getPoints().getData());

mapper.setInputData(polydata);
...


On Wed, Aug 22, 2018 at 10:14 AM marf <marvin.huber at basf.com> wrote:

> Hello there, I'm trying to get oriented arrows (meaning an arrow that spans
> from point a to point b) in vtk.js.
>
> I tried following this example but did not get to far
> https://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/OrientedArrow
>
> So what I do right now is trying to pass transformation matrices to my
> actor, it kind of looks like this:
>
> *const arrow = vtkArrowSource.newInstance();
> const arrowMapper = vtk.Rendering.Core.vtkMapper.newInstance({
> scalarVisibility: false });
> arrowMapper.setInputData(arrow.getOutputData());
> const arrowActor = vtk.Rendering.Core.vtkActor.newInstance();
>
> arrowActor.setUserMatrix(matrix);
> arrowActor.setMapper(arrowMapper);
> this.renderer.addActor(arrowActor);*
>
> When I define a rotation matrix and pass it, everything works fine. But
> when
> I try to translate the arrows, all I get is some weird stretched arrow,
> with
> a huge base passing into a tiny head or other stuff.
> My transformation matrix would look like this
> 1, 0, 0, a,
> 0, 1, 0, b,
> 0, 0, 1, c,
> 0, 0, 0, 1
>
> where a, b, c are the values I want to move the arrow by.
>
> Can someone help me please? Maybe even in getting the C-Example translated?
> (There's quite some stuff being used that is not part of vtk.js yet)
>
>
>
> --
> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
> _______________________________________________
> 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:
> https://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180822/dba09abc/attachment.html>


More information about the vtkusers mailing list