[Ves] Simple example of using Kiwi/VES

Aashish Chaudhary aashish.chaudhary at kitware.com
Fri Apr 11 12:03:28 EDT 2014


Dear Zhichao,

If you want to  use VES data structures directly, that is possible. Look at
the code below. But also, you can create VTK data structure on the FLY as
well. Have a look at this simple line
example (http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/PolyLine
).

Using VTK might be easier as it is high level vs in VES directly. However,
it may be faster to create it in VES directly.

Hope this helps,
Aashish

vesGeometryData::Ptr geometryData (new vesGeometryData());
    vesSourceDataP3N3C3f::Ptr sourceData(new vesSourceDataP3N3C3f());

    vesVector4f topLeftColor = vesVector4f(1.0f, 0.0f, 0.0f, 1.0f);
    vesVector4f bottomRightColor = vesVector4f(0.0f, 0.0f, 1.0f, 1.0f);
    vesVector4f color = vesVector4f(0.0f, 1.0f, 0.0f, 1.0f);

    // Points.
    vesVertexDataP3N3C3f v1;
    v1.m_position = vesVector3f(-1.0f, -1.0f, 0.0f);
    v1.m_normal = vesVector3f(0.0f, 0.0f, 1.0f);
    v1.m_color = vesVector3f(color[0], color[1], color[2]);

    vesVertexDataP3N3C3f v2;
    v2.m_position = vesVector3f(1.0f, -1.0f, 0.0f);
    v2.m_normal = vesVector3f(0.0f, 0.0f, 1.0f);
    v2.m_color = vesVector3f(bottomRightColor[0], bottomRightColor[1],
bottomRightColor[2]);

    vesVertexDataP3N3C3f v3;
    v3.m_position = vesVector3f(1.0f, 1.0f, 0.0f);
    v3.m_normal = vesVector3f(0.0f, 0.0f, 1.0f);
    v3.m_color = vesVector3f(color[0], color[1], color[2]);

    vesVertexDataP3N3C3f v4;
    v4.m_position = vesVector3f(-1.0f, 1.0f, 0.0f);
    v4.m_normal = vesVector3f(0.0f, 0.0f, 1.0f);
    v4.m_color = vesVector3f(topLeftColor[0], topLeftColor[1],
topLeftColor[2]);

    sourceData->pushBack(v1);
    sourceData->pushBack(v2);
    sourceData->pushBack(v3);
    sourceData->pushBack(v4);

    // Triangle cells.
    vesPrimitive::Ptr triangles (new vesPrimitive());
    vesSharedPtr< vesIndices<unsigned short> > indices (new
vesIndices<unsigned short>());
    indices->pushBackIndices(0, 3, 2);
    indices->pushBackIndices(1, 0, 2);
    triangles->setVesIndices(indices);
    triangles->setPrimitiveType(vesPrimitiveRenderType::Triangles);
    triangles->setIndexCount(3);

triangles->setIndicesValueType(vesPrimitiveIndicesValueType::UnsignedShort);

    geometryData->setName("PlaneGeometryData");
    geometryData->addSource(sourceData);
    geometryData->addPrimitive(triangles);
    return geometryData;



On Fri, Apr 11, 2014 at 11:50 AM, Zhichao Hong <zhichao.hong at gmail.com>wrote:

> I am trying to prototype a 3D project on android and iOS related to some
> scientific visualization.  It involves some matrix calculation to derive a
> 3D spherical geometric model.  The software will draw the sphere with user
> provided input parameters.  The sphere is generated on the fly and it
> cannot be loaded from a static file.  In VTK, it is very simple to use the
> mapper and actors.  How do I do it in VES?
>
> Thanks for the follow up.
>
> Zhichao Hong, CSDP
> zhichao.hong at computer.org
>
>
> On Fri, Apr 11, 2014 at 10:20 AM, Aashish Chaudhary <
> aashish.chaudhary at kitware.com> wrote:
>
>>
>>
>>
>> On Fri, Apr 11, 2014 at 11:15 AM, Zhichao Hong <zhichao.hong at gmail.com>wrote:
>>
>>> I have played with both KiwiSimple and KiwiViewer.  But I am still
>>> looking for an iOS and/or Android example that can show how to make simpler
>>> task happen such as draw a sphere surface using ves directly.
>>>
>>
>> Do you mean VES rendering library and not via Kiwi? We have KiwiSimple in
>> the source code that should help.
>>
>>
>>> The loadDataset is nice.  However, it only supports loading the data
>>> from a file (vtk, stl, etc).  Is there a way to draw a shape directly from
>>> the memory?
>>>
>>
>> We don't have a example for that but if you have a reader that can read
>> from the memory, then I don't think that would be hard. What is your use
>> case?
>>
>> Thanks,
>>
>>
>>>
>>> Any hint will be appreciated!
>>>
>>> Zhichao Hong, CSDP
>>> zhichao.hong at computer.org
>>>
>>> _______________________________________________
>>> Ves mailing list
>>> Ves at public.kitware.com
>>> http://public.kitware.com/cgi-bin/mailman/listinfo/ves
>>>
>>>
>>
>>
>> --
>> | Aashish Chaudhary
>> | R&D Engineer
>> | Kitware Inc.
>> | www.kitware.com
>>
>
>


-- 
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ves/attachments/20140411/a1bf1fc0/attachment-0003.html>


More information about the Ves mailing list