示例#1
0
int soltrack_init(double deg_lat, double deg_long)
{
	// Check domain
	if (!(check_lat(deg_lat) && check_long(deg_long))) {
		return SOL_DOMAIN_ERROR;
	}
	// Calculate latitude and longitude in radians
	double rad_lat = deg_to_rad(deg_lat);
	double rad_long = deg_to_rad(deg_long);
	// Create a 3-dimensional vector
	uv_orth_w_spin = gsl_vector_alloc(V_DIM);
	gsl_vector_set(uv_orth_w_spin, X_AXIS, \
		gsl_sf_cos(rad_long) * gsl_sf_cos(rad_lat));
	gsl_vector_set(uv_orth_w_spin, Y_AXIS, \
		gsl_sf_sin(rad_long) * gsl_sf_cos(rad_lat));
	gsl_vector_set(uv_orth_w_spin, Z_AXIS, gsl_sf_sin(rad_lat));
	// Create the rotation matrix for axial tilt of the earth
	rm_ax_tilt = gsl_matrix_calloc(V_DIM, V_DIM); // Initialize 0
	// X-Axis
	gsl_matrix_set(rm_ax_tilt, X_AXIS, X_AXIS, gsl_sf_cos(rad_ax_tilt));
	gsl_matrix_set(rm_ax_tilt, X_AXIS, Z_AXIS, -gsl_sf_sin(rad_ax_tilt));
	// Y-Axis (no rotation)
	gsl_matrix_set(rm_ax_tilt, Y_AXIS, Y_AXIS, 1.0);
	// Z-Axis
	gsl_matrix_set(rm_ax_tilt, Z_AXIS, X_AXIS, gsl_sf_sin(rad_ax_tilt));
	gsl_matrix_set(rm_ax_tilt, Z_AXIS, Z_AXIS, gsl_sf_cos(rad_ax_tilt));
	
	// Initialisation complete
	initialized = 1;	
	return 0;
}
示例#2
0
bool check_latlng(Location loc)
{
    return check_lat(loc.lat) && check_lng(loc.lng);
}
示例#3
0
bool check_latlng(int32_t lat, int32_t lng)
{
    return check_lat(lat) && check_lng(lng);
}
示例#4
0
bool check_latlng(float lat, float lng)
{
    return check_lat(lat) && check_lng(lng);
}