示例#1
0
void RenderProContMOP::generateSample(const vector<vector<double>> &obj){

	if (GET_NUM_DIM == 1){
		m_sample.resize(m_divNum);
		for (int i = 0; i<m_divNum; ++i){
			vector<float> v(2);
			v[0] = m_rangeXMap.min + m_rangeXMap.range*i / m_divNum; v[1] = 0;
			v.push_back(m_rangeZMap.min + m_rangeZMap.range*(m_rangeVZ.max - m_pop[toZ(0, i, m_divNum)]->rank()) / m_rangeVZ.range);
			m_sample[i]=v;
		}

	}
	else {
		m_sample.resize(m_divNum*m_divNum);
		
		for (int i = 0; i<m_divNum; ++i){
			for (int j = 0; j<m_divNum; ++j){
				vector<float> v(2);
				v[0] = m_rangeXMap.min + m_rangeXMap.range*i / m_divNum;
				v[1] = m_rangeYMap.min + m_rangeYMap.range*j / m_divNum;
				int idx = toZ(i, j, m_divNum);
				v.push_back(m_rangeZMap.min + m_rangeZMap.range*(m_rangeVZ.max - m_pop[idx]->rank()) / m_rangeVZ.range);
				m_sample[idx]=v;
			}
		}
	}

}
示例#2
0
void RenderProContMOP::updateSample(const vector<vector<double>>&obj){
	if (GET_NUM_DIM == 1){
		for (int i = 0; i<m_divNum; ++i){	
			m_sample[i][2] = m_rangeZMap.min + m_rangeZMap.range*(m_rangeVZ.max - m_pop[toZ(0, i, m_divNum)]->rank()) / m_rangeVZ.range;
		}
	}
	else {
		for (int i = 0; i<m_divNum; ++i){
			for (int j = 0; j<m_divNum; ++j){
				int idx = toZ(i, j, m_divNum);			
				m_sample[idx][2] = m_rangeZMap.min + m_rangeZMap.range*(m_rangeVZ.max - m_pop[idx]->rank()) / m_rangeVZ.range;
			}
		}
	}
}
Lab_Colour ColourPickerConversions::toLab(RGB_Colour colour)
{
    float X = toX(colour.r, colour.g, colour.b);
    float Y = toY(colour.r, colour.g, colour.b);
    float Z = toZ(colour.r, colour.g, colour.b);

    float L = toL(Y);
    float a = toA(X, Y);
    float b = toB(Y, Z);

    return Lab_Colour(L, a, b);
}
//----------------------------------------------------------------------------//
float ColourPickerConversions::toZ(unsigned char R, unsigned char G, unsigned char B)
{
    return toZ(R / 255.0f, G / 255.0f, B / 255.0f);
}