Example #1
0
int EXP_LVL9 CSparm7I3 (struct csParm7_ *parm7,double* trgLl,Const double* srcLl)
{
	int status;

	double xx, yy, zz;
	double xyz [3];

	/* Convert the geographic coordinates to geocentric XYZ coordinates. */
	CS_llhToXyz (xyz,srcLl,parm7->trgERad,parm7->trgESqr);

	/* Reverse the scaling and translation. */
	xx = (xyz [XX] - parm7->deltaX) / parm7->scale;
	yy = (xyz [YY] - parm7->deltaY) / parm7->scale;
	zz = (xyz [ZZ] - parm7->deltaZ) / parm7->scale;

	/* Apply the inverse of the rotation matrix by deftly multiply by the
	   transpose of the forward matrix.  This works here as the rotation
	   only matrix is orthogonal. */
	xyz [XX] = parm7->rt11 * xx + parm7->rt21 * yy + parm7->rt31 * zz;
	xyz [YY] = parm7->rt12 * xx + parm7->rt22 * yy + parm7->rt32 * zz;
	xyz [ZZ] = parm7->rt13 * xx + parm7->rt23 * yy + parm7->rt33 * zz;

	/* Convert the new X, Y, and Z back to latitude and longitude.
	   CS_xyzToLlh returns degrees. */
	status = CS_xyzToLlh (trgLl,xyz,parm7->srcERad,parm7->srcESqr);

	/* That's that. */
	return status;
}
Example #2
0
int EXP_LVL9 CSparm7F3 (struct csParm7_ *parm7,double* trgLl,Const double* srcLl)
{
	int status;

	double xx, yy, zz;
	double xyz [3];

	/* Convert the geographic coordinates to geocentric XYZ coordinates. */
	CS_llhToXyz (xyz,srcLl,parm7->srcERad,parm7->srcESqr);

	/* Adjust these cartesian coordinates via the Bursa/Wolf transformation.
	   First we apply the rotation.  This is, essentially, a matrix multiplcation. */
	xx = parm7->rt11 * xyz [XX] + parm7->rt12 * xyz [YY] + parm7->rt13 * xyz [ZZ];
	yy = parm7->rt21 * xyz [XX] + parm7->rt22 * xyz [YY] + parm7->rt23 * xyz [ZZ];
	zz = parm7->rt31 * xyz [XX] + parm7->rt32 * xyz [YY] + parm7->rt33 * xyz [ZZ];

	/* Apply the scale and translation factors. */
	xyz [XX] = parm7->scale * xx + parm7->deltaX;
	xyz [YY] = parm7->scale * yy + parm7->deltaY;
	xyz [ZZ] = parm7->scale * zz + parm7->deltaZ;

	/* Convert the new X, Y, and Z back to latitude and longitude.
	   CS_xyzToLlh returns degrees. */
	status = CS_xyzToLlh (trgLl,xyz,parm7->trgERad,parm7->trgESqr);

	/* That's that. */
	return status;
}
Example #3
0
int EXP_LVL9 CSframeI3 (struct csFrame_ *frame,double* trgLl,Const double* srcLl)
{
	int status;

	double xx, yy, zz;
	double xyz [3];

	/* Convert the geographic coordinates to geocentric XYZ coordinates. */
	CS_llhToXyz (xyz,srcLl,frame->trgERad,frame->trgESqr);

	/* Invert the scaling and translation. */
	xx = (xyz [XX] - frame->deltaX) / frame->scale;
	yy = (xyz [YY] - frame->deltaY) / frame->scale;
	zz = (xyz [ZZ] - frame->deltaZ) / frame->scale;

	/* Apply the inverse of the rotation matrix.  Essentially, this code
	   is equivalent to the multiplication by the transpose of the original
	   rotation matrix.
	   
	   Note that this inverse is only an approximation as is the
	   forward.  A pure rotation matrix is orthogonal and its
	   transpose is equal to its inverse.  However, due to the
	   approximation used in the Frame Wolf transformation, the
	   matrix ix not perfectly orthogonal, and thus the transpose
	   is not the perfect inverse. */
	xyz [XX] =  xx - frame->rotZ * yy + frame->rotY * zz;
	xyz [YY] =  frame->rotZ * xx + yy - frame->rotX * zz;
	xyz [ZZ] = -frame->rotY * xx + frame->rotX * yy + zz;

	/* Convert the new X, Y, and Z back to latitude and longitude. */
	status = CS_xyzToLlh (trgLl,xyz,frame->srcERad,frame->srcESqr);

	return status;
}
Example #4
0
int EXP_LVL9 CSframeF3 (struct csFrame_ *frame,double trgLl [3],Const double srcLl [3])
{
	int status;

	double xx, yy, zz;
	double xyz [3];

	/* Convert the geographic coordinates to geocentric XYZ coordinates. */
	CS_llhToXyz (xyz,srcLl,frame->srcERad,frame->srcESqr);

	/* Adjust these cartesian coordinates via the Frame/Wolf transformation.
	   First, we apply the rotation matrix in a computationally effieicent
	   form.  That is, several elements of the matrix are assumed to have
	   fixed values. */
	xx =  xyz [XX] + frame->rotZ * xyz [YY] - frame->rotY * xyz [ZZ];
	yy = -frame->rotZ * xyz [XX] + xyz [YY] + frame->rotX * xyz [ZZ];
	zz =  frame->rotY * xyz [XX] - frame->rotX * xyz [YY] + xyz [ZZ];

	/* Apply the scale and translation. */
	xyz [XX] = frame->scale * xx + frame->deltaX;
	xyz [YY] = frame->scale * yy + frame->deltaY;
	xyz [ZZ] = frame->scale * zz + frame->deltaZ;

	/* Convert the new X, Y, and Z back to latitude and longitude.
	   CS_xyzToLlh returns degrees. */
	status = CS_xyzToLlh (trgLl,xyz,frame->trgERad,frame->trgESqr);

	/* That's that. */
	return status;
}
Example #5
0
int EXP_LVL1 CS_geoctrGetXyz (double xyz [3],double llh [3])
{
	extern double csGeoCtrErad;
	extern double csGeoCtrEsq;
	

	CS_llhToXyz (xyz,llh,csGeoCtrErad,csGeoCtrEsq);
	return 0;
}
Example #6
0
int EXP_LVL9 CSgeoctI3 (struct csGeoct_ *geoct,double* trgLl,Const double* srcLl)
{
	int status;

	double xyz [3];

	/* Convert the geographic coordinates to geocentric XYZ coordinates. */
	CS_llhToXyz (xyz,srcLl,geoct->trgERad,geoct->trgESqr);

	/* Invert the translation. */
	xyz [XX] -= geoct->deltaX;
	xyz [YY] -= geoct->deltaY;
	xyz [ZZ] -= geoct->deltaZ;

	/* Convert the new X, Y, and Z back to latitude and longitude. */
	status = CS_xyzToLlh (trgLl,xyz,geoct->srcERad,geoct->srcESqr);

	return status;
}
Example #7
0
int EXP_LVL9 CSgeoctF3 (struct csGeoct_ *geoct,double trgLl [3],Const double srcLl [3])
{
	int status;

	double xyz [3];

	/* Convert the geographic coordinates to geocentric XYZ coordinates. */
	CS_llhToXyz (xyz,srcLl,geoct->srcERad,geoct->srcESqr);

	/* Apply the scale and translation. */
	xyz [XX] += geoct->deltaX;
	xyz [YY] += geoct->deltaY;
	xyz [ZZ] += geoct->deltaZ;

	/* Convert the new X, Y, and Z back to latitude and longitude.
	   CS_xyzToLlh returns degrees. */
	status = CS_xyzToLlh (trgLl,xyz,geoct->trgERad,geoct->trgESqr);

	/* That's that. */
	return status;
}