[osg-users] transforming between coordinate systems of two subgraph

Glenn Waldron gwaldron at gmail.com
Thu Jul 16 09:43:29 PDT 2015


NP. One more thing I forgot to mention. Convert coordB to a osg::Vec3d
first. Otherwise you risk losing precision. (Because geometry coords are
32-bit float, while transform matrices are 64-bit double.)

Glenn Waldron / @glennwaldron

On Thu, Jul 16, 2015 at 12:36 PM, Christian Buchner <
christian.buchner at gmail.com> wrote:

> Hi,
>
> thanks a lot. Now that I've got the solution in front of me, I must
> say.... that was obvious ;)
>
> Christian
>
>
> 2015-07-16 17:35 GMT+02:00 Glenn Waldron <gwaldron at gmail.com>:
>
>> coordA = (coordB * matrixTransformB->getMatrix()) * matrixTransformA
>> ->getMatrix().inverse();
>>
>>
>>
>> Glenn Waldron / @glennwaldron
>>
>> On Thu, Jul 16, 2015 at 11:23 AM, Christian Buchner <
>> christian.buchner at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I was having some problems with a coordinate transformation.
>>>
>>> root
>>> matrixTransformA      matrixTransformB
>>> subgraphA                subgraph B
>>>
>>> I have two subgraphs in my scene, each of which is a child of a unique
>>> MatrixTransform.
>>>
>>> I now have to draw a line between an element from subgraph A to connect
>>> to an element of subgraph B. I've decided to add this line into subgraphA
>>> as a drawable - so both start and end point of this line have to be
>>> specified in my "A" coordinate system.
>>>
>>> How would I transform a coordinate from subgraph B coordinate system
>>> into the equivalent
>>> coordinate valid within subgraph A, ideally using utility functions
>>> provided by the OSG framework ? I would like to do that with minimal amount
>>> of code.
>>>
>>> Excuse me for asking a basic linear algebra question, but I seem to be
>>> stuck for good on this problem.
>>>
>>> Christian
>>>
>>>
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users at lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
> _______________________________________________
> 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/20150716/43c82ab3/attachment-0003.htm>


More information about the osg-users mailing list