|
This function is intended to solve the following problem:
You have a point x,y,z on a plane or a polygon and you want to know what is the correct bitmap coords u,v
for this point according to the given polygon.
This function is used in conjunction with STATE_math_get_interpolated_value_using_equation()
Each bitmap coord has two values u,v. This function calculates the two equasions needed to
calcualte u,v. You don't need to know or care about what these equasions mean.
you only need to pass them to the STATE_math_get_interpolated_value_using_equation() function
Parameters:
U_equation [OUT]
The equasion for calculating the U equasion which is used to calculate the u coordinate
one doesn't need to understand what this equasion means.
one only needs to pass it to the STATE_math_get_interpolated_value_using_equation() function
V_equation [OUT]
The equasion for calculating the V equasion which is used to calculate the v coordinate
one doesn't need to understand what this equasion means.
one only needs to pass it to the STATE_math_get_interpolated_value_using_equation() function
polygon_handle [IN]
The equasions will be built according to the given polygon.
The bitmap coordinates of the poygon vertex define the connection between a point
X,Y,Z on the polygon plane and the corresponding u,v bitmap coordinate
coords_set_index [IN]
can be 0 or 1. Set it to 0 for the primary bitmap coords. Set it to 1 for the secondary bitmap coords
Remeber that each polygon could have two bitmaps and that each one of the bitmaps can be mapped separatelly
Return value:
Returns the the equation type. Again we don't need to care about this value. Only to keep it and pass it later
to STATE_math_get_interpolated_value_using_equation()
Example:
double U_equation[4], V_equation[4];
int equation_set=STATE_math_calculate_bitmap_coords_equations(U_equation, V_equation, polygon_handle, 0);
double UV[2];
double point_on_polygon_plane[3]={1,2,3};
UV[0]=get_interpolated_value_using_equation(point_on_polygon_plane, U_equation, equation_set);
UV[1]=get_interpolated_value_using_equation(point_on_polygon_plane, V_equation, equation_set);
UV now contains the bitmap coords of the given point
|