[vtkusers] [VTK] Building a custom oriented arrow
Bill Lorensen
bill.lorensen at gmail.com
Fri May 2 11:26:26 EDT 2014
Jon,
Here is code that creates a composite arrow. Notice that all model
manipulation is done in the arrow source's coordinate system.
After a bit of cleanup, I'll add this as a new wiki example.
Bill
On Fri, May 2, 2014 at 9:13 AM, Jon Haitz Legarreta <
jhlegarreta at vicomtech.org> wrote:
> Bill,
> thanks for the suggestion. I'll try to follow the advice and create it
> that way.
>
> On the other hand, D.Doria also pointed some geometry issue; the "middle"
> sphere was to be located at 1/3 from the startPoint, and the right location
> for that is:
>
> midPoint[i] = startPoint[i] + (endPoint[i] - startPoint[i]) /3;
>
> instead of what I was using.
>
> So thanks both of you for having taken some time to help.
>
> Kind regards,
> JON HAITZ
>
>
> On 2 May 2014 15:02, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>
>> This seems a bit too complicated. Think of the "custom" arrow as a single
>> model. Create the model in the original normalized space of the arrow
>> source. "Build" your model components, place them in the space and compose
>> them into a single polydata using the append polydata filter. Then apply
>> the the transforms of the example to the single polydata. Colors can be
>> assigned to the individual components of the custom arrow by setting the
>> cell data of each component.
>>
>> It will take a bit of fiddling to get the initial model correct. But then
>> it should be easily transformable.
>>
>>
>>
>> On Fri, May 2, 2014 at 2:46 AM, Jon Haitz Legarreta <
>> jhlegarreta at vicomtech.org> wrote:
>>
>>> Hi there,
>>> I'm trying to build a custom oriented arrow based upon the OrientedArrow
>>> example [1]. However, I seem not to be doing it right.
>>>
>>> I'm trying to set a sphere in the middle of the arrow, as well as two
>>> orthogonal lines centered at that point.
>>>
>>> The sphere is not located in the middle of the arrow, and the lines,
>>> even if orthogonal do not cross in the center of the sphere.
>>>
>>> I guess it has to do with the transformations (scale and rotation), but
>>> cannot make head or tails of it.
>>>
>>> On the other hand, I cannot guess how to center the point where the
>>> lines cross at the center of the sphere.
>>>
>>> When the arrow's head and base are not random, but defined with some
>>> known values, it seems to work well.
>>>
>>> Attached, the screenshots of the attempt, the version with some known
>>> points (which seems to be OK), and the corresponding .cxx and
>>> CMakeLists.txt.
>>>
>>> Thanks,
>>> JON HAITZ
>>>
>>> [1]
>>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/OrientedArrow
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com
>>
>
>
--
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140502/fe702f87/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CustomArrow.cxx
Type: application/octet-stream
Size: 8025 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140502/fe702f87/attachment.obj>
More information about the vtkusers
mailing list