Exemplo n.º 1
0
HMDT MGL_EXPORT mgl_triangulation_2d(HCDT x, HCDT y)
{
	mglData *nums=0;
	long n = x->GetNN();
	if(y->GetNN()!=n)	return nums;
	// use s-hull here
	std::vector<Shx> pts;
	std::vector<long> out;
	Shx pt;

	double mx = 0, my = 0;
	for(long i=0;i<n;i++)
	{
		register double t;
		t = fabs(x->vthr(i));	if(t>mx)	mx=t;
		t = fabs(y->vthr(i));	if(t>my)	my=t;
	}
	mx *= 1e-15;	my *= 1e-15;
	for(long i=0;i<n;i++)
	{
		pt.r = x->vthr(i);	pt.c = y->vthr(i);
		if(mgl_isbad(pt.r) || mgl_isbad(pt.c))	continue;
		if(fabs(pt.r)<mx)	pt.r=0;
		if(fabs(pt.c)<my)	pt.c=0;
		pt.id = i;    pts.push_back(pt);
	}

	std::vector<Triad> triads;
	if(de_duplicate(pts, out))
		mgl_set_global_warn("There are duplicated points for triangulation.");
	s_hull_pro(pts, triads);
	long m = triads.size();
	nums=new mglData(3,m);
	for(long i=0;i<m;i++)
	{
		nums->a[3*i]   = triads[i].a;
		nums->a[3*i+1] = triads[i].b;
		nums->a[3*i+2] = triads[i].c;
	}
	return nums;
}
Exemplo n.º 2
0
void MGL_EXPORT mgl_write_prc(HMGL gr, const char *fname,const char *descr, int make_pdf)
{	mgl_set_global_warn("PNG support was disabled. Please, enable it and rebuild MathGL.");	}
Exemplo n.º 3
0
void MGL_EXPORT mgl_write_prc_(uintptr_t *graph, const char *fname,const char *descr, int *make_pdf,int lf,int ld)
{	mgl_set_global_warn("PNG support was disabled. Please, enable it and rebuild MathGL.");	}
Exemplo n.º 4
0
void MGL_EXPORT mgl_set_global_warn_(const char *txt, int l)
{	char *s=new char[l+1];	memcpy(s,txt,l);	s[l]=0;	mgl_set_global_warn(s);	delete []s;	}