Example #1
0
void triangle::set_vertex_values( point vertex1, point vertex2, point vertex3)
{
	m_vertex_list[0].x = vertex1.x;
	m_vertex_list[0].y = vertex1.y;
	m_vertex_list[0].z = vertex1.z;

	m_vertex_list[1].x = vertex2.x;
	m_vertex_list[1].y = vertex2.y;
	m_vertex_list[1].z = vertex2.z;

	m_vertex_list[2].x = vertex3.x;
	m_vertex_list[2].y = vertex3.y;
	m_vertex_list[2].z = vertex3.z;

	//center of the triangle
	point pos = calc_center(this);		

	m_center.x = pos.x;
	m_center.y = pos.y;
// 	std::cout.precision(16);
// 	std::cout << "vertex" <<std::endl;
// 	std::cout << m_vertex_list[0].x <<" " << m_vertex_list[0].y << std::endl
// 			  << m_vertex_list[1].x <<" " << m_vertex_list[1].y << std::endl
// 			  << m_vertex_list[2].x <<" " << m_vertex_list[2].y << std::endl;
// 	std::cout << "center" <<std::endl;
// 	std::cout << pos.x << " " << pos.y << std::endl;

	if (m_cur_rec_depth != 0)
	{
		update_subtri();
	}
	
}
Example #2
0
void centration(cv::Mat &X){
	cv::Mat center = calc_center(X);
	//std::cout << center << std::endl;
	for(int i=0; i<X.cols; i++){
		X.col(i) -= center;
	}
}
    void area(const osmium::Area& area) {
        const char* amenity = area.tags()["amenity"];
        if (amenity) {
            // Use the center of the first outer ring. Because we set
            // create_empty_areas = false in the assembler config, we can
            // be sure there will always be at least one outer ring.
            const auto center = calc_center(*area.cbegin<osmium::OuterRing>());

            print_amenity(amenity, area.tags()["name"], center);
        }
    }
Example #4
0
void node::draw( D3DXMATRIX& matWorld ){

	D3DXMatrixIdentity(&matLocal);

	matLocal = matSelfSpin * matModelView * matParent * matWorld;

	calc_center();

	swprintf_s(s_information,STRING_SIZE, L"%sid: %d, type:%s, (%.2f, %.2f, %.2f), size:%.0f \n",
		s_information,
		this->nodeid,
		get_type_string(),
		center[0],
		center[1],
		center[2],
		this->size
		);

	// draw lines for debug
	d3d_ctrl.draw_axis( matLocal );
	
	d3d_ctrl.setWorldTransform( (matScale*matLocal) );
	primitive.draw();
	
	//draw child
	int count = 0;
	count = 0;
	for( nodelist::iterator it = child.begin(); it != child.end() ; it++ ){
		if( count == 0 ){
			for( int i = 0 ; i < nodelevel ; ++i ){
				swprintf_s( s_information,STRING_SIZE, L"%s    ", s_information );
			};
			swprintf_s( s_information,STRING_SIZE, L"%s     id: %d's child: \n",
				s_information,
				this->nodeid
				);
		}
		(*it)->draw( matLocal );
		count++;
	}
	if( count != 0 ){
		for( int i = 0 ; i < nodelevel ; ++i ){
				swprintf_s( s_information,STRING_SIZE, L"%s    ", s_information );
			};
		swprintf_s( s_information,STRING_SIZE, L"%s     end of id: %d's child: \n",
			s_information,
			this->nodeid
			);
	}
}