|
osgEarth 2.1.1
|
Static Public Member Functions | |
| static osg::Matrixd | createInverseRefFrame (const osg::Vec3d &ecefRefPoint) |
| static void | transformAndLocalize (const osg::Vec3d &input, osg::Vec3d &output, const SpatialReference *srs, const osg::Matrixd &world2local=osg::Matrixd()) |
| static void | transformAndLocalize (const std::vector< osg::Vec3d > &input, osg::Vec3Array *output, const SpatialReference *srs, const osg::Matrixd &world2local=osg::Matrixd()) |
| static void | transformAndGetRotationMatrix (const SpatialReference *input_srs, const osg::Vec3d &input, osg::Vec3d &out_ecef_point, osg::Matrixd &out_rotation) |
| osg::Matrixd ECEF::createInverseRefFrame | ( | const osg::Vec3d & | ecefRefPoint | ) | [static] |
Creates a "localization" matrix for double-precision geocentric coordinates. The matrix is ceneterd at the specified ECEF reference point.
Definition at line 30 of file ECEF.cpp.
{
// convert to geocentric first:
double X = input.x(), Y = input.y(), Z = input.z();
osg::Matrixd localToWorld;
localToWorld.makeTranslate(X,Y,Z);
// normalize X,Y,Z
double inverse_length = 1.0/sqrt(X*X + Y*Y + Z*Z);
X *= inverse_length;
Y *= inverse_length;
Z *= inverse_length;
double length_XY = sqrt(X*X + Y*Y);
double inverse_length_XY = 1.0/length_XY;
// Vx = |(-Y,X,0)|
localToWorld(0,0) = -Y*inverse_length_XY;
localToWorld(0,1) = X*inverse_length_XY;
localToWorld(0,2) = 0.0;
// Vy = /(-Z*X/(sqrt(X*X+Y*Y), -Z*Y/(sqrt(X*X+Y*Y),sqrt(X*X+Y*Y))|
double Vy_x = -Z*X*inverse_length_XY;
double Vy_y = -Z*Y*inverse_length_XY;
double Vy_z = length_XY;
inverse_length = 1.0/sqrt(Vy_x*Vy_x + Vy_y*Vy_y + Vy_z*Vy_z);
localToWorld(1,0) = Vy_x*inverse_length;
localToWorld(1,1) = Vy_y*inverse_length;
localToWorld(1,2) = Vy_z*inverse_length;
// Vz = (X,Y,Z)
localToWorld(2,0) = X;
localToWorld(2,1) = Y;
localToWorld(2,2) = Z;
return localToWorld;
}
Here is the caller graph for this function:| void ECEF::transformAndGetRotationMatrix | ( | const SpatialReference * | input_srs, |
| const osg::Vec3d & | input, | ||
| osg::Vec3d & | out_ecef_point, | ||
| osg::Matrixd & | out_rotation | ||
| ) | [static] |
Transforms a point to ECEF, and at the same time returns a quaternion that rotates the point into the local tangent place at that point.
Definition at line 98 of file ECEF.cpp.
{
osg::Vec3d geod_point;
if ( !srs->isGeographic() )
srs->transform( input, srs->getGeographicSRS(), geod_point );
else
geod_point = input;
const osg::EllipsoidModel* em = srs->getEllipsoid();
em->convertLatLongHeightToXYZ(
osg::DegreesToRadians( geod_point.y() ),
osg::DegreesToRadians( geod_point.x() ),
geod_point.z(),
out_point.x(), out_point.y(), out_point.z() );
em->computeCoordinateFrame(
osg::DegreesToRadians( geod_point.y() ),
osg::DegreesToRadians( geod_point.x() ),
out_rotation );
}
Here is the call graph for this function:
Here is the caller graph for this function:| void ECEF::transformAndLocalize | ( | const std::vector< osg::Vec3d > & | input, |
| osg::Vec3Array * | output, | ||
| const SpatialReference * | srs, | ||
| const osg::Matrixd & | world2local = osg::Matrixd() |
||
| ) | [static] |
Transforms the points in "input" to ECEF coordinates, localizes them with the provided world2local matrix, and puts the result in "output".
Definition at line 83 of file ECEF.cpp.
{
output->reserve( output->size() + input.size() );
for( std::vector<osg::Vec3d>::const_iterator i = input.begin(); i != input.end(); ++i )
{
osg::Vec3d ecef;
srs->transformToECEF( *i, ecef );
output->push_back( ecef * world2local );
}
}
Here is the call graph for this function:| void ECEF::transformAndLocalize | ( | const osg::Vec3d & | input, |
| osg::Vec3d & | output, | ||
| const SpatialReference * | srs, | ||
| const osg::Matrixd & | world2local = osg::Matrixd() |
||
| ) | [static] |
Transforms a point into ECEF coordinates, localizes it with the provided world2local matrix, and puts the result in "output".
Definition at line 71 of file ECEF.cpp.
{
osg::Vec3d ecef;
srs->transformToECEF( input, ecef );
output = ecef * world2local;
}
Here is the call graph for this function:
Here is the caller graph for this function:
1.7.3