void Controller::draw_separators() const
{
    logger.info(mmlt_msg("Drawing Separators..."));

    for(SegmentIndex index = 0; index < intersection_algorithm_.shortest_noncrossing_segment_; ++index)
    {
        SVGPainter painter(file_prefix_, QString("separators_%1.svg").arg(index), bounding_box_);

        //draw_segments(painter);


        painter.setPenColor(QColor(255, 0, 0));

        const Intersections& intersections = intersection_graph_[index];

        std::vector<SegmentIndex> separators;
        intersections.find_separators(index, segments_, separators);

        for(const SegmentIndex& separator_index : separators)
        {
            const Segment& separator= segments_[separator_index];
            separator.draw(painter);
        }

        painter.setPenColor(QColor(0, 255, 0));

        const Segment& segment = segments_[index];
        segment.draw(painter);

        draw_points(painter);
    }
}
Exemple #2
0
int draw_particles(void)
{
  static Vec pointv[512];
  static size_t pointc = ARRLEN(pointv, Vec);
  double z = zoom();
  particle_t* p = particles;
  int i = 0;
  size_t count = HASH_COUNT(particles);

  while(i < count) {
    for(; p != NULL && i < pointc; p = p->hh.next, i++) {
      cpVect pos = cpBodyGetPos(p->body);

      if(fabs(pos.x) <= z / 2 && fabs(pos.y) <= z / 2) {
        // rough check if position is inside screen borders
        // TODO: possibly make it separate function
        pointv[i] = cpv2vec(pos);
      }
    }
    if(draw_points(pointv, i % pointc)) {
      return -1;
    }
  }

  return 0;
}
Exemple #3
0
/**
 * @brief Renders everything; called once on startup
 * and then to animate hull algorithm steps.
 */
void ConvexHullApp::OnRender()
{
    SDL_FillRect(surf, NULL, SDL_MapRGB(surf->format, 255, 255, 255));    
    draw_points();
    draw_hull();
    SDL_Flip(surf);
}
void Scene_polyhedron_shortest_path_item::draw(Viewer_interface* viewer) const
{
    if (supportsRenderingMode(renderingMode()))
    {
      draw_points(viewer);
    }
}
void Scene_polyhedron_selection_item::draw(Viewer_interface* viewer) const
{

    if(!are_buffers_filled)
        initialize_buffers(viewer);

    draw_points(viewer);
    GLfloat offset_factor;
    GLfloat offset_units;
    viewer->glGetFloatv( GL_POLYGON_OFFSET_FACTOR, &offset_factor);
    viewer->glGetFloatv(GL_POLYGON_OFFSET_UNITS, &offset_units);
    glPolygonOffset(-1.f, 1.f);

    vaos[0]->bind();
    program = getShaderProgram(PROGRAM_WITH_LIGHT);
    attrib_buffers(viewer,PROGRAM_WITH_LIGHT);
    program->bind();
    program->setAttributeValue("colors",facet_color);
    viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/3));
    program->release();
    vaos[0]->release();
    glPolygonOffset(offset_factor, offset_units);
    draw_edges(viewer);


}
Exemple #6
0
void Scene::draw()
{
    if(m_view_plane)
        ::glEnable(GL_DEPTH_TEST);
    else
        ::glDisable(GL_DEPTH_TEST);

    if(m_view_polyhedron)
        draw_polyhedron();

    if(m_view_points)
        draw_points();

    if(m_view_segments)
        draw_segments();

    if (m_view_plane)
    {
        switch( m_cut_plane )
        {
        case UNSIGNED_EDGES:
        case UNSIGNED_FACETS:
            draw_distance_function(m_thermal_ramp, m_thermal_ramp);
            break;
        case SIGNED_FACETS:
            draw_distance_function(m_red_ramp, m_blue_ramp);
            break;
        case CUT_SEGMENTS:
            draw_cut_segment_plane();
            break;
        case NONE: // do nothing
            break;
        }
    }
}
Exemple #7
0
void MGCommandDrawer::draw_points_lines(
		const MGColor& pcolor,	//color of points(boundary)
		const MGColor& lcolor,	//color of line.
		const std::vector<MGPosition>& ipos
)const{
	draw_lines(lcolor,ipos);
	draw_points(pcolor,ipos);
}
Exemple #8
0
/**
 * @brief Renders everything; called once on startup
 *        and then to animate clicks and line algorithm calls.
 */
void LineApp::OnRender()
{
    SDL_FillRect(surf, NULL, SDL_MapRGB(surf->format, 255, 255, 255));    

    draw_points();
    draw_line_points();
    SDL_Flip(surf);
}
void breakpoints_paint(t_breakpoints *x, t_object *view)
{
	t_rect rect;
	ebox_get_rect_for_view((t_ebox *)x, &rect);
    x->f_size.x = rect.width;
    x->f_size.y = rect.height;
    draw_text(x, view, &rect);
    draw_points(x, view, &rect);
}
Exemple #10
0
void disp(void)
{
  glClear(GL_COLOR_BUFFER_BIT);
  draw_points();
  if(show_linear) draw_linear();
  if(show_catmull_rom) draw_catmull_rom();
  if(show_bezier) draw_bezier();
  glutSwapBuffers();
}
//drawing all about (current) distribution
void MainWindow::draw_distribution(const int activeDistributionNumber, QGraphicsScene * scene)
{
    if (ui.checkBoxSelection->isChecked())
        draw_points(activeDistributionNumber, scene);

    if (ui.checkBoxMiddle->isChecked())
        draw_middle_point(activeDistributionNumber, scene);

    if (ui.checkBoxIsolines->isChecked())
        draw_isolines(activeDistributionNumber, scene);
}
void particles_render::draw_heat(const explosion &e) const
{
    const float life_time = 5.0f;

    clear_points();
    auto atc = tc(1920, 1664, 128, 128);
    auto nt = e.m_time / life_time;
    auto t = nya_math::min(e.m_time, 1.0f) + nt * 0.1f;
    auto r = e.m_radius * t * 3.0f;

    add_point(e.m_pos, r, atc, false, atc, false, color(1.0f, 1.0f, 1.0f, 1.0f) * 0.2f);
    draw_points();
}
Exemple #13
0
int				main(int argc, char **argv)
{
	t_cloud		data;

	init_struct(&data);
	if (argc != 2)
		error_fdf("fdf");
	parser(argv, &data);
	draw_points(data.start_node, &data);
    mlx_hook(data.win, 2, (1L << 0), distrib_key, &data);
	mlx_loop(data.mlx);
	return (0);
}
void Controller::draw_triangulation() const
{
    logger.debug( mmlt_msg( "Drawing triangulation..." ) );

    SVGPainter painter(file_prefix_, "solution.svg", bounding_box_);

    //draw_segments(painter);

    painter.setPenColor(QColor(255, 0, 0));
    triangulation_.draw(painter);

    draw_points(painter);
}
Exemple #15
0
void main(void)
   {
   int gd = DETECT, gm;
   double points[6][2] = {-3, 2, -2, -1.5, -1, 0, 0, 0, 1, 1, 2, -1.5};
   node *poly;
   if ((poly = lagrange(points, 6)) != NULL)
	print_polynomial(poly, "poly = ");
   else printf("Impossible !!!!");
   getch();
   initgraph(&gd, &gm, "c:\\tcpp\\bgi");
   draw_points(points, 6, 0, 0, 100);
   draw(poly, 0, 0, -5, 5, 100, 0.05);
   getch();
   closegraph();
   }
int main(int argc, char const **argv)
{
    init_env(argc, argv);
    omp_set_num_threads(num_thread);
    high_resolution_clock::time_point s;

    Gmm = G * mass * mass;
    for (int i = 0; i < iters; ++i) {
        if (gui) draw_points(0);
        s = high_resolution_clock::now();
        #pragma omp parallel for schedule(dynamic, 50)
        for (int j = 0; j < num_body; ++j) move_nth_body(j);
        Body* t = new_bodies; new_bodies = bodies; bodies = t;
        total_time += timeit(s);
    }
    INFO("Run in " << total_time.count() / 1000 << " us");
    return 0;
}
void Controller::draw_bounds() const
{
    logger.info(mmlt_msg("Drawing bounds..."));

    SVGPainter painter(file_prefix_, QString("bounds_%1.svg").arg(stats_.iteration), bounding_box_);
    draw_segments(painter);

    painter.setPenColor(QColor(255, 255, 0));
    segments_.draw_range(painter, stats_.lower_bound(), stats_.upper_bound());

    painter.setPenColor(QColor(0, 255, 0));
    segments_[stats_.lower_bound()].draw(painter);

    painter.setPenColor(QColor(255, 0, 0));
    segments_[stats_.upper_bound()].draw(painter);

    draw_points(painter);
}
void Controller::draw_sat_solution() const
{
    logger.debug( mmlt_msg( "Drawing SAT solution..." ) );

    SVGPainter painter(file_prefix_, QString("sat_%1.svg").arg(stats_.iteration), bounding_box_);

    //draw_segments(painter);

    painter.setPenColor(QColor(255, 255, 0));
    segments_.draw_range(painter, stats_.lower_bound(), stats_.upper_bound());

    painter.setPenColor(QColor(255, 0, 0));
    last_sat_solution_.draw_short_segments(painter, stats_.upper_bound(), segments_);

    painter.setPenColor(QColor(0, 255, 0));
    last_sat_solution_.draw_separators(painter, stats_.upper_bound(), segments_);

    draw_points(painter);
}
/**
 *	Draw the list of coordinates currently in the database
 *
 *	@author HP Truong, Jacob Barnett
 *
 *	@param void
 *	@return void 
 */
void draw_from_db(void) {
	LCD_Clear(LCD_COLOR_WHITE);
	LCD_SetTextColor(LCD_COLOR_RED);
	memcpy ( (void *)(LCD_FRAME_BUFFER + BUFFER_OFFSET), (void *) ((uint8_t*) (&background)), sizeof(background));
	
	uint8_t len = coordinate_db_get_len();
	if (len == 0) {
		return;
	}

	static coordinate next_coord;

	for (uint8_t i = 0; i < len; i++) {
		coordinate_db_get_entry(i, &next_coord);
		xs[i] = next_coord.x;
		ys[i] = next_coord.y;
	}

	draw_points(1, 1, xs, ys, len);
}
static void display_func ( void )
{	
	fps_time += timer.GetElapsedTime();
    rot_time += timer.GetElapsedTime();
	timer.Reset();
	frames++;

	if(fps_time >= 10.0 && rate)
	{
		cout<<"Framerate:"<<(frames/fps_time)<<endl;
		frames = 0;
		fps_time = 0;
	}
	pre_display ();

		if      ( dvel==0 ) draw_velocity ();
		else if	( dvel==1 )	draw_density ();
        else if ( dvel==2 ) draw_points ();
        else if ( dvel==3 ) draw_particles ();

	post_display ();
}
Exemple #21
0
int 			distrib_key(int key_value, t_cloud *data)
{
	if (key_value == 65307 || key_value == 53)
		exit(0);
/*	else if (key_value == 69 || key_value == 65451)
		data->zoom += 0.1;
	else if (key_value == 78 || key_value == 65453)
		data->zoom -= 0.1;*/
	else if (key_value == 69 || key_value == 65451)
		data->depth += 0.1;
	else if (key_value == 78 || key_value == 65453)
		data->depth -= 0.1;
	else if (key_value == 125)
		data->e_y += 15;
	else if (key_value == 126)
		data->e_y -= 15;
	else if (key_value == 123)
			data->e_x += 15;
	else if (key_value == 124)
		data->e_x -= 15;
	else if (key_value == 258)
		data->e_z += 1;
	else if (key_value == 269)
		data->e_z -= 1;
	else if (key_value == 116)
		data->ang_x += 1;
	else if (key_value == 121)
		data->ang_x -= 1;
	else if (key_value == 86)
		data->ang_y += 1;
	else if (key_value == 88)
		data->ang_y -= 1;
	printf("key =%d,\n", key_value);
	mlx_clear_window(data->mlx, data->win);
	set_3d_pos(data->start_node, data);
    draw_points(data->start_node, data);
	return (0);
}
void Controller::draw_intersections() const
{
    logger.info( mmlt_msg( "Drawing intersections..." ) );

    SegmentIndex segment_index = 0;

    for(const Intersections& intersections : intersection_graph_)
    {
        SVGPainter painter(file_prefix_, QString("%1_intersections.svg").arg(segment_index, 5, 10, QChar('0')), bounding_box_);

        draw_segments(painter);

        painter.setPenColor(QColor(0, 255, 0));
        segments_[segment_index].draw(painter);

        painter.setPenColor(QColor(255, 0, 0));
        intersections.draw(painter, segments_);

        draw_points(painter);

        ++segment_index;
    }
}
Exemple #23
0
int 			main(int argc, char **argv)
{
    int 		fd;
    t_cloud 	data;
    t_node 		nodes;


    init_struct(&data);
    if (argc <= 1 || argc >= 3)
    	return (argc <= 1 ? error("Too few arguments")
    		: error("Too many arguments"));
	if (argc != 2)
    	return (error("Error parameters"));
    if ((fd = open(argv[1], O_RDONLY)) == -1)
    	return (error("Error open file"));
    if (!parser(fd, &data, &nodes))
    	return (error("Parsing Error"));
    close(fd);
    draw_points(data.start_node, &data);
    mlx_hook(data.win, 2, (1L << 0), distrib_key, &data);
 //   mlx_key_hook(data.win, distrib_key, &data);
	mlx_loop(data.mlx);
    return (0);
}
void particles_render::draw(const fire_trail &t) const
{
    clear_points();

    for (size_t fi = 0; fi < t.m_count; ++fi)
    {
        const int i = (fi + t.m_offset) % t.max_count;

        const int tc_w_count = 16;
        //const int tc_h_count = 2;
        const int tc_idx = t.m_tci[i];//(tc_w_count * tc_h_count + 1) * nya_math::min(t.m_time / 5.0f, 1.0f);

        bool fire = fi + 7 >= t.m_count;

        color c = color(1.0f, 1.0f, 1.0f, 0.1 + 0.5f * fi / t.max_count);
        if (fire)
            c.xyz() *= hdr_coeff;

        add_point(t.m_pos[i].xyz(), t.m_pos[i].w, tc((tc_idx % tc_w_count) * 128, (fire ? 0 : 128) + (tc_idx / tc_w_count) * 128, 128, 128), !fire,
                  tc(640 + t.m_tcia[i], 1280 + 128, 128, 128), true, c, nya_math::vec2(), t.m_rot[i]);
    }

    draw_points();
}
Exemple #25
0
void sdl_visualize_clusters(point *points, int numpoints, int *cluster_centersx, int *cluster_centersy, int clusters)
{
    SDL_Init(SDL_INIT_VIDEO);

    SDL_WM_SetCaption("Cluster Visualization", "SDL Test");
    screen = SDL_SetVideoMode(WINW, WINH, 0, 0);

    SDL_Rect rect = {0, 0, WINW, WINH};
    SDL_FillRect(screen, &rect, WHITE);

    draw_points(points, numpoints, cluster_centersx, cluster_centersy, clusters);	

    debug("Entering input loop...");
    SDL_Event event;
    bool exit = false;

    while (!exit)
    {
        if (SDL_PollEvent(&event)) 
        {
            switch (event.type) 
            {
                case SDL_QUIT:
                  exit = 1;
                  break;
                case SDL_KEYDOWN:
                  switch (event.key.keysym.sym) 
                  {
		                case SDLK_UP:
			                up = true;
			            break;
		                case SDLK_DOWN:
			                down = true;
			            break;
		                case SDLK_RIGHT:
			                right = true;
			            break;
		                case SDLK_LEFT:
			                left = true;
			            break;
                      case SDLK_ESCAPE:
                      case SDLK_q:
                        exit = 1;
                        break;
                  }
                  break;
                case SDL_KEYUP:
                  switch (event.key.keysym.sym) 
                  {
		                case SDLK_UP:
			                up = false;
			            break;
		                case SDLK_DOWN:
			                down = false;
			            break;
		                case SDLK_RIGHT:
			                right = false;
			            break;
		                case SDLK_LEFT:
			                left = false;
			            break;
                      case SDLK_ESCAPE:
                      case SDLK_q:
                        exit = 1;
                        break;
                  }
                  break;
            }
        }
        if(up == true)
            adjustOffset(UP);
        if(down == true)
            adjustOffset(DOWN);
        if(left == true)
            adjustOffset(LEFT);
        if(right == true)
            adjustOffset(RIGHT);
        if(up == true || down == true || left == true || right == true)
        {
            draw_points(points, numpoints, cluster_centersx, cluster_centersy, clusters);
        }
        SDL_UpdateRect(screen, 0, 0, 0, 0);
    }
    SDL_Quit();
}
Exemple #26
0
/* This illustrates how to use SIFT3D within a function, and free all memory
 * afterwards. */
int demo(void) {

	Image im, draw;
        Mat_rm keys;
	SIFT3D sift3d;
	Keypoint_store kp;
	SIFT3D_Descriptor_store desc;

        // Initialize the intermediates
        init_Keypoint_store(&kp);
        init_SIFT3D_Descriptor_store(&desc);
        init_im(&im);
        init_im(&draw);
        if (init_Mat_rm(&keys, 0, 0, DOUBLE, SIFT3D_FALSE))
                return 1; 

        if (init_SIFT3D(&sift3d)) {
                cleanup_Mat_rm(&keys);
                return 1;
        }

        // Read the image
        if (im_read(im_path, &im))
                goto demo_quit;

        // Detect keypoints
	if (SIFT3D_detect_keypoints(&sift3d, &im, &kp))
                goto demo_quit;

        // Write the keypoints to a file
        if (write_Keypoint_store(keys_path, &kp))
                goto demo_quit;
        printf("Keypoints written to %s. \n", keys_path);

        // Extract descriptors
        if (SIFT3D_extract_descriptors(&sift3d, &kp, &desc))
                goto demo_quit;

        // Write the descriptors to a file
        if (write_SIFT3D_Descriptor_store(desc_path, &desc))
                goto demo_quit;
        printf("Descriptors written to %s. \n", desc_path);

        // Convert the keypoints to a matrix 
        if (Keypoint_store_to_Mat_rm(&kp, &keys))
                goto demo_quit;

        // Draw the keypoints
        if (draw_points(&keys, im.dims, 1, &draw))
                goto demo_quit;

        // Write the drawn keypoints to a file
        if (im_write(draw_path, &draw))
                goto demo_quit;
        printf("Keypoints drawn in %s. \n", draw_path);

        // Clean up
        im_free(&im);
        im_free(&draw);
        cleanup_Mat_rm(&keys);
        cleanup_SIFT3D(&sift3d);
        cleanup_Keypoint_store(&kp);
        cleanup_SIFT3D_Descriptor_store(&desc);

        return 0;

demo_quit:
        // Clean up and return an error
        im_free(&im);
        im_free(&draw);
        cleanup_Mat_rm(&keys);
        cleanup_SIFT3D(&sift3d);
        cleanup_Keypoint_store(&kp);
        cleanup_SIFT3D_Descriptor_store(&desc);

        return 1;
}
Exemple #27
0
void conic(INT q, INT *six_coeffs, INT xmax, INT ymax, INT f_do_stabilizer, INT verbose_level) 
{
	const BYTE *override_poly = NULL;
	finite_field F;
	projective_space *P;
	action *A;
	INT n = 3;
	//INT f_with_group = TRUE;
	
	INT v[3];
	//INT w[3];

	//F.init(q), verbose_level - 2);
	F.init_override_polynomial(q, override_poly, verbose_level);

	P = new projective_space;
	cout << "before P->init" << endl;
	P->init(n - 1, &F, 
		FALSE /* f_init_incidence_structure */, 
		verbose_level/*MINIMUM(2, verbose_level)*/);

	cout << "after P->init" << endl;
	A = new action;
	A->init_general_linear_group(n, &F, FALSE /* f_semilinear */, TRUE /* f_basis */, verbose_level - 2);
	
	INT variety[100];
	INT variety_size = 0;
	INT a, i, j, h;

	for (i = 0; i < P->N_points; i++) {
		P->unrank_point(v, i);
		a = F.evaluate_conic_form(six_coeffs, v);
		cout << i << " : ";
		INT_vec_print(cout, v, 3);
		cout << " : " << a << endl;
		if (a == 0) {
			variety[variety_size++] = i;
			}
		}
	cout << "the size of the variety is " << variety_size << endl;
	cout << "the variety is:" << endl;
	INT_vec_print(cout, variety, variety_size);
	cout << endl;
	for (i = 0; i < variety_size; i++) {
		P->unrank_point(v, variety[i]);
		a = F.evaluate_conic_form(six_coeffs, v);
		cout << i << " : ";
		INT_vec_print(cout, v, 3);
		cout << " : " << a << endl;
		}
	
#if 0
	INT pts[] = {2, 22, 6, 18, 10};
	find_collinear_triple(P, pts, 5);
	
	INT five_pts[] = {3, 6, 7, 28, 30};
#endif
	//INT six_coeffs[6];
	INT five_pts[5];
	five_pts[0] = variety[0];
	five_pts[1] = variety[1];
	five_pts[2] = variety[2];
	five_pts[3] = variety[3];
	five_pts[4] = variety[4];
	
	P->determine_conic_in_plane(five_pts, 5, six_coeffs, verbose_level);

	INT points[1000];
	INT tangents[1000];
	INT *exterior_points;
	INT *secants;
	INT nb_secants, nb_exterior_points;
	INT nb_points;
	//INT v[3];
	
	P->conic_points(five_pts, six_coeffs, points, nb_points, verbose_level);
	cout << "the " << nb_points << " conic points are: ";
	INT_vec_print(cout, points, nb_points);
	cout << endl;
	for (i = 0; i < nb_points; i++) {
		P->unrank_point(v, points[i]);
		cout << i << " : " << points[i] << " : ";
		INT_vec_print(cout, v, 3);
		cout << endl;
		}


	strong_generators *Aut_gens;


	if (f_do_stabilizer) {
		// computing stabilizer:

		cout << "computing stabilizer" << endl;
	
		set_stabilizer_compute STAB;
		sims *Stab;
		INT nb_backtrack_nodes;
	
		cout << "computing stabilizer of conic:" << endl;
		STAB.init(A, variety, variety_size /* points, nb_points*/ , verbose_level);
		STAB.compute_set_stabilizer(t0, nb_backtrack_nodes, Aut_gens, verbose_level + 10);
		longinteger_object go, go2;
		Stab = Aut_gens->create_sims(verbose_level - 1);
		Stab->group_order(go);
		cout << "computing stabilizer of conic done, found a group of order " << go << endl;

		delete Stab;
		}
	else {
		Aut_gens = NULL;
		}
	{
	BYTE fname[1000];
	{
	mp_graphics *G;
	INT f_include_line_at_infinity = TRUE;

	sprintf(fname, "conic_%ld", q);
	draw_beginning(fname, G, xmax, ymax, verbose_level);

	//variety_size = 0;
	draw_grid_(*G, q, f_include_line_at_infinity, verbose_level);
	draw_points(*G, P, /*variety + 3, 5*/ variety, variety_size /*points, nb_points*/, verbose_level);
	draw_end(fname, G, xmax, ymax, verbose_level);
	}
	if (f_do_stabilizer) {
		prepare_latex(fname, P, points, nb_points, Aut_gens, verbose_level);
		}
	}
		
	delete Aut_gens;
	return;
	
	P->find_tangent_lines_to_conic(six_coeffs, 
		points, nb_points, 
		tangents, verbose_level);

	cout << "the " << nb_points << " tangent lines are: ";
	INT_vec_print(cout, tangents, nb_points);
	cout << endl;

	nb_exterior_points = (nb_points * (nb_points - 1)) >> 1;
	nb_secants = nb_exterior_points;
	exterior_points = NEW_INT(nb_exterior_points);
	h = 0;
	for (i = 0; i < nb_points; i++) {
		for (j = i + 1; j < nb_points; j++) {
			exterior_points[h++] = P->Line_intersection[
				tangents[i] * P->N_lines + tangents[j]];
			}
		}
	INT_vec_heapsort(exterior_points, nb_exterior_points);
	cout << "the " << nb_exterior_points << " exterior points are: ";
	INT_vec_print(cout, exterior_points, nb_exterior_points);
	cout << endl;

	secants = NEW_INT(nb_secants);
	h = 0;
	for (i = 0; i < nb_points; i++) {
		for (j = i + 1; j < nb_points; j++) {
			secants[h++] = P->Line_through_two_points[
				points[i] * P->N_points + points[j]];
			}
		}
	INT_vec_heapsort(secants, nb_secants);
	cout << "the " << nb_secants << " secants are: ";
	INT_vec_print(cout, secants, nb_secants);
	cout << endl;

	INT *external_lines;
	INT nb_external_lines;
	
	external_lines = NEW_INT(P->N_lines);
	for (i = 0; i < P->N_lines; i++) {
		external_lines[i] = i;
		}
	nb_external_lines = P->N_lines;
	set_delete_elements(external_lines, nb_external_lines, tangents, nb_points);
	set_delete_elements(external_lines, nb_external_lines, secants, nb_secants);

	cout << "the " << nb_external_lines << " external lines are: ";
	INT_vec_print(cout, external_lines, nb_external_lines);
	cout << endl;
	
	INT *adjacency;
	INT idx;

	adjacency = NEW_INT(nb_external_lines * nb_external_lines);
	for (i = 0; i < nb_external_lines; i++) {
		adjacency[i * nb_external_lines + i] = 0;
		for (j = i + 1; j < nb_external_lines; j++) {
			a = P->Line_intersection[
				external_lines[i] * P->N_lines + external_lines[j]];
			if (INT_vec_search(exterior_points, nb_exterior_points, a, idx)) {
				adjacency[i * nb_external_lines + j] = 1;
				adjacency[j * nb_external_lines + i] = 1;
				}
			else {
				adjacency[i * nb_external_lines + j] = 0;
				adjacency[j * nb_external_lines + i] = 0;
				}
			}
		}
	cout << "adjacency matrix:" << endl;
	print_integer_matrix_width(cout, adjacency, 
		nb_external_lines, nb_external_lines, nb_external_lines, 
		1);
	INT *Edges1;
	INT *Edges2;
	INT *Incidence;
	INT nb_e = 0;
	for (i = 0; i < nb_external_lines; i++) {
		for (j = i + 1; j < nb_external_lines; j++) {
			if (adjacency[i * nb_external_lines + j])
				nb_e++;
			}
		}
	Edges1 = NEW_INT(nb_e);
	Edges2 = NEW_INT(nb_e);
	Incidence = NEW_INT(nb_external_lines * nb_e);
	for (i = 0; i < nb_external_lines * nb_e; i++) {
		Incidence[i] = 0;
		}

	nb_e = 0;
	for (i = 0; i < nb_external_lines; i++) {
		for (j = i + 1; j < nb_external_lines; j++) {
			if (adjacency[i * nb_external_lines + j]) {
				Edges1[nb_e] = i;
				Edges2[nb_e] = j;
				nb_e ++;
				}
			}
		}
	for (j = 0; j < nb_e; j++) {
		Incidence[Edges1[j] * nb_e + j] = 1;
		Incidence[Edges2[j] * nb_e + j] = 1;
		}

	BYTE fname[1000];
	sprintf(fname, "ext_lines_%ld.inc", P->F->q);
	{
	ofstream f(fname);

	f << nb_external_lines << " " << nb_e << " " << nb_e * 2 << endl;
	for (i = 0; i < nb_external_lines * nb_e; i++) {
		if (Incidence[i]) {
			f << i << " ";
			}
		}
	f << endl;
	f << -1 << endl;
	
	}
	cout << "written file " << fname << " of size " << file_size(fname) << endl;

	INT colors[] = {0,1};
	INT C = 2;
	INT *Pijk;
	
	Pijk = NEW_INT(C * C * C);
	if (analyze_color_graph(C, colors, nb_external_lines, adjacency, Pijk, verbose_level)) {
		cout << "is association scheme" << endl;
		}
	else {
		cout << "not an association scheme" << endl;
		}

	//exit(1);
	

	{
	set_stabilizer_compute STAB;
	strong_generators *Aut_gens;
	sims *Stab;
	//vector_ge gens;
	//INT *tl;
	INT nb_backtrack_nodes;

	cout << "computing stabilizer of conic:" << endl;
	STAB.init(A, points, nb_points, verbose_level);
	STAB.compute_set_stabilizer(t0, nb_backtrack_nodes, Aut_gens, verbose_level + - 2);
	Stab = Aut_gens->create_sims(verbose_level - 1);
	longinteger_object go, go2;
	Stab->group_order(go);
	cout << "computing stabilizer of conic done, found a group of order " << go << endl;

	
	action *A2;
	action A2r;
	INT f_induce_action = TRUE;

	projective_space_init_line_action(P, A, A2, verbose_level);
	A2r.induced_action_by_restriction(*A2, 
		f_induce_action, Stab, 
		nb_external_lines, external_lines, verbose_level);
	A2r.group_order(go2);
	cout << "induced action on external lines has order " << go2 << endl;

	for (i = 0; i < Aut_gens->gens->len; i++) {
		A2r.element_print_quick(Aut_gens->gens->ith(i), cout);
		A2->element_print_as_permutation(Aut_gens->gens->ith(i), cout);
		A2r.element_print_as_permutation(Aut_gens->gens->ith(i), cout);
		}
	delete Aut_gens;
	delete Stab;
	delete A2;
	}
}
void particles_render::draw(const explosion &e) const
{
    clear_points();

    const float life_time = 5.0f;

    for (int i = 0; i < 2; ++i)
    {
        auto &rots = i == 0 ? e.m_shrapnel_rots : e.m_shrapnel2_rots;
        auto &tis = i == 0 ? e.m_shrapnel_alpha_tc_idx : e.m_shrapnel2_alpha_tc_idx;

        for (size_t j = 0; j < rots.size(); ++j)
        {
            auto &r = rots[j];
            auto &ti = tis[j];

            auto nt = e.m_time / life_time;

            const int tc_w_count = 16;
            const int tc_h_count = 2;
            const int tc_idx = (tc_w_count * tc_h_count + 1) * nt;

            float l = nya_math::min(e.m_time / 2.0f, 1.0f) * e.m_radius * 1.6f;

            auto ctc = tc(0, 512, 128, 128);
            ctc.x += ctc.z * (tc_idx % tc_w_count);
            ctc.y += ctc.w * (tc_idx / tc_w_count);

            auto atc = i == 0 ? tc(1920, 768, 64, 256) : tc(1664, 768, 128, 256);
            atc.x += atc.z * ti;

            auto c = color(1.0f, 1.0f, 1.0f, 1.0f);
            if (e.m_time > 1.0)
                c.w -= (e.m_time - 1.0);

            add_point(e.m_pos, l, ctc, true, atc, false, c, nya_math::vec2(0.0f, -0.9f), r, i == 0 ? 0.4f : 0.2f);
        }
        //
    }

    //fire

    for (size_t i = 0; i < e.m_fire_dirs.size(); ++i)
    {
        auto &d = e.m_fire_dirs[i];
        auto &ti = e.m_fire_alpha_tc_idx[i];

        auto nt = e.m_time / life_time;
        auto t = nya_math::min(e.m_time, 1.0f) + nt * 0.1f;
        auto p = e.m_pos + d * t * e.m_radius * 0.25f;
        auto r = e.m_radius * t * 0.75f;

        const int tc_w_count = 16;
        const int tc_h_count = 2;
        const int tc_idx = (tc_w_count * tc_h_count + 1) * nya_math::min(e.m_time / 2.0f, 1.0f);

        auto ctc = tc(0, 0, 128, 128);
        ctc.x += ctc.z * (tc_idx % tc_w_count);
        ctc.y += ctc.w * (tc_idx / tc_w_count);

        auto atc = tc(0, 1920, 128, 128);
        atc.x += atc.z * ti;

        auto c = color(hdr_coeff, hdr_coeff, hdr_coeff, 0.7f);
        if (e.m_time > 1.5)
            c.w -= (e.m_time - 1.5);

        add_point(p, r, ctc, false, atc, true, c, nya_math::vec2(), e.m_fire_rots[i]);
    }

    draw_points();
}
void match_score_layer_draw_score(Score* score){
	draw_who_serves(score);
	draw_points(score);
	draw_games(score);	
	draw_sets(score);	
}
Exemple #30
0
    void draw_stroke(SkCanvas* canvas, const SkPath& path, SkScalar width, SkScalar scale,
            bool drawText) {
        if (path.isEmpty()) {
            return;
        }
        SkRect bounds = path.getBounds();
        this->setWHZ(SkScalarCeilToInt(bounds.right()), drawText 
                ? SkScalarRoundToInt(scale * 3 / 2) : SkScalarRoundToInt(scale),
                SkScalarRoundToInt(950.0f / scale));
        erase(fMinSurface);
        SkPaint paint;
        paint.setColor(0x1f1f0f0f);
        paint.setStyle(SkPaint::kStroke_Style);
        paint.setStrokeWidth(width * scale * scale);
        paint.setColor(0x3f0f1f3f);
        if (drawText) {
            fMinSurface->getCanvas()->drawPath(path, paint);
            this->copyMinToMax();
            fMaxSurface->draw(canvas, 0, 0, NULL);
        }
        paint.setAntiAlias(true);
        paint.setStyle(SkPaint::kStroke_Style);
        paint.setStrokeWidth(1);

        paint.setColor(SKELETON_COLOR);
        SkPath scaled;
        SkMatrix matrix;
        matrix.reset();
        matrix.setScale(950 / scale, 950 / scale);
        if (drawText) {
            path.transform(matrix, &scaled);
        } else {
            scaled = path;
        }
        canvas->drawPath(scaled, paint);
        draw_points(canvas, scaled, SKELETON_COLOR, true);

        if (fDrawRibs) {
            draw_ribs(canvas, scaled, width, 0xFF00FF00);
        }

        SkPath fill;

        SkPaint p;
        p.setStyle(SkPaint::kStroke_Style);
        if (drawText) {
            p.setStrokeWidth(width * scale * scale);
        } else {
            p.setStrokeWidth(width);
        }
        p.getFillPath(path, &fill);
        SkPath scaledFill;
        if (drawText) {
            fill.transform(matrix, &scaledFill);
        } else {
            scaledFill = fill;
        }
        paint.setColor(WIREFRAME_COLOR);
        canvas->drawPath(scaledFill, paint);
        draw_points(canvas, scaledFill, WIREFRAME_COLOR, false);
    }