Hi All,

I've had a look through the mail archives, and I don't think this has been 
asked before, so I was hoping someone might be able give some guidence to me on 
a question I'm bashing my head with at the moment. Its not strictly an osg 
question - though I am using osg to try and solve it.

Question
======

I have a general triangle in 3D space, known coordinates, with known S,T 
texture coordinates. Knowing only this information, is it possible to calculate 
the size of the texture?


Background
========

The background to this problem is that I have an object with texture 
coordinates, that has applied a texture. I now wish to apply a new texture to 
this object where I know the size that this texture is mean't to represent in 
the 3D space. Thus I believe  I need to scale the texture coordinates on the 
object such that the size of the new texture is correctly represented relative 
to the object.

[Brief asside - I suspect that there might be a way to do this other than 
altering all the texture coordinates, perhaps a scale measure on a texture 
object but I haven't delved deep enough into osg::Texture2D to know.]

In order to scale the texture coordinates I need to know the size that the 
original texture represented relative to the object/universe it was in. 

Each geometry could have its own texture, therefore I'm at the geometry level, 
and I have the triangle with the largest variation in the S,T domain.

I can transform this triangle to a cordinate system that is co-planar with the 
triangle, where one edge forms the first of a pair of orthogonal basis vectors 
in the triangle plane (e1,e2), and hence I can represent my triangle in this 
space. 

The S,T domain is coplanar for my requirements, and with a shift of origin, 
(0,0) in the S,T domain maps to (0,0) in the e1,e2 domain. 

So I get to a point where I have the two sets of orthogonal axis in the same 
triangle plane, where a rotation of the e1,e2 axis would align them to the U,V 
axis. 
However, my next step is not clear.

Can any one assist please. I may be barking up the wrong tree here, and if so, 
please accept my apologee.

Thanks  for any help

Neil Hughes.


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to