-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nilsson Lars wrote:
| Hi

|
| When I tested airport lighting with OpenSceneGraph, the directional
| light did not work the way I expected.
|
| The light was visible a bit outside the defined sector. Especially for
| the PAPI (Precision Approach Path Indicator),
|
| it is important that the angles are correct.
|
| After rewriting a small piece of code in osgSim/Sector.cpp it seemed to
| work as I wanted.
|
| The change made was in the function computeMatrix() as shown below.
| void DirectionalSector::computeMatrix()
|
| {
|
|   double heading = atan2(_direction[0], _direction[1]);
|
|   double pitch   = atan2(_direction[2], sqrt(_direction[0]*_direction[0]
| + _direction[1]*_direction[1]));
|
|   double roll    = _rollAngle;
|
|
|
|   _local_to_LP = osg::Matrixd::identity();
|   _local_to_LP.preMult(osg::Matrix::rotate(heading, 0.0, 0.0, -1.0));
|   _local_to_LP.preMult(osg::Matrix::rotate(pitch, 1.0, 0.0, 0.0));
|   _local_to_LP.preMult(osg::Matrix::rotate(roll, 0.0, 1.0, 0.0));
|
| }

| I am certainly not sure if this change is correct in all aspects, but it
| solved at least the problem for me.
|
|
|
| Has anyone else discovered similar problem about light points?
I saw this problem in doing exactly the same thing, building a PAPI. I tried to
implement them with two adjacent sectors, but could never get this to work
without some flickering in the transition between the two zones. I too went down
the atan route but eventually found that there was just not enough precision to
do things this way and ended up implementing a custom light point that
transitioned between the two colors. This was a bit painful because the
LightPointDrawable classes are declared in private header files within osgSim; I
had to copy those into my application. yuck.

Tim

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFH4E76eDhWHdXrDRURAvtEAJ9SjCkdzL+wCG8WE62l8w6MIr3xggCg1XFf
nXAg6OhcIJ/vvK46j4P6FIk=
=xeUh
-----END PGP SIGNATURE-----
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to