/*These files contain basic structures used frequently in the program and in computer graphics in general. For more information, see the header file. -David Mayerich, 8/20/05*/ #include "rtsMath.h" //#include //using namespace std; point3D::point3D() { x=0; y=0; z=0; } point3D::point3D(double newx, double newy, double newz) { x=newx; y=newy; z=newz; } point3D point3D::operator +(vector3D param) { point3D result; result.x=x+param.x; result.y=y+param.y; result.z=z+param.z; return result; } point3D point3D::operator -(vector3D param) { point3D result; result.x=x-param.x; result.y=y-param.y; result.z=z-param.z; return result; } vector3D point3D::operator -(point3D param) { vector3D result; result.x=x-param.x; result.y=y-param.y; result.z=z-param.z; return result; } void point3D::print() { cout< m_x1) return 0.0f; if(y < m_y0 || y > m_y1) return 0.0f; float x_size = m_x1 - m_x0; float y_size = m_y1 - m_y0; float scaled_x = (x-m_x0)/x_size; float scaled_y = (y-m_y0)/y_size; int x_index = scaled_x * m_x_resolution; int y_index = scaled_y * m_y_resolution; return m_values[y_index * m_x_resolution + x_index]; } float* function2D::getBits() { return m_values; } void function2D::setBits(unsigned char* bits) { //copy the given bits to the current function //the member m_values can't just be set to bits because the datatypes may be different for(int i=0; i m_values[current_max_index]) current_max_index = i; } //cout<<"current max: "<>c; float current_min = m_values[current_min_index]; float current_max = m_values[current_max_index]; //now loop through the function again and scale to the appropriate values float scaled; for(int i=0; i max) m_values[i] = max; } } void function2D::Abs() { for(int i=0; i