[osg-users] Сell multiplication

Robert Osfield robert.osfield at gmail.com
Tue Apr 14 07:15:54 PDT 2015


Hi Grigory,

Could you explain what you mean by "Crystal Lattice".  Knowing what you are
actually trying to achieve help others guide you in the right direction.

Robert.

On 14 April 2015 at 07:38, Grigory Krivyakin <grisha992 at gmail.com> wrote:

> Hello
>
> I try to create a simple crystal lattice and dont know how make it better.
> I create a original geode cell and use matrix translations:
>
>
> Code:
>
> osg::ref_ptr<osg::Group> root = new osg::Group;
> osg::ref_ptr<osg::Geode> cell = Cell();
>
> osg::ref_ptr<osg::MatrixTransform> transform = new osg::MatrixTransform;
> transform->addChild(cell);
> root->addChild(transform);
>
> for(int i = 0; i < 10; i++) {
>   for(int j=0; j < 10; j++) {
>     for(int k=0; k < 2; k++) {
>       osg::ref_ptr<osg::MatrixTransform> transform = new
> osg::MatrixTransform;
>       transform->setMatrix(osg::Matrix::translate(i*4.0f, j*4.0f, k*4.0f));
>       transform->addChild(cell);
>       root->addChild(transform);
>     }
>   }
> }
>
>
>
>
> this code creates the crystal lattice with 10 periods along axis X and Y,
> and 2 periods along Z, but i think it is bad way, can some one give me some
> advice, how make it right?
>
>
> Sorry for my english. Thank you!
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=63376#63376
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150414/157d01f9/attachment-0003.htm>


More information about the osg-users mailing list