本文整理汇总了C++中HMGL::SetPenPal方法的典型用法代码示例。如果您正苦于以下问题:C++ HMGL::SetPenPal方法的具体用法?C++ HMGL::SetPenPal怎么用?C++ HMGL::SetPenPal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HMGL
的用法示例。
在下文中一共展示了HMGL::SetPenPal方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mgl_dots_ca
//-----------------------------------------------------------------------------
//
// Dots series
//
//-----------------------------------------------------------------------------
void MGL_EXPORT mgl_dots_ca(HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, HCDT a, const char *sch, const char *opt)
{
long n = x->GetNN(), d, k=1;
if(x->GetNz()>1) k=3; else if(x->GetNy()>1) k=2;
if(y->GetNN()!=n || z->GetNN()!=n || c->GetNN()!=n || (a && a->GetNN()!=n))
{ gr->SetWarn(mglWarnDim,"Dots"); return; }
gr->SaveState(opt);
d = gr->MeshNum>0 ? mgl_ipow(gr->MeshNum+1,k) : n;
d = n>d ? n/d:1;
static int cgid=1; gr->StartGroup("Dots",cgid++);
char mk=gr->SetPenPal(sch);
long ss=gr->AddTexture(sch);
if(mk==0) mk='.';
gr->Reserve(n);
for(long i=0;i<n;i+=d)
{
mglPoint p = mglPoint(x->vthr(i),y->vthr(i),z->vthr(i));
long pp = gr->AddPnt(p,gr->GetC(ss,c->vthr(i)),mglPoint(NAN),a?gr->GetA(a->vthr(i)):-1);
gr->mark_plot(pp, mk);
}
gr->EndGroup();
}
示例2: mgl_tricontv_xyzcv
//-----------------------------------------------------------------------------
//
// TriContV series
//
//-----------------------------------------------------------------------------
void MGL_EXPORT mgl_tricontv_xyzcv(HMGL gr, HCDT v, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
{
mglDataV zz(x->GetNx(),x->GetNy());
if(!z) z = &zz;
if(mgl_check_trig(gr,nums,x,y,z,a,"TriContV")) return;
gr->SaveState(opt);
static int cgid=1; gr->StartGroup("TriContV",cgid++);
bool fixed=(mglchr(sch,'_')) || (gr->Min.z==gr->Max.z);
long s=gr->AddTexture(sch);
gr->SetPenPal(sch);
for(long k=0;k<v->GetNx();k++)
{
mreal v0 = v->v(k); zz.Fill(fixed ? gr->Min.z : v0);
mreal dv = (gr->Max.c-gr->Min.c)/8, c = gr->GetC(s,v0);
if(k>0) dv = v->v(k-1)-v->v(k);
else if(k<v->GetNx()-1) dv = v->v(k)-v->v(k+1);
if(fixed) dv=-dv;
const std::vector<mglSegment> curvs = mgl_get_curvs(gr,mgl_tri_lines(v0,nums,a,x,y,fixed?&zz:z));
for(size_t i=0;i<curvs.size();i++)
{
const std::list<mglPoint> &pp=curvs[i].pp;
long f2=-1,g2=-1;
for(std::list<mglPoint>::const_iterator it=pp.begin(); it != pp.end(); ++it)
{
mglPoint p=*it,q(p.y,-p.x);
long f1 = f2; f2 = gr->AddPnt(p,c,q); p.z+=dv;
long g1 = g2; g2 = gr->AddPnt(p,c,q);
gr->quad_plot(f1,g1,f2,g2);
}
}
}
}
示例3: mgl_cont_z_val
//-----------------------------------------------------------------------------
void MGL_EXPORT mgl_cont_z_val(HMGL gr, HCDT v, HCDT a, const char *sch, double sv, const char *opt)
{
long n=a->GetNx(),m=a->GetNy();
if(n<2 || m<2) { gr->SetWarn(mglWarnLow,"ContZ"); return; }
gr->SaveState(opt);
if(mgl_isnan(sv)) sv = gr->GetOrgZ('z');
if(sv<gr->Min.z || sv>gr->Max.z) { gr->SetWarn(mglWarnSlc,"ContZ"); gr->LoadState(); return; }
static int cgid=1; gr->StartGroup("ContZ",cgid++);
mglDataV xx,yy,zz; mglData aa;
int text=0;
if(mglchr(sch,'t')) text=1;
if(mglchr(sch,'T')) text=2;
long ss=gr->AddTexture(sch);
gr->SetPenPal(sch);
a = fill_slice_z(gr,sv,a,xx,yy,zz,aa);
#pragma omp parallel for
for(long i=0;i<v->GetNx();i++)
{
mreal v0 = v->v(i);
mgl_cont_gen(gr,v0,a,&xx,&yy,&zz,gr->GetC(ss,v0),text,0);
}
gr->EndGroup();
}
示例4: mgl_tricont_xyzcv
//-----------------------------------------------------------------------------
void MGL_EXPORT mgl_tricont_xyzcv(HMGL gr, HCDT v, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
{
mglDataV zz(x->GetNx(),x->GetNy());
if(!z) z = &zz;
if(mgl_check_trig(gr,nums,x,y,z,a,"TriCont")) return;
gr->SaveState(opt);
static int cgid=1; gr->StartGroup("TriCont",cgid++);
int text=0;
if(mglchr(sch,'t')) text=1;
if(mglchr(sch,'T')) text=2;
bool fixed=(mglchr(sch,'_')) || (gr->Min.z==gr->Max.z);
long s=gr->AddTexture(sch);
gr->SetPenPal(sch);
for(long k=0;k<v->GetNx();k++)
{
mreal v0 = v->v(k); zz.Fill(fixed ? gr->Min.z : v0);
mgl_draw_curvs(gr,v0,gr->GetC(s,v0),text,mgl_get_curvs(gr,mgl_tri_lines(v0,nums,a,x,y,fixed?&zz:z)));
}
}
示例5: mgl_triplot_xyzc
//-----------------------------------------------------------------------------
//
// TriPlot series
//
//-----------------------------------------------------------------------------
void MGL_EXPORT mgl_triplot_xyzc(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
{
long n = x->GetNx(), m = nums->GetNy();
if(mgl_check_trig(gr,nums,x,y,z,a,"TriPlot")) return;
long ss=gr->AddTexture(sch);
gr->SaveState(opt); gr->SetPenPal("-");
static int cgid=1; gr->StartGroup("TriPlot",cgid++);
bool wire = mglchr(sch,'#');
long nc = a->GetNx();
if(nc!=n && nc>=m) // colors per triangle
{
mglPoint p1,p2,p3,q;
gr->Reserve(m*3);
for(long i=0;i<m;i++)
{
register long k1 = long(nums->v(0,i)+0.5);
p1 = mglPoint(x->v(k1), y->v(k1), z->v(k1));
register long k2 = long(nums->v(1,i)+0.5);
p2 = mglPoint(x->v(k2), y->v(k2), z->v(k2));
register long k3 = long(nums->v(2,i)+0.5);
p3 = mglPoint(x->v(k3), y->v(k3), z->v(k3));
q = wire ? mglPoint(NAN,NAN) : (p2-p1) ^ (p3-p1);
k1 = gr->AddPnt(p1,gr->GetC(ss,a->v(k1)),q);
k2 = gr->AddPnt(p2,gr->GetC(ss,a->v(k2)),q);
k3 = gr->AddPnt(p3,gr->GetC(ss,a->v(k3)),q);
gr->trig_plot(k1,k2,k3);
}
}
else if(nc>=n) // colors per point
{
gr->Reserve(n);
long *kk = new long[n];
mglPoint *pp = new mglPoint[n];
for(long i=0;i<m;i++) // add averaged normales
{
register long k1 = long(nums->v(0,i)+0.5);
register long k2 = long(nums->v(1,i)+0.5);
register long k3 = long(nums->v(2,i)+0.5);
if(!wire)
{
mglPoint q = mglPoint(x->v(k2)-x->v(k1), y->v(k2)-y->v(k1), z->v(k2)-z->v(k1)) ^
mglPoint(x->v(k3)-x->v(k1), y->v(k3)-y->v(k1), z->v(k3)-z->v(k1));
q.Normalize();
// try be sure that in the same direction ...
if(q.z<0) q *= -1;
pp[k1] += q; pp[k2] += q; pp[k3] += q;
}
else pp[k1]=pp[k2]=pp[k3]=mglPoint(NAN,NAN);
}
for(long i=0;i<n;i++) // add points
kk[i] = gr->AddPnt(mglPoint(x->v(i), y->v(i), z->v(i)), gr->GetC(ss,a->v(i)), pp[i]);
for(long i=0;i<m;i++) // draw triangles
{
register long k1 = long(nums->v(0,i)+0.5);
register long k2 = long(nums->v(1,i)+0.5);
register long k3 = long(nums->v(2,i)+0.5);
if(wire)
{
gr->line_plot(kk[k1],kk[k2]); gr->line_plot(kk[k1],kk[k3]);
gr->line_plot(kk[k3],kk[k2]);
}
else gr->trig_plot(kk[k1],kk[k2],kk[k3]);
}
delete []kk; delete []pp;
}
gr->EndGroup();
}
示例6: mgl_quadplot_xyzc
//-----------------------------------------------------------------------------
//
// QuadPlot series
//
//-----------------------------------------------------------------------------
void MGL_EXPORT mgl_quadplot_xyzc(HMGL gr, HCDT nums, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
{
long n = x->GetNx(), m = nums->GetNy();
if(mgl_check_trig(gr,nums,x,y,z,a,"QuadPlot",4)) return;
long ss=gr->AddTexture(sch);
gr->SaveState(opt); gr->SetPenPal("-");
static int cgid=1; gr->StartGroup("QuadPlot",cgid++);
mglPoint p1,p2,p3,p4;
long nc = a->GetNx();
bool wire = mglchr(sch,'#');
if(nc!=n && nc>=m) // colors per triangle
{
gr->Reserve(m*4);
for(long i=0;i<m;i++)
{
register long k1 = long(nums->v(0,i)+0.5);
p1 = mglPoint(x->v(k1), y->v(k1), z->v(k1));
register long k2 = long(nums->v(1,i)+0.5);
p2 = mglPoint(x->v(k2), y->v(k2), z->v(k2));
register long k3 = long(nums->v(2,i)+0.5);
p3 = mglPoint(x->v(k3), y->v(k3), z->v(k3));
register long k4 = floor(nums->v(3,i)+0.5);
p4 = mglPoint(x->v(k4), y->v(k4), z->v(k4));
mglPoint q = wire ? mglPoint(NAN,NAN):(p2-p1) ^ (p3-p1);
k1 = gr->AddPnt(p1,gr->GetC(ss,a->v(k1)),q);
k2 = gr->AddPnt(p2,gr->GetC(ss,a->v(k2)),q);
k3 = gr->AddPnt(p3,gr->GetC(ss,a->v(k3)),q);
k4 = gr->AddPnt(p4,gr->GetC(ss,a->v(k4)),q);
gr->quad_plot(k1,k2,k3,k4);
}
}
else if(nc>=n) // colors per point
{
gr->Reserve(n);
long *kk = new long[n];
mglPoint *pp = new mglPoint[n];
for(long i=0;i<m;i++) // add averaged normales
{
register long k1 = long(nums->v(0,i)+0.5);
p1 = mglPoint(x->v(k1), y->v(k1), z->v(k1));
register long k2 = long(nums->v(1,i)+0.5);
p2 = mglPoint(x->v(k2), y->v(k2), z->v(k2));
register long k3 = long(nums->v(2,i)+0.5);
p3 = mglPoint(x->v(k3), y->v(k3), z->v(k3));
register long k4 = floor(nums->v(3,i)+0.5);
p4 = mglPoint(x->v(k4), y->v(k4), z->v(k4));
if(wire) pp[k1]=pp[k2]=pp[k3]=pp[k4]=mglPoint(NAN,NAN);
else
{
mglPoint q1 = (p2-p1) ^ (p3-p1); if(q1.z<0) q1*=-1;
mglPoint q2 = (p2-p4) ^ (p3-p4); if(q2.z<0) q2*=-1;
mglPoint q3 = (p1-p2) ^ (p4-p2); if(q3.z<0) q3*=-1;
mglPoint q4 = (p1-p4) ^ (p4-p3); if(q4.z<0) q4*=-1;
pp[k1] += q1; pp[k2] += q2; pp[k3] += q3; pp[k4] += q4;
}
}
for(long i=0;i<n;i++) // add points
kk[i] = gr->AddPnt(mglPoint(x->v(i), y->v(i), z->v(i)),gr->GetC(ss,a->v(i)), pp[i]);
for(long i=0;i<m;i++) // draw quads
{
register long k1 = floor(nums->v(0,i)+0.5);
register long k2 = floor(nums->v(1,i)+0.5);
register long k3 = floor(nums->v(2,i)+0.5);
register long k4 = floor(nums->v(3,i)+0.5);
if(wire)
{
gr->line_plot(kk[k1],kk[k2]); gr->line_plot(kk[k1],kk[k3]);
gr->line_plot(kk[k4],kk[k2]); gr->line_plot(kk[k4],kk[k3]);
}
else gr->quad_plot(kk[k1],kk[k2],kk[k3],kk[k4]);
}
delete []kk; delete []pp;
}
gr->EndGroup();
}