Esempio n. 1
0
PRIVATE Pointer si_readDouble (char *buffer, boolean *error)
{
    double value;

#ifdef MACINTOSH
    value = ATOF(buffer);
    *error = FALSE;
#else
    *error = (sscanf (buffer, "%lf", (double *) &value) != 1);
#endif
    return SUIT_copyData ((void *) &value, sizeof (double));
}
Esempio n. 2
0
bool ResourceBuffer::GetFloat32(float32& o_fValue)
{
	while (m_nCol < m_vecCol.size())
	{
		if (m_vecFlags[m_nCol++])
		{
			o_fValue = ATOF(m_vecCol[m_nCol - 1].c_str());
			return true;
		}
	}
	return false;
}
Esempio n. 3
0
static void	parsing_options(char **tab, t_env *rt, int i)
{
	if (!tab[0] || !tab[1])
		ft_exit("\033[31mWrong format for an object\n");
	missing_parameter_obj(tab);
	if (!ft_strcmp(tab[0], "radius"))
	{
		if (ATOF(2) <= 0 && rt->object[i].name != PLANE &&
		rt->object[i].name != HYPERBOL)
			ft_exit("\033[31mRadius must be positive\n");
		rt->object[i].radius = ATOF(2);
	}
	else if (!ft_strcmp(tab[0], "pos"))
		rt->object[i].center = new_vector(ATOF(2), ATOF(3), ATOF(4));
	else if (!ft_strcmp(tab[0], "color"))
	{
		check_color(ATOF(2), ATOF(3), ATOF(4));
		rt->object[i].color = new_color(ATOF(2), ATOF(3), ATOF(4));
	}
}
Esempio n. 4
0
static void	parsing_options2(char **tab, t_env *rt, int i)
{
	if (!ft_strcmp(tab[0], "angle"))
		rt->object[i].angle = new_vector(ATOF(2), ATOF(3), ATOF(4));
	else if (!ft_strcmp(tab[0], "a"))
		rt->object[i].a = new_vector(ATOF(2), ATOF(3), ATOF(4));
	else if (!ft_strcmp(tab[0], "b"))
		rt->object[i].b = new_vector(ATOF(2), ATOF(3), ATOF(4));
	else if (!ft_strcmp(tab[0], "c"))
		rt->object[i].c = new_vector(ATOF(2), ATOF(3), ATOF(4));
	else if (!ft_strcmp(tab[0], "material"))
		parsing_material(rt, &rt->object[i].material, tab[2]);
	else if (!ft_strcmp(tab[0], "separation"))
		rt->object[i].separation = ATOF(2);
}
Esempio n. 5
0
int main(int argc, char **argv)
   {int i, k, l, nt, fast;
    int maxes[2], X_max, Y_max, n_pts, use_color, palette;
    double x, y, dx, dy, theta, phi, dp;
    char t[MAXLINE], *token, *emap;
    PG_rendering pty;
    PG_device *SCR_dev, *PS_mdev, *CGM_mdev, *PS_cdev, *CGM_cdev;
    double *rx, *ry, *rz, *rs, *px, *py, *pz, *ps, *ext;
    pcons *alist;
    char *palettes[] = {"spectrum", "rainbow", "bw"};

    X_max     = N_POINTS;
    Y_max     = N_POINTS;
    palette   = 0;
    use_color = FALSE;
    pty      = PLOT_WIRE_MESH;
    dp        = 0.0;
    nt        = 1;
    fast      = FALSE;
    for (i = 1; i < argc; i++)
        {if (argv[i][0] == '-')
            {switch (argv[i][1])
                {case 'c' :
		      use_color = TRUE;
		      break;
                 case 'd' :
		      dp = ATOF(argv[++i]);
		      break;
                 case 'f' :
		      fast = TRUE;
		      break;
                 case 'h' :
		      print_help();
		      return(1);
                 case 'n' :
		      nt = atoi(argv[++i]);
		      break;
                 case 'p' :
		      palette = atoi(argv[++i]);
		      break;
                 case 's' :
		      pty = PLOT_SURFACE;
		      break;
                 case 'w' :
		      pty = PLOT_WIRE_MESH;
		      break;
                 case 'z' :
		      X_max = Y_max = atoi(argv[++i]);
		      break;};}

         else
            break;};

    SC_init_threads(nt, NULL);

    maxes[0] = X_max;
    maxes[1] = Y_max;
    n_pts    = X_max*Y_max;

    emap = CMAKE_N(char, n_pts);
    memset(emap, 1, n_pts);
    alist = PG_set_attrs_alist(NULL,
			      "EXISTENCE", G_CHAR_I, TRUE, emap,
			      NULL);

    PG_open_console("TGSSF", "MONOCHROME", 1,
                    0.55, 0.1, 0.4, 0.8);

    if (use_color)
       SCR_dev = PG_make_device("WINDOW", "COLOR", "PGS Surface Test");
    else
       SCR_dev = PG_make_device("WINDOW", "MONOCHROME", "PGS Surface Test");
/*    PG_open_device(SCR_dev, 0.1, 0.1, 0.02, 0.02); */
    PG_open_device(SCR_dev, 0.1, 0.1, 0.4, 0.4);

    if (pty == PLOT_SURFACE)
       PG_fset_palette(SCR_dev, palettes[palette]);

    if (fast)
       {PS_cdev  = PG_make_device("PS", "COLOR", "tgssf-c");
	CGM_cdev = PG_make_device("CGM", "COLOR", "tgssf-c");
	PS_mdev  = PG_make_device("PS", "MONOCHROME", "tgssf-m");
	CGM_mdev = PG_make_device("CGM", "MONOCHROME", "tgssf-m");

	PG_open_device(PS_cdev, 0.0, 0.0, 0.0, 0.0);
	PG_open_device(CGM_cdev, 0.0, 0.0, 0.0, 0.0);
	PG_open_device(PS_mdev, 0.0, 0.0, 0.0, 0.0);
	PG_open_device(CGM_mdev, 0.0, 0.0, 0.0, 0.0);

	if (pty == PLOT_SURFACE)
	   {PG_fset_palette(PS_mdev, palettes[palette]);
	    PG_fset_palette(CGM_mdev, palettes[palette]);
	    PG_fset_palette(PS_cdev, palettes[palette]);
	    PG_fset_palette(CGM_cdev, palettes[palette]);};};

    rx = px = CMAKE_N(double, n_pts);
    ry = py = CMAKE_N(double, n_pts);
    rz = pz = CMAKE_N(double, n_pts);

    if (pty == PLOT_SURFACE)
       rs = ps = CMAKE_N(double, n_pts);
    else